prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--Detect when a player is added.
|
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function()
repeat wait() until player.Character
local char = player.Character
--Insert gui into player.
local gui = guibase:Clone()
gui.Parent = player.PlayerGui
--Setup name.
local mod = Instance.new("Model")
local hum = Instance.new("Humanoid")
local head = Instance.new("Part")
--Insert humanoid into model.
hum.Parent = mod
--Set initial name to be blank.
mod.Name = ""
--Set head properties.
head.Size = Vector3.new(1,1,1)
head.CanCollide = false
head.Transparency = 0.99
head.Name = "Head"
head.Parent = mod
--Finish model setup.
mod.PrimaryPart = head
mod.Parent = char
mod:SetPrimaryPartCFrame(char.Head.CFrame+Vector3.new(0,0.5,0))
--Weld part to character.
local w = Instance.new("Weld")
w.Name = ("Weld")
w.Part0,w.Part1 = head,char.Head
w.C0 = head.CFrame:inverse()
w.C1 = char.Head.CFrame:inverse()
w.Parent = head
--Add server side handling to model.
local svh = gui.ServerHandler
svh.Parent = mod
svh.ServerHandler.Disabled = false
gui.HandlerPointer.Value = svh
--Enable local handler to finish setup.
gui.LocalHandler.Disabled = false
end)
end)
|
--!strict
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local GraspDetection = require(ReplicatedStorage.GraspDetection)
local Thresholds = script.Parent.Thresholds
local TName, TValue = Thresholds.ThresholdName, Thresholds.ThresholdValue
local THRESHOLDS = GraspDetection.GetThresholds()
local ThresholdIndex = 1
TName.Text = THRESHOLDS[ThresholdIndex]
TValue.Text = GraspDetection.GetThresholdValue(THRESHOLDS[ThresholdIndex])
TName.Activated:Connect(function()
ThresholdIndex += 1
if ThresholdIndex > #THRESHOLDS then
ThresholdIndex = 1
end
TName.Text = THRESHOLDS[ThresholdIndex]
TValue.Text = GraspDetection.GetThresholdValue(THRESHOLDS[ThresholdIndex])
end)
TValue.FocusLost:Connect(function(enterPressed)
if not enterPressed then
return
end
GraspDetection.UpdateThreshold(THRESHOLDS[ThresholdIndex], tonumber(TValue.Text))
TValue.Text = GraspDetection.GetThresholdValue(THRESHOLDS[ThresholdIndex])
end)
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- Place this into StarterGui or StarterPack --
-- CREDIT --
-- winter_beast768; for the initial script --
-- SawyerDGamer; some stuff ripped from his panner script --
-- iytgggggg; shoving it all into this script and then some :) --
-- UPDATE: turned it into r15, made it so you can swim right in water --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
| |
--[[Steering]]
|
Tune.SteerInner = 75 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 75 -- Outer wheel steering angle (in degrees)
Tune.SteerSpeed = .5 -- Steering increment per tick (in degrees)
Tune.ReturnSpeed = .5 -- Steering increment per tick (in degrees)
Tune.SteerDecay = 320 -- Speed of gradient cutoff (in SPS)
Tune.MinSteer = 10 -- Minimum steering at max steer decay (in percent)
Tune.MSteerExp = 1 -- Mouse steering exponential degree
--Steer Gyro Tuning
Tune.SteerD = 1000 -- Steering Dampening
Tune.SteerMaxTorque = 50000 -- Steering Force
Tune.SteerP = 7000 -- Steering Aggressiveness
|
--/Damage Modification
|
module.DamageMod = 1
module.minDamageMod = 1
|
-- Place all application constants here.
|
return {
CameraTweenTime = 0.75,
SurfaceArtSelectorItemSize = 200,
Errors = {
CanvasFull = "CanvasFull",
CanvasNotFound = "CanvasNotFound",
SpotNotAvailable = "SpotNotAvailable",
SpotNotFound = "SpotNotFound",
PlayerSpotsNotFound = "PlayerSpotsNotFound",
},
Tags = {
SurfaceCanvas = "SurfaceCanvas",
},
Attributes = {
SurfaceCanvasId = "SurfaceCanvasId",
SpotIdPrefix = "SurfaceCanvasSpot_",
SurfaceCanvasFace = "SurfaceCanvasFace",
},
}
|
-- Fixed By DT4E --
|
while true do
script.Parent.BrickColor = BrickColor.new("Bright Blue")
wait(0.15)
script.Parent.BrickColor = BrickColor.new("Lime green")
wait(0.15)
end
|
----- MAGIC NUMBERS ABOUT THE TOOL -----
-- How much damage a bullet does
|
local Damage = 20
|
--[[Drivetrain]]
|
Tune.Config = "AWD" --"FWD" , "RWD" , "AWD"
--Differential Settings
Tune.FDiffSlipThres = 50 -- 1 - 100% (Max threshold of applying full lock determined by deviation from avg speed)
Tune.FDiffLockThres = 50 -- 0 - 100% (0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
Tune.RDiffSlipThres = 50 -- 1 - 100%
Tune.RDiffLockThres = 50 -- 0 - 100%
Tune.CDiffSlipThres = 50 -- 1 - 100% [AWD Only]
Tune.CDiffLockThres = 50 -- 0 - 100% [AWD Only]
--Traction Control Settings
Tune.TCSEnabled = true -- Implements TCS
Tune.TCSThreshold = 20 -- Slip speed allowed before TCS starts working (in SPS)
Tune.TCSGradient = 20 -- Slip speed gradient between 0 to max reduction (in SPS)
Tune.TCSLimit = 10 -- Minimum amount of torque at max reduction (in percent)
|
------------------------------------------------------------------------
-- limits for opcode arguments.
-- we use (signed) int to manipulate most arguments,
-- so they must fit in LUAI_BITSINT-1 bits (-1 for sign)
------------------------------------------------------------------------
-- removed "#if SIZE_Bx < BITS_INT-1" test, assume this script is
-- running on a Lua VM with double or int as LUA_NUMBER
|
luaP.MAXARG_Bx = math.ldexp(1, luaP.SIZE_Bx) - 1
luaP.MAXARG_sBx = math.floor(luaP.MAXARG_Bx / 2) -- 'sBx' is signed
luaP.MAXARG_A = math.ldexp(1, luaP.SIZE_A) - 1
luaP.MAXARG_B = math.ldexp(1, luaP.SIZE_B) - 1
luaP.MAXARG_C = math.ldexp(1, luaP.SIZE_C) - 1
|
------------------------------------------
--Clear And Enter
|
function Clear()
print("Cleared")
Input = ""
end
script.Parent.Clear.ClickDetector.MouseClick:connect(Clear)
function Enter()
if Input == Code then
print("Entered")
Input = ""
local door = script.Parent.Parent.Door
door.Anchored = false
door.Transparency = door.Transparency + 0.1
wait(0.1)
door.Transparency = door.Transparency + 0.1
wait(0.1)
door.Transparency = door.Transparency + 0.1
wait(0.1)
door.Transparency = door.Transparency + 0.1
wait(0.1)
door.Transparency = door.Transparency + 0.1
wait(0.1)
door.Transparency = door.Transparency + 0.1
wait(0.1)
door.Transparency = door.Transparency + 0.1
wait(0.1)
door.Transparency = 0.8
wait(3)--
door.Transparency = door.Transparency - 0.1
wait(0.1)
door.Transparency = door.Transparency - 0.1
wait(0.1)
door.Transparency = door.Transparency - 0.1
wait(0.1)
door.Transparency = door.Transparency - 0.1
wait(0.1)
door.Transparency = door.Transparency - 0.1
wait(0.1)
door.Transparency = door.Transparency - 0.1
wait(0.1)
door.Transparency = door.Transparency - 0.1
wait(0.1)
door.Transparency = 0
return end
Input = ""
print("Wrong Code")
end
script.Parent.Enter.ClickDetector.MouseClick:connect(Enter)
|
-- << RETRIEVE FRAMEWORK >>
|
local main = _G.HDAdminMain
|
--~WeaponHelper~--
|
local debounce = false --I wouldn't touch this at all. Its the "Debounce"--
function onTouch(part) --The function--
local h = part.Parent:findFirstChild("Humanoid") --Find first person who hits--
if (h ~= nil) and debounce == false then --If the person is still alive, then...
debounce = true --Set debounce to: True
h.WalkSpeed = 0 --You must change this if you want to change the walking speed. Just change the number (16 is normal)--
wait(0.3) --Also, you can change the numebr to how long some-one else can touch it.--
debounce = false --Set debounce to: False
end --End--
end --Double check--
script.Parent.Touched:connect(onTouch) --Double check--
|
-- Connect the PlayerJoined function to the PlayerAdded event of the Players service
|
Players.PlayerAdded:Connect(PlayerJoined)
|
--[[ local Workspace = game:GetService("Workspace")
local GuiService = game:GetService("GuiService")
local Camera = Workspace.CurrentCamera
local TopInset, BottomInset = GuiService:GetGuiInset()
local Roact = require("Roact")
local Scale = Roact.PureComponent:extend("Scale")
function Scale:init()
self:update()
self.Listener = Camera:GetPropertyChangedSignal("ViewportSize"):Connect(function()
self:update()
end)
end
function Scale:update()
local currentSize = self.props.Size
local viewportSize = Camera.ViewportSize - (TopInset + BottomInset)
self:setState({
Scale = 1 / math.max(
currentSize.X / viewportSize.X,
currentSize.Y / viewportSize.Y
)
})
end
function Scale:willUnmount()
self.Listener:Disconnect()
end
function Scale:render()
return Roact.createElement("UIScale", {
Scale = self.state.Scale * self.props.Scale
})
end
Scale.defaultProps = {
Scale = 1
}
return Scale
]]
|
local Fusion = require(game.ReplicatedStorage.Packages.Fusion)
local New = Fusion.New
local Children = Fusion.Children
local OnEvent = Fusion.OnEvent
local OnChange = Fusion.OnChange
local State = Fusion.State
local Computed = Fusion.Computed
local Spring = Fusion.Spring
local Workspace = game:GetService("Workspace")
local GuiService = game:GetService("GuiService")
local Camera = Workspace.CurrentCamera
local TopInset, BottomInset = GuiService:GetGuiInset()
local function UIScale(props)
--props: Size = v3 Scale = float
local ScaleState = State()
local function update()
local currentSize = props.Size
local viewportSize = Camera.ViewportSize - (TopInset + BottomInset)
ScaleState:set(1 / math.max(
currentSize.X / viewportSize.X,
currentSize.Y / viewportSize.Y
))
end
update()
Camera:GetPropertyChangedSignal("ViewportSize"):Connect(update)
return New "UIScale" {
Scale = Computed(function()
return ScaleState:get() * props.Scale
end)
}
end
return UIScale
|
--camera--
|
repeat wait() until Player.Character
Camera.CameraType = "Scriptable"
Camera.CFrame = game.Workspace.CameraPart.CFrame
|
-- put in Starter Character
|
local character = script.Parent
function recurse(root,callback,i)
i= i or 0
for _,v in pairs(root:GetChildren()) do
i = i + 1
callback(i,v)
if #v:GetChildren() > 0 then
i = recurse(v,callback,i)
end
end
return i
end
function ragdollJoint(part0, part1, attachmentName, className, properties)
attachmentName = attachmentName.."RigAttachment"
local constraint = Instance.new(className.."Constraint")
constraint.Attachment0 = part0:FindFirstChild(attachmentName)
constraint.Attachment1 = part1:FindFirstChild(attachmentName)
constraint.Name = "RagdollConstraint"..part1.Name
for _,propertyData in next,properties or {} do
constraint[propertyData[1]] = propertyData[2]
end
constraint.Parent = character
end
function getAttachment0(attachmentName)
for _,child in next,character:GetChildren() do
local attachment = child:FindFirstChild(attachmentName)
if attachment then
return attachment
end
end
end
character:WaitForChild("Humanoid").Died:connect(function()
local camera = workspace.CurrentCamera
if camera.CameraSubject == character.Humanoid then--If developer isn't controlling camera
camera.CameraSubject = character.UpperTorso
end
--Make it so ragdoll can't collide with invisible HRP, but don't let HRP fall through map and be destroyed in process
character.HumanoidRootPart.Anchored = true
character.HumanoidRootPart.CanCollide = true
--Helps to fix constraint spasms
recurse(character, function(_,v)
if v:IsA("Attachment") then
v.Axis = Vector3.new(0, 1, 0)
v.SecondaryAxis = Vector3.new(0, 0, 1)
v.Rotation = Vector3.new(0, 0, 0)
end
end)
for _,child in next,character:GetChildren() do
if child:IsA("Accoutrement") then
for _,part in next,child:GetChildren() do
if part:IsA("BasePart") then
part.Parent = character
child:remove()
local attachment1 = part:FindFirstChildOfClass("Attachment")
local attachment0 = getAttachment0(attachment1.Name)
if attachment0 and attachment1 then
local constraint = Instance.new("HingeConstraint")
constraint.Attachment0 = attachment0
constraint.Attachment1 = attachment1
constraint.LimitsEnabled = true
constraint.UpperAngle = 0
constraint.LowerAngle = 0
constraint.Parent = character
end
end
end
end
end
ragdollJoint(character.LowerTorso, character.UpperTorso, "Waist", "BallSocket", {
{"LimitsEnabled",true};
{"UpperAngle",150};
})
ragdollJoint(character.UpperTorso, character.Head, "Neck", "BallSocket", {
{"LimitsEnabled",true};
{"UpperAngle",15};
})
local handProperties = {
{"LimitsEnabled", true};
{"UpperAngle",0};
{"LowerAngle",0};
}
ragdollJoint(character.LeftLowerArm, character.LeftHand, "LeftWrist", "Hinge", handProperties)
ragdollJoint(character.RightLowerArm, character.RightHand, "RightWrist", "Hinge", handProperties)
local shinProperties = {
{"LimitsEnabled", true};
{"UpperAngle", 150};
{"LowerAngle", -150};
}
ragdollJoint(character.LeftUpperLeg, character.LeftLowerLeg, "LeftKnee", "Hinge", shinProperties)
ragdollJoint(character.RightUpperLeg, character.RightLowerLeg, "RightKnee", "Hinge", shinProperties)
local footProperties = {
{"LimitsEnabled", true};
{"UpperAngle", 150};
{"LowerAngle", -150};
}
ragdollJoint(character.LeftLowerLeg, character.LeftFoot, "LeftAnkle", "Hinge", footProperties)
ragdollJoint(character.RightLowerLeg, character.RightFoot, "RightAnkle", "Hinge", footProperties)
--TODO fix ability for socket to turn backwards whenn ConeConstraints are shipped
ragdollJoint(character.UpperTorso, character.LeftUpperArm, "LeftShoulder", "BallSocket")
ragdollJoint(character.LeftUpperArm, character.LeftLowerArm, "LeftElbow", "BallSocket")
ragdollJoint(character.UpperTorso, character.RightUpperArm, "RightShoulder", "BallSocket")
ragdollJoint(character.RightUpperArm, character.RightLowerArm, "RightElbow", "BallSocket")
ragdollJoint(character.LowerTorso, character.LeftUpperLeg, "LeftHip", "BallSocket")
ragdollJoint(character.LowerTorso, character.RightUpperLeg, "RightHip", "BallSocket")
end)
end
|
--// # key, Wail
|
mouse.KeyDown:connect(function(key)
if key=="r" then
if veh.Lightbar.middle.Wail.IsPlaying == true then
veh.Lightbar.middle.Wail:Stop()
veh.Lightbar.middle.Yelp:Stop()
veh.Lightbar.middle.Priority:Stop()
script.Parent.Parent.Sirens.Wail.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
else
veh.Lightbar.middle.Wail:Play()
veh.Lightbar.middle.Yelp:Stop()
veh.Lightbar.middle.Priority:Stop()
script.Parent.Parent.Sirens.Wail.BackgroundColor3 = Color3.fromRGB(215, 135, 110)
script.Parent.Parent.Sirens.Yelp.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
script.Parent.Parent.Sirens.Priority.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
end
end
end)
|
--[[
Takes an arbitrary number of callback, and executes them in parallel, returning the results of the first to return.
If an error is thrown, that error is bubbled up to the main thread.
When the first callback returns, the rest are cancelled using task.cancel.
Exposes similar functionality that Promise.race provides for promises, but for asynchronous lua callbacks
--]]
|
type Callback = () -> ...any
local function waitForFirstAsync(...: Callback)
local thisThread = coroutine.running()
local resumed = false
local errorThrown: any
local function resume(...: any)
if resumed then
return
end
resumed = true
task.spawn(thisThread, ...)
end
for _, callback in ipairs({ ... }) do
task.defer(function()
-- We are capturing all values returned by pcall into a table so we can resume this thread
-- with all values if multiple are returned
local pcallReturnValues = { pcall(callback) }
if not pcallReturnValues[1] then
errorThrown = pcallReturnValues[2]
end
resume(table.unpack(pcallReturnValues, 2))
end)
end
local returnValues = { coroutine.yield() }
if errorThrown then
-- Return the stack trace three callers up to where the function passed into waitForFirstAsync was
-- declared
error(errorThrown, 3)
end
return table.unpack(returnValues)
end
return waitForFirstAsync
|
--[=[
Returns a list of all of the keys that a table has. (In order of pairs)
@param source table -- Table source to extract keys from
@return table -- A list with all the keys the table has
]=]
|
function Table.keys(source)
local new = {}
for key, _ in pairs(source) do
table.insert(new, key)
end
return new
end
|
--[=[
Loads a folder into a localization table
@param folder Folder -- A Roblox folder with StringValues containing JSON, named with the localization in mind
]=]
|
function JsonToLocalizationTable.loadFolder(folder)
local localizationTable = JsonToLocalizationTable.getOrCreateLocalizationTable()
for _, item in pairs(folder:GetDescendants()) do
if item:IsA("StringValue") then
local localeId = JsonToLocalizationTable.localeFromName(item.Name)
JsonToLocalizationTable.addJsonToTable(localizationTable, localeId, item.Value)
elseif item:IsA("ModuleScript") then
local localeId = JsonToLocalizationTable.localeFromName(item.Name)
recurseAdd(localizationTable, localeId, "", require(item))
end
end
return localizationTable
end
|
--- Wait for fire to be called, and return the arguments it was given.
-- @treturn ... Variable arguments from connection
|
function Signal:Wait()
self._bindableEvent.Event:Wait()
assert(self._argData, "Missing arg data, likely due to :TweenSize/Position corrupting threadrefs.")
return unpack(self._argData, 1, self._argCount)
end
|
---Drivetrain Initialize
|
local wDia = 0
local Drive={}
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then
for i,v in pairs(car.Wheels:GetChildren()) do
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
table.insert(Drive,v)
end
end
end
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then
for i,v in pairs(car.Wheels:GetChildren()) do
if v.Name=="RL" or v.Name=="RR" or v.Name=="R" then
table.insert(Drive,v)
end
end
end
for i,v in pairs(Drive) do
if v.Size.x>wDia then wDia = v.Size.x end
end
for i,v in pairs(car.Wheels:GetChildren()) do
if math.abs(v["#AV"].maxTorque.Magnitude-_Tune.PBrakeForce)<1 then
_PBrake=true
end
end
|
------------------------------------------
|
gui.Track.Text = radio.TName.Value
radio.TName.Changed:connect(function()
gui.Track.Text = radio.TName.Value
seat.Parent.Body.Dash.S.G.Song.Text = radio.TName.Value
seat.Parent.Body.Dash.S0.G.Song.Text = radio.TName.Value
seat.Parent.Body.Dash.S1.G.Song.Text = radio.TName.Value
end)
gui.Stop.MouseButton1Click:connect(function()
if radio.Stopped.Value == false then
radio.Stopped.Value = true
end
end)
gui.Pause.MouseButton1Click:connect(function()
if radio.Paused.Value == false and radio.Stopped.Value == false then
radio.Paused.Value = true
end
end)
gui.Play.MouseButton1Click:connect(function()
if radio.Stopped.Value == true then
radio.Play.Value = not radio.Play.Value
else
if radio.Paused.Value == true then
radio.Paused.Value = false
end
end
end)
gui.Forward.MouseButton1Click:connect(function()
local n = radio.Track.Value+1
if n>#radio.Songs:GetChildren() then
n = 1
end
radio.Track.Value = n
end)
gui.Back.MouseButton1Click:connect(function()
local n = radio.Track.Value-1
if n<=0 then
n = #radio.Songs:GetChildren()
end
radio.Track.Value = n
end)
gui.AutoplayOn.MouseButton1Click:connect(function()
if radio.Autoplay.Value == true then
radio.Autoplay.Value = false
end
end)
gui.AutoplayOff.MouseButton1Click:connect(function()
if radio.Autoplay.Value == false then
radio.Autoplay.Value = true
end
end)
gui.List.MouseButton1Click:connect(function()
gui.Menu.Visible=not gui.Menu.Visible
end)
gui.Id.MouseButton1Click:connect(function()
gui.IdPlayer.Visible=not gui.IdPlayer.Visible
if gui.IdPlayer.Visible then gui.Id.Rotation=180 else gui.Id.Rotation=0 end
end)
gui.IdPlayer.Play.MouseButton1Click:connect(function()
if radio.IdPlay.Value==gui.IdPlayer.TextBox.Text then
radio.IdPlay.Value=""
wait()
end
radio.IdPlay.Value=gui.IdPlayer.TextBox.Text
end)
for i,v in pairs(gui.Menu:GetChildren()) do
v.MouseButton1Click:connect(function()
radio.Track.Value = i
end)
end
function Stopped()
if radio.Stopped.Value == true then
gui.Pause.Visible = false
gui.Play.Visible = true
else
gui.Play.Visible = false
gui.Pause.Visible = true
end
end
function Paused()
if radio.Paused.Value == true then
gui.Pause.Visible = false
gui.Play.Visible = true
else
if radio.Stopped.Value == false then
gui.Play.Visible = false
gui.Pause.Visible = true
end
end
end
function Autoplay()
if radio.Autoplay.Value == true then
gui.AutoplayOff.Visible = false
gui.AutoplayOn.Visible = true
else
gui.AutoplayOn.Visible = false
gui.AutoplayOff.Visible = true
end
end
radio.Stopped.Changed:connect(Stopped)
radio.Paused.Changed:connect(Paused)
radio.Autoplay.Changed:connect(Autoplay)
Stopped()
Paused()
Autoplay()
while wait(.5) do
if seat:FindFirstChild("SeatWeld") == nil then
script.Parent:Destroy()
end
end
|
--Evento del ProximityPrompt
|
Proximity.Triggered:Connect(function(Players)
if open == false then
open = true
OpenSound:Play()
Proximity.ActionText = "Close"
for i = 1, 20 do
Proximity.MaxActivationDistance = 0
script.Parent.Parent:SetPrimaryPartCFrame(PrimaryPart.CFrame*CFrame.Angles(0, math.rad(5), 0))
wait()
Proximity.MaxActivationDistance = 10
end
else
open = false
CloseSound:Play()
Proximity.ActionText = "Open"
for i = 1, 20 do
Proximity.MaxActivationDistance = 0
script.Parent.Parent:SetPrimaryPartCFrame(PrimaryPart.CFrame*CFrame.Angles(0, math.rad(-5), 0))
wait()
Proximity.MaxActivationDistance = 10
end
end
end)
|
--Plot Current Horsepower
|
function GetCurve(x,gear)
local hp=math.max((FGC(x)*_Tune.Horsepower)/PeakFGC,0)
return hp,hp*(_Tune.EqPoint/x)*_Tune.Ratios[gear+2]*fFD*hpScaling
end
|
--[=[
@private
@class ScriptInfoUtils
]=]
|
local CollectionService = game:GetService("CollectionService")
local loader = script.Parent
local Utils = require(script.Parent.Utils)
local BounceTemplateUtils = require(script.Parent.BounceTemplateUtils)
local ScriptInfoUtils = {}
ScriptInfoUtils.DEPENDENCY_FOLDER_NAME = "node_modules";
ScriptInfoUtils.ModuleReplicationTypes = Utils.readonly({
CLIENT = "client";
SERVER = "server";
SHARED = "shared";
IGNORE = "ignore";
})
function ScriptInfoUtils.createScriptInfo(instance, name, replicationMode)
assert(typeof(instance) == "Instance", "Bad instance")
assert(type(name) == "string", "Bad name")
assert(type(replicationMode) == "string", "Bad replicationMode")
return Utils.readonly({
name = name;
replicationMode = replicationMode;
instance = instance;
})
end
function ScriptInfoUtils.createScriptInfoLookup()
-- Server/client also contain shared entries
return Utils.readonly({
[ScriptInfoUtils.ModuleReplicationTypes.SERVER] = {}; -- [string name] = scriptInfo
[ScriptInfoUtils.ModuleReplicationTypes.CLIENT] = {};
[ScriptInfoUtils.ModuleReplicationTypes.SHARED] = {};
})
end
function ScriptInfoUtils.getScriptInfoLookupForMode(scriptInfoLookup, replicationMode)
assert(type(scriptInfoLookup) == "table", "Bad scriptInfoLookup")
assert(type(replicationMode) == "string", "Bad replicationMode")
return scriptInfoLookup[replicationMode]
end
function ScriptInfoUtils.populateScriptInfoLookup(instance, scriptInfoLookup, lastReplicationMode)
assert(typeof(instance) == "Instance", "Bad instance")
assert(type(scriptInfoLookup) == "table", "Bad scriptInfoLookup")
assert(type(lastReplicationMode) == "string", "Bad lastReplicationMode")
if instance:IsA("Folder") then
local replicationMode = ScriptInfoUtils.getFolderReplicationMode(instance.Name, lastReplicationMode)
if replicationMode ~= ScriptInfoUtils.ModuleReplicationTypes.IGNORE then
for _, item in pairs(instance:GetChildren()) do
if not BounceTemplateUtils.isBounceTemplate(item) then
if item:IsA("Folder") then
ScriptInfoUtils.populateScriptInfoLookup(item, scriptInfoLookup, replicationMode)
elseif item:IsA("ModuleScript") then
ScriptInfoUtils.addToInfoMap(scriptInfoLookup,
ScriptInfoUtils.createScriptInfo(item, item.Name, replicationMode))
end
end
end
end
elseif instance:IsA("ModuleScript") then
if not BounceTemplateUtils.isBounceTemplate(instance) then
if instance == loader then
-- STRICT hack to support this module script as "loader" over "Nevermore" in replicated scenario
ScriptInfoUtils.addToInfoMap(scriptInfoLookup,
ScriptInfoUtils.createScriptInfo(instance, "loader", lastReplicationMode))
else
ScriptInfoUtils.addToInfoMap(scriptInfoLookup,
ScriptInfoUtils.createScriptInfo(instance, instance.Name, lastReplicationMode))
end
end
elseif instance:IsA("ObjectValue") then
error("ObjectValue links are not supported at this time for retrieving inline module scripts")
end
end
local AVAILABLE_IN_SHARED = {
["HoldingBindersServer"] = true;
["HoldingBindersClient"] = true;
["IKService"] = true;
["IKServiceClient"] = true;
}
function ScriptInfoUtils.isAvailableInShared(scriptInfo)
if CollectionService:HasTag(scriptInfo.instance, "LinkToShared") then
return true
end
-- Hack because we can't tag things in Rojo yet
return AVAILABLE_IN_SHARED[scriptInfo.name]
end
function ScriptInfoUtils.addToInfoMap(scriptInfoLookup, scriptInfo)
assert(type(scriptInfoLookup) == "table", "Bad scriptInfoLookup")
assert(type(scriptInfo) == "table", "Bad scriptInfo")
local replicationMode = assert(scriptInfo.replicationMode, "Bad replicationMode")
local replicationMap = assert(scriptInfoLookup[replicationMode], "Bad replicationMode")
ScriptInfoUtils.addToInfoMapForMode(replicationMap, scriptInfo)
if replicationMode == ScriptInfoUtils.ModuleReplicationTypes.SHARED then
ScriptInfoUtils.addToInfoMapForMode(
scriptInfoLookup[ScriptInfoUtils.ModuleReplicationTypes.SERVER], scriptInfo)
ScriptInfoUtils.addToInfoMapForMode(
scriptInfoLookup[ScriptInfoUtils.ModuleReplicationTypes.CLIENT], scriptInfo)
elseif ScriptInfoUtils.isAvailableInShared(scriptInfo) then
ScriptInfoUtils.addToInfoMapForMode(
scriptInfoLookup[ScriptInfoUtils.ModuleReplicationTypes.SHARED], scriptInfo)
end
end
function ScriptInfoUtils.addToInfoMapForMode(replicationMap, scriptInfo)
if replicationMap[scriptInfo.name] then
warn(("Duplicate module %q in same package under same replication scope. Only using first one. \n- %q\n- %q")
:format(scriptInfo.name,
scriptInfo.instance:GetFullName(),
replicationMap[scriptInfo.name]:GetFullName()))
return
end
replicationMap[scriptInfo.name] = scriptInfo
end
function ScriptInfoUtils.getFolderReplicationMode(folderName, lastReplicationMode)
assert(type(folderName) == "string", "Bad folderName")
assert(type(lastReplicationMode) == "string", "Bad lastReplicationMode")
if folderName == "Shared" then
return ScriptInfoUtils.ModuleReplicationTypes.SHARED
elseif folderName == "Client" then
return ScriptInfoUtils.ModuleReplicationTypes.CLIENT
elseif folderName == "Server" then
return ScriptInfoUtils.ModuleReplicationTypes.SERVER
elseif folderName == ScriptInfoUtils.DEPENDENCY_FOLDER_NAME then
return ScriptInfoUtils.ModuleReplicationTypes.IGNORE
else
return lastReplicationMode
end
end
return ScriptInfoUtils
|
-- float rd_flt_le(string src, int s)
-- @src - Source binary string
-- @s - Start index of little endian float
|
local function rd_flt_le(src, s) return rd_flt_basic(src:byte(s, s + 3)) end
|
--[[
Main RenderStep Update. The camera controller and occlusion module both have opportunities
to set and modify (respectively) the CFrame and Focus before it is set once on CurrentCamera.
The camera and occlusion modules should only return CFrames, not set the CFrame property of
CurrentCamera directly.
--]]
|
function CameraModule:Update(dt)
if self.activeCameraController then
local newCameraCFrame, newCameraFocus = self.activeCameraController:Update(dt)
self.activeCameraController:ApplyVRTransform()
if self.activeOcclusionModule then
newCameraCFrame, newCameraFocus = self.activeOcclusionModule:Update(dt, newCameraCFrame, newCameraFocus)
end
-- Here is where the new CFrame and Focus are set for this render frame
game.Workspace.CurrentCamera.CFrame = newCameraCFrame
game.Workspace.CurrentCamera.Focus = newCameraFocus
-- Update to character local transparency as needed based on camera-to-subject distance
if self.activeTransparencyController then
self.activeTransparencyController:Update()
end
end
end
|
--health.Changed:connect(function()
--root.Velocity = Vector3.new(0,5000,0)
--end)
|
local anims = {}
local lastAttack= tick()
local target,targetType
local lastLock = tick()
local fleshDamage = 30
local structureDamage = 25
local path = nil
for _,animObject in next,animations do
anims[animObject.Name] = hum:LoadAnimation(animObject)
end
function Attack(thing,dmg)
if tick()-lastAttack > 2 then
hum:MoveTo(root.Position)
lastAttack = tick()
anims.AntWalk:Stop()
anims.AntMelee:Play()
if thing.ClassName == "Player" then
root.FleshHit:Play()
ant:SetPrimaryPartCFrame(CFrame.new(root.Position,Vector3.new(target.Character.PrimaryPart.Position.X,root.Position.Y,target.Character.PrimaryPart.Position.Z)))
elseif thing.ClassName == "Model" then
root.StructureHit:Play()
end
rep.Events.NPCAttack:Fire(thing,dmg)
end
end
function Move(point)
hum:MoveTo(point)
if not anims.AntWalk.IsPlaying then
anims.AntWalk:Play()
end
end
function ScanForPoint()
local newPoint
local rayDir = Vector3.new(math.random(-100,100)/100,0,math.random(-100,100)/100)
local ray = Ray.new(root.Position,rayDir*math.random(10,50),ant)
local part,pos = workspace:FindPartOnRay(ray)
Move(pos)
enRoute = true
end
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local mouse = game.Players.LocalPlayer:GetMouse()
local car = script.Parent.Car.Value
local horn = car.DriveSeat:WaitForChild("Horn")
local FE = workspace.FilteringEnabled
local handler = car:WaitForChild("Horn_FE")
mouse.KeyDown:connect(function(key)
if key=="h" then
if FE then
handler:FireServer()
else
horn:Play()
end
end
end)
game:GetService("UserInputService").InputBegan:connect(function(input,IsRobloxFunction)
if input.KeyCode ==Enum.KeyCode.ButtonL3 and input.UserInputState == Enum.UserInputState.Begin then
if FE then
handler:FireServer()
else
horn:Play()
end
end
end)
|
--functions--
|
function coverdown()
covergui.TextLabel:TweenPosition(UDim2.new(0, 0, 1.36, 0), "Out", "Sine", 1, true)
end
function coverup()
covergui.TextLabel:TweenPosition(UDim2.new(0, 0, 0, 0), "Out", "Sine", 1, true)
end
function menuappear()
for _,v in pairs(maingui:GetChildren()) do
if v:IsA("TextButton") then
v.Visible = true
end
end
end
function menudisappear()
for _,v in pairs(maingui:GetChildren()) do
if v:IsA("TextButton") then
v.Visible = false
end
end
end
function disappearall()
for _,v in pairs(maingui:GetChildren()) do
if v:IsA("Frame") then
for _,a in pairs(v:GetChildren()) do
if a:IsA("TextButton") then
a.Visible = false
end
end
end
end
end
|
-- / Functions / --
|
EventModule.ActivateEvent = function()
local RandomPlayer = PlayingTeam:GetPlayers()[math.random(1, #PlayingTeam:GetPlayers())]
if RandomPlayer then
BadgeService:AwardBadge(RandomPlayer.UserId, Badges:FindFirstChild(script.Name).Value)
local Backpack = RandomPlayer:WaitForChild("Backpack")
if Backpack then
local Deagle = Tools:WaitForChild("Deagle"):Clone()
Deagle.Parent = Backpack
end
end
end
|
----------------------------------
------------VARIABLES-------------
----------------------------------
|
User = nil
Connector = game.Workspace:FindFirstChild("GlobalPianoConnector")
if not Connector or not Connector:IsA("RemoteEvent") then
error("The piano requires a RemoteEvent named GlobalPianoConnector to be in Workspace.")
end
local Materials = {
"Plastic",
"Brick",
"Cobblestone",
"Concrete",
"Glass",
"Ice",
"Neon",
"SmoothPlastic",
"Wood",
}
|
--[=[
A type that can be loaded into a module
@type ModuleReference ModuleScript | number | string
@within Loader
]=]
| |
--> Services
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
|
-- initialize to idle
|
playAnimation("idle", 0.1, Humanoid)
pose = "Standing"
while wait(0) do
local _,time=wait(0)
move(time)
end
|
-- Listen for player character spawns
|
game:GetService("Players").PlayerAdded:Connect(function(player)
-- Get the player's humanoid
local humanoid = player.Character:WaitForChild("Humanoid")
-- Define a variable to store the current walk speed
local currentSpeed = humanoid.WalkSpeed
-- Increase the player's walk speed every second
while true do
wait(1)
currentSpeed = currentSpeed + ACCELERATION
if currentSpeed > MAX_WALK_SPEED then
currentSpeed = MAX_WALK_SPEED
end
humanoid.WalkSpeed = currentSpeed
end
end)
print("Hello world!")
|
--[=[
Cleans up all objects in the trove. This is
similar to calling `Remove` on each object
within the trove. The ordering of the objects
removed is _not_ guaranteed.
]=]
|
function Trove:Clean()
if self._cleaning then
return
end
self._cleaning = true
for _, obj in self._objects do
self:_cleanupObject(obj[1], obj[2])
end
table.clear(self._objects)
self._cleaning = false
end
function Trove:_findAndRemoveFromObjects(object: any, cleanup: boolean): boolean
local objects = self._objects
for i, obj in ipairs(objects) do
if obj[1] == object then
local n = #objects
objects[i] = objects[n]
objects[n] = nil
if cleanup then
self:_cleanupObject(obj[1], obj[2])
end
return true
end
end
return false
end
function Trove:_cleanupObject(object, cleanupMethod)
if cleanupMethod == FN_MARKER then
object()
elseif cleanupMethod == THREAD_MARKER then
coroutine.close(object)
else
object[cleanupMethod](object)
end
end
|
--[[ Display Names ]]
--Uses DisplayNames instead of UserNames in chat messages
|
module.PlayerDisplayNamesEnabled = false
|
-- int rd_int_basic(string src, int s, int e, int d)
-- @src - Source binary string
-- @s - Start index of a little endian integer
-- @e - End index of the integer
-- @d - Direction of the loop
|
local function rd_int_basic(src, s, e, d)
local num = 0
-- if bb[l] > 127 then -- signed negative
-- num = num - 256 ^ l
-- bb[l] = bb[l] - 128
-- end
for i = s, e, d do
local mul = 256 ^ math.abs(i - s)
num = num + mul * string.byte(src, i, i)
end
return num
end
|
--
--All Welding Related Utility functions should be put here
--
|
WeldUtil = {}
do
function WeldUtil.WeldBetween(a, b)
local weld = Instance.new("Weld")
weld.Part0 = a
weld.Part1 = b
weld.C0 = CFrame.new()
weld.C1 = b.CFrame:inverse() * a.CFrame
weld.Parent = a
return weld
end
function WeldUtil:PermaWeld(weld)
local OriginalParent = weld.Parent
weld.Changed:connect(function()
Delay(0,function() weld.Parent = OriginalParent end)
end)
end
end
local InternalEvent =
{
Listeners = nil,
}
do
UTIL.MakeClass(InternalEvent)
function InternalEvent:Connect(func)
if not self.Listeners then self.Listeners = {} end
table.insert(self.Listeners,func)
end
function InternalEvent:Fire(...)
if not self.Listeners then return end
local args = {...}
for _,i in ipairs(self.Listeners) do
Spawn(function() i(unpack(args)) end)
end
end
end
|
--Made by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
RunService = game:GetService("RunService")
Camera = game:GetService("Workspace").CurrentCamera
Animations = {}
LocalObjects = {}
ServerControl = Tool:WaitForChild("ServerControl")
ClientControl = Tool:WaitForChild("ClientControl")
ToolEquipped = false
function SetAnimation(Mode, Value)
if Mode == "PlayAnimation" and Value and ToolEquipped and Humanoid then
for i, v in pairs(Animations) do
if v.Animation == Value.Animation then
v.AnimationTrack:Stop()
table.remove(Animations, i)
end
end
local AnimationTrack = Humanoid:LoadAnimation(Value.Animation)
table.insert(Animations, {Animation = Value.Animation, AnimationTrack = AnimationTrack})
AnimationTrack:Play(Value.FadeTime, Value.Weight, Value.Speed)
elseif Mode == "StopAnimation" and Value then
for i, v in pairs(Animations) do
if v.Animation == Value.Animation then
v.AnimationTrack:Stop()
table.remove(Animations, i)
end
end
end
end
function CheckIfAlive()
return (((Player and Player.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0) and true) or false)
end
function Equipped(Mouse)
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
ToolEquipped = true
if not CheckIfAlive() then
return
end
PlayerMouse = Player:GetMouse()
Mouse.Button1Down:connect(function()
InvokeServer("MouseClick", {Down = true})
end)
Mouse.Button1Up:connect(function()
InvokeServer("MouseClick", {Down = false})
end)
Mouse.KeyDown:connect(function(Key)
InvokeServer("KeyPress", {Key = Key, Down = true})
end)
Mouse.KeyUp:connect(function(Key)
InvokeServer("KeyPress", {Key = Key, Down = false})
end)
end
function Unequipped()
ToolEquipped = false
LocalObjects = {}
for i, v in pairs(Animations) do
if v and v.AnimationTrack then
v.AnimationTrack:Stop()
end
end
for i, v in pairs({ObjectLocalTransparencyModifier}) do
if v then
v:disconnect()
end
end
Animations = {}
end
function InvokeServer(Mode, Value)
pcall(function()
local ServerReturn = ServerControl:InvokeServer(Mode, Value)
return ServerReturn
end)
end
function OnClientInvoke(Mode, Value)
if Mode == "PlayAnimation" and Value and ToolEquipped and Humanoid then
SetAnimation("PlayAnimation", Value)
elseif Mode == "StopAnimation" and Value then
SetAnimation("StopAnimation", Value)
elseif Mode == "PlaySound" and Value then
Value:Play()
elseif Mode == "StopSound" and Value then
Value:Stop()
elseif Mode == "MousePosition" then
return PlayerMouse.Hit.p
elseif Mode == "SetLocalTransparencyModifier" and Value and ToolEquipped then
pcall(function()
local ObjectFound = false
for i, v in pairs(LocalObjects) do
if v == Value then
ObjectFound = true
end
end
if not ObjectFound then
table.insert(LocalObjects, Value)
if ObjectLocalTransparencyModifier then
ObjectLocalTransparencyModifier:disconnect()
end
ObjectLocalTransparencyModifier = RunService.RenderStepped:connect(function()
for i, v in pairs(LocalObjects) do
if v.Object and v.Object.Parent then
if ((not v.AutoUpdate and (v.Object.LocalTransparencyModifier == 1 or v.Object.LocalTransparencyModifier == 0)) or v.AutoUpdate) then
v.Object.LocalTransparencyModifier = v.Transparency
end
else
table.remove(LocalObjects, i)
end
end
end)
end
end)
end
end
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
ClientControl.OnClientInvoke = OnClientInvoke
|
-- Returns whether a node would be present in the tree list
|
local function nodeIsVisible(node)
local visible = true
node = node.Parent
while node and visible do
visible = visible and node.Expanded
node = node.Parent
end
return visible
end
|
-- << COMMANDS >>
|
local module = {
-----------------------------------
{
Name = "loadmap";
Aliases = {};
Prefixes = {settings.Prefix};
Rank = 1;
RankLock = false;
Loopable = false;
Tags = {};
Description = "";
Contributors = {};
--
Args = {};
Function = function(speaker, args)
end;
UnFunction = function(speaker, args)
end;
--
};
-----------------------------------
{
Name = "";
Aliases = {};
Prefixes = {settings.Prefix};
Rank = 1;
RankLock = false;
Loopable = false;
Tags = {};
Description = "";
Contributors = {};
--
Args = {};
--[[
ClientCommand = true;
FireAllClients = true;
BlockWhenPunished = true;
PreFunction = function(speaker, args)
end;
Function = function(speaker, args)
wait(1)
end;
--]]
--
};
-----------------------------------
};
return module
|
-- Decompiled with the Synapse X Luau decompiler.
|
client = nil;
cPcall = nil;
Pcall = nil;
Routine = nil;
service = nil;
gTable = nil;
return function(p1)
local l__Parent__1 = script.Parent.Parent;
local l__PlayerGui__2 = service.PlayerGui;
if p1.Time then
end;
local v3 = client.UI.Get("HintHolder", nil, true);
if not v3 then
local v4 = service.New("ScreenGui");
local v5 = client.UI.Register(v4);
local v6 = service.New("ScrollingFrame", v4);
client.UI.Prepare(v4);
v5.Name = "HintHolder";
v6.Name = "Frame";
v6.BackgroundTransparency = 1;
v6.Size = UDim2.new(1, 0, 0, 150);
v6.CanvasSize = UDim2.new(0, 0, 0, 0);
v6.ChildAdded:Connect(function(p2)
if #v6:GetChildren() == 0 then
v6.Visible = false;
return;
end;
v6.Visible = true;
end);
v6.ChildRemoved:Connect(function(p3)
if #v6:GetChildren() == 0 then
v6.Visible = false;
return;
end;
v6.Visible = true;
end);
v3 = v5;
v5:Ready();
end;
local l__Frame__7 = v3.Object.Frame;
if client.UI.Get("Notif") then
local v8 = 30;
else
v8 = 0;
end;
if client.UI.Get("TopBar") then
local v9 = 40;
else
v9 = 0;
end;
l__Frame__7.Position = UDim2.new(0, 0, 0, v8 + v9 - 35);
local v10 = l__Frame__7:children();
l__Parent__1.Position = UDim2.new(0, 0, 0, -100);
l__Parent__1.Frame.msg.Text = p1.Message;
local l__X__11 = l__Parent__1.Frame.msg.TextBounds.X;
spawn(function()
local v12 = Instance.new("Sound", service.LocalContainer());
v12.SoundId = "rbxassetid://489390072";
wait(0.1);
v12:Play();
wait(0.8);
v12:Destroy();
end);
local function v13(p4, p5)
p4 = p4 and 0;
local v14 = #l__Frame__7:children();
for v15, v16 in pairs(l__Frame__7:children()) do
if v16 ~= p5 then
v16.Position = UDim2.new(0, 0, 0, (v15 + p4) * 28);
if v15 ~= v14 then
v16.Size = UDim2.new(1, 0, 0, 28);
end;
end;
end;
end;
local v17 = -1;
v13(-1);
l__Parent__1.Parent = l__Frame__7;
if #l__Frame__7:children() > 5 then
v17 = -2;
end;
UDim2.new(0, 0, 0, (#l__Frame__7:children() + v17) * 28);
v13(-1);
if #l__Frame__7:children() > 5 then
local v18 = l__Frame__7:children()[1];
v13(-2, v18);
v18:Destroy();
end;
wait(p1.Time and 5);
if l__Parent__1 and l__Parent__1.Parent then
v13(-2, l__Parent__1);
l__Parent__1:Destroy();
end;
end;
|
-- Multiplier determines how much players need to move before a level; 1 = small amount of movement, 3 much more movement
|
local growthModifier = 1.2
|
-- Returns the part's topmost Model ancestor
|
local function getModel(part)
return part:FindFirstAncestorOfClass("Model")
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
local l__LocalPlayer__1 = game.Players.LocalPlayer;
local v2 = {};
local l__LocalPlayer__3 = game.Players.LocalPlayer;
local v4 = require(game:GetService("ReplicatedStorage"):WaitForChild("ReplicaDataModule"));
v2.value = 0;
v2.event = v4.event.Knobs;
v4.event.Knobs.Event:connect(function(p1)
if type(p1) == "number" then
v2.value = p1;
return;
end;
v2.value = 0;
end);
v2.value = v4.data.Knobs;
return v2;
|
--// F key, Horn
|
mouse.KeyDown:connect(function(key)
if key=="f" then
veh.Lightbar.middle.Airhorn:Play()
veh.Lightbar.middle.Wail.Volume = 0
veh.Lightbar.middle.Yelp.Volume = 0
veh.Lightbar.middle.Priority.Volume = 0
end
end)
|
-- For all easing functions:
-- t = elapsed time
-- b = begin
-- c = change == ending - beginning
-- d = duration (total time)
|
local pow = math.pow
local sin = math.sin
local cos = math.cos
local pi = math.pi
local sqrt = math.sqrt
local abs = math.abs
local asin = math.asin
local function linear(t, b, c, d)
return c * t / d + b
end
local function inQuad(t, b, c, d)
t = t / d
return c * pow(t, 2) + b
end
local function outQuad(t, b, c, d)
t = t / d
return -c * t * (t - 2) + b
end
local function inOutQuad(t, b, c, d)
t = t / d * 2
if t < 1 then
return c / 2 * pow(t, 2) + b
else
return -c / 2 * ((t - 1) * (t - 3) - 1) + b
end
end
local function outInQuad(t, b, c, d)
if t < d / 2 then
return outQuad (t * 2, b, c / 2, d)
else
return inQuad((t * 2) - d, b + c / 2, c / 2, d)
end
end
local function inCubic (t, b, c, d)
t = t / d
return c * pow(t, 3) + b
end
local function outCubic(t, b, c, d)
t = t / d - 1
return c * (pow(t, 3) + 1) + b
end
local function inOutCubic(t, b, c, d)
t = t / d * 2
if t < 1 then
return c / 2 * t * t * t + b
else
t = t - 2
return c / 2 * (t * t * t + 2) + b
end
end
local function outInCubic(t, b, c, d)
if t < d / 2 then
return outCubic(t * 2, b, c / 2, d)
else
return inCubic((t * 2) - d, b + c / 2, c / 2, d)
end
end
local function inQuart(t, b, c, d)
t = t / d
return c * pow(t, 4) + b
end
local function outQuart(t, b, c, d)
t = t / d - 1
return -c * (pow(t, 4) - 1) + b
end
local function inOutQuart(t, b, c, d)
t = t / d * 2
if t < 1 then
return c / 2 * pow(t, 4) + b
else
t = t - 2
return -c / 2 * (pow(t, 4) - 2) + b
end
end
local function outInQuart(t, b, c, d)
if t < d / 2 then
return outQuart(t * 2, b, c / 2, d)
else
return inQuart((t * 2) - d, b + c / 2, c / 2, d)
end
end
local function inQuint(t, b, c, d)
t = t / d
return c * pow(t, 5) + b
end
local function outQuint(t, b, c, d)
t = t / d - 1
return c * (pow(t, 5) + 1) + b
end
local function inOutQuint(t, b, c, d)
t = t / d * 2
if t < 1 then
return c / 2 * pow(t, 5) + b
else
t = t - 2
return c / 2 * (pow(t, 5) + 2) + b
end
end
local function outInQuint(t, b, c, d)
if t < d / 2 then
return outQuint(t * 2, b, c / 2, d)
else
return inQuint((t * 2) - d, b + c / 2, c / 2, d)
end
end
local function inSine(t, b, c, d)
return -c * cos(t / d * (pi / 2)) + c + b
end
local function outSine(t, b, c, d)
return c * sin(t / d * (pi / 2)) + b
end
local function inOutSine(t, b, c, d)
return -c / 2 * (cos(pi * t / d) - 1) + b
end
local function outInSine(t, b, c, d)
if t < d / 2 then
return outSine(t * 2, b, c / 2, d)
else
return inSine((t * 2) -d, b + c / 2, c / 2, d)
end
end
local function inExpo(t, b, c, d)
if t == 0 then
return b
else
return c * pow(2, 10 * (t / d - 1)) + b - c * 0.001
end
end
local function outExpo(t, b, c, d)
if t == d then
return b + c
else
return c * 1.001 * (-pow(2, -10 * t / d) + 1) + b
end
end
local function inOutExpo(t, b, c, d)
if t == 0 then return b end
if t == d then return b + c end
t = t / d * 2
if t < 1 then
return c / 2 * pow(2, 10 * (t - 1)) + b - c * 0.0005
else
t = t - 1
return c / 2 * 1.0005 * (-pow(2, -10 * t) + 2) + b
end
end
local function outInExpo(t, b, c, d)
if t < d / 2 then
return outExpo(t * 2, b, c / 2, d)
else
return inExpo((t * 2) - d, b + c / 2, c / 2, d)
end
end
local function inCirc(t, b, c, d)
t = t / d
return(-c * (sqrt(1 - pow(t, 2)) - 1) + b)
end
local function outCirc(t, b, c, d)
t = t / d - 1
return(c * sqrt(1 - pow(t, 2)) + b)
end
local function inOutCirc(t, b, c, d)
t = t / d * 2
if t < 1 then
return -c / 2 * (sqrt(1 - t * t) - 1) + b
else
t = t - 2
return c / 2 * (sqrt(1 - t * t) + 1) + b
end
end
local function outInCirc(t, b, c, d)
if t < d / 2 then
return outCirc(t * 2, b, c / 2, d)
else
return inCirc((t * 2) - d, b + c / 2, c / 2, d)
end
end
local function inElastic(t, b, c, d, a, p)
if t == 0 then return b end
t = t / d
if t == 1 then return b + c end
if not p then p = d * 0.3 end
local s
if not a or a < abs(c) then
a = c
s = p / 4
else
s = p / (2 * pi) * asin(c/a)
end
t = t - 1
return -(a * pow(2, 10 * t) * sin((t * d - s) * (2 * pi) / p)) + b
end
|
---Changing lights
|
while wait(LightsSpeed) do
Car.Chassis2.L1.Color = Color3.fromRGB(13, 105, 172)
Car.Chassis2.L2.Color = Color3.fromRGB(255, 89, 89)
wait(LightsSpeed)
Car.Chassis2.L2.Color = Color3.fromRGB(13, 105, 172)
Car.Chassis2.L1.Color = Color3.fromRGB(255, 89, 89)
end
|
-- Remove the fly when it flew too far from the center.
|
local Fly = script.Parent
local Model = script.Parent.Parent
local Range = Model.Configuration.FlyRange
while true do
wait(5)
if (Fly.Position - Model.Center.CenterPart.Position).magnitude > Range.Value then
Fly.GlowScript.Disabled = true
Fly.MoveScript.Disabled = true
Fly:destroy()
break
end
end
|
--[[**
<description>
Saves the data to the data store. Called when a player leaves.
</description>
**--]]
|
function DataStore:Save()
local success, result = self:SaveAsync():await()
if success then
--print("saved", self.Name)
return true
else
error(result)
end
end
|
--[[INSTALL PROCESS]]--
-- Place the brick in the body group, where your radiator would be, and place the "Temperature" GUI in the plugin folder!
-- This plugin is Filtering Enabled compatible
|
local car = script.Parent.Car.Value
local radiator = car.Body.Smoke
local mouse = game.Players.LocalPlayer:GetMouse()
local handler = car.EngineOverheat
local FE = workspace.FilteringEnabled
car.DriveSeat:WaitForChild("Celsius")
car.DriveSeat:WaitForChild("Blown")
|
--[=[
Constructs a new service.
:::caution
Services must be created _before_ calling `Knit.Start()`.
:::
```lua
-- Create a service
local MyService = Knit.CreateService {
Name = "MyService",
Client = {},
}
-- Expose a ToAllCaps remote function to the clients
function MyService.Client:ToAllCaps(player, msg)
return msg:upper()
end
-- Knit will call KnitStart after all services have been initialized
function MyService:KnitStart()
print("MyService started")
end
-- Knit will call KnitInit when Knit is first started
function MyService:KnitInit()
print("MyService initialize")
end
```
]=]
|
function KnitServer.CreateService(serviceDef: ServiceDef): Service
assert(type(serviceDef) == "table", `Service must be a table; got {type(serviceDef)}`)
assert(type(serviceDef.Name) == "string", `Service.Name must be a string; got {type(serviceDef.Name)}`)
assert(#serviceDef.Name > 0, "Service.Name must be a non-empty string")
assert(not DoesServiceExist(serviceDef.Name), `Service "{serviceDef.Name}" already exists`)
local service = serviceDef
service.KnitComm = ServerComm.new(knitRepServiceFolder, serviceDef.Name)
if type(service.Client) ~= "table" then
service.Client = { Server = service }
else
if service.Client.Server ~= service then
service.Client.Server = service
end
end
services[service.Name] = service
return service
end
|
--// Unused (Don't delete)
|
RestMode = true;
AttachmentsEnabled = true;
UIScope = false;
CanSlideLock = false;
|
-- This check exists to prevent an infinite respawning bug
|
function Respawn()
wait(RESPAWN_DELAY) -- ya
CurrentFigure:Destroy()
CurrentFigure = Figure:Clone()
CurrentFigure:MakeJoints()
CurrentFigure.Parent = Model
-- Destroy the current dummy, clone the extra, put it together, and put it inside of Model
CurrentFigure.Humanoid.Died:connect(onDied)
-- Connect the Died event on the new dummies Humanoid, it will fire the Died() function below when it dies
end
function onRemoved(Object)
if Object == CurrentFigure and CanSpawn then
Respawn()
end
-- Check if the object that was removed was the current dummy
-- and if it is able to spawn a new one, if so, spawn a new one.
end
function onDied()
if CanSpawn then
CanSpawn = false
Respawn()
CanSpawn = true
end
-- Fire Respawn() function if CanSpawn is true and
-- set CanSpawn to false while the function is running.
end
CurrentFigure.Humanoid.Died:connect(onDied)
|
-- print("Punch Swing")
|
self.animation.states["Punch"].swing()
self.collisionDetect.CFrame = Punch.character.PrimaryPart.CFrame * CFrame.new(0, 0, (-self.collisionDetect.Size.Z / 2)+1)
self.collisionDetect.Parent = Punch.character -- change this to a folder
local touchedParts = self.collisionDetect:GetTouchingParts()
self.collisionDetect.Parent = nil
local curated = {}
for _,Part in next, touchedParts do
if not(Part:IsDescendantOf(self.character) or Part == workspace.Terrain) then
curated[#curated + 1] = Part
end
end
if #curated >= 1 then
Rep.Relay.SwingTool:FireServer(curated)
end
curated = {}
end
function Punch:input(inputName,inputState,inputObject)
if inputName == "Action" then
if inputState == Enum.UserInputState.Begin then
self.holding = true
if (Rep.Constants.RelativeTime.Value - _G.SD[player.UserId].Data.tempData.lastAction) > 0.25 then
_G.SD[player.UserId].Data.tempData.lastAction = Rep.Constants.RelativeTime.Value
swing(self)
end
elseif inputState == Enum.UserInputState.End then
self.holding = false
end
end
end
function Punch:step(dt)
if self.holding then
if (Rep.Constants.RelativeTime.Value - _G.SD[player.UserId].Data.tempData.lastAction) > 0.3 then -- 0.3 to make holding slightly slower
_G.SD[player.UserId].Data.tempData.lastAction = Rep.Constants.RelativeTime.Value
swing(self)
end
end
end
return Punch
|
--Dont edit anything unless if you know what you are doing.
|
local button = script.Parent
local pageLayout = script.Parent.Parent.Parent.Parent.Pages.UIPageLayout
local function leftClick()
pageLayout:JumpTo(script.Parent.Parent.Parent.Parent.Pages.Shop)
script.Parent.Parent.Bottom.BackgroundTransparency = 0
script.Parent.Parent.Sfx:Play()
script.Parent.Parent.Parent.Home.Bottom.BackgroundTransparency = 1
script.Parent.Parent.Parent.Settings.Bottom.BackgroundTransparency = 1
script.Parent.Parent.Parent.Credits.Bottom.BackgroundTransparency = 1
end
button.MouseButton1Click:Connect(leftClick)
|
-- / ga / --
|
local ga = game.ServerStorage.GA
local modules = ga.Modules
local tools = ga.Tools
local toolModels = ga.ToolModels
|
-- find player's head pos
|
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local head = vCharacter:findFirstChild("Head")
if head == nil then return end
local dir = mouse_pos - head.Position
dir = computeDirection(dir)
local launch = head.Position + 5 * dir
local delta = mouse_pos - launch
local dy = delta.y
local new_delta = Vector3.new(delta.x, 0, delta.z)
delta = new_delta
local dx = delta.magnitude
local unit_delta = delta.unit
-- acceleration due to gravity in RBX units
local g = (-9.81 * 20)
local theta = computeLaunchAngle( dx, dy, g)
local vy = math.sin(theta)
local xz = math.cos(theta)
local vx = unit_delta.x * xz
local vz = unit_delta.z * xz
local missile = Pellet:clone()
m = Tool.Handle.Mesh:clone()
m.Parent = missile
m.Scale = Vector3.new(5,5,5)
missile.Position = launch
missile.Velocity = Vector3.new(vx,vy,vz) * VELOCITY
missile.PelletScript.Disabled = false
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = vCharacter
creator_tag.Name = "creator"
creator_tag.Parent = missile
missile.Parent = game.Workspace
end
function computeLaunchAngle(dx,dy,grav)
-- arcane
-- http://en.wikipedia.org/wiki/Trajectory_of_a_projectile
local g = math.abs(grav)
local inRoot = (VELOCITY*VELOCITY*VELOCITY*VELOCITY) - (g * ((g*dx*dx) + (2*dy*VELOCITY*VELOCITY)))
if inRoot <= 0 then
return .25 * math.pi
end
local root = math.sqrt(inRoot)
local inATan1 = ((VELOCITY*VELOCITY) + root) / (g*dx)
local inATan2 = ((VELOCITY*VELOCITY) - root) / (g*dx)
local answer1 = math.atan(inATan1)
local answer2 = math.atan(inATan2)
if answer1 < answer2 then return answer1 end
return answer2
end
function computeDirection(vec)
local lenSquared = vec.magnitude * vec.magnitude
local invSqrt = 1 / math.sqrt(lenSquared)
return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
if loaded==true then
loaded=false
local targetPos = humanoid.TargetPoint
fire(targetPos)
wait(.2)
Tool.Enabled = true
elseif loaded==false then
Tool.Parent.Torso["Right Shoulder"].MaxVelocity = 0.6
Tool.Parent.Torso["Right Shoulder"].DesiredAngle = -3.6
wait(.1)
Tool.Handle.Transparency=0
wait(.1)
loaded=true
end
Tool.Enabled = true
end
script.Parent.Activated:connect(onActivated)
|
-- Compiled with roblox-ts v2.0.4
|
local TS = _G[script]
local Div = TS.import(script, script, "elements", "Div").default
local Button = TS.import(script, script, "elements", "Button").default
local Text = TS.import(script, script, "elements", "Text").default
local Input = TS.import(script, script, "elements", "Input").default
return {
Div = Div,
Button = Button,
Text = Text,
Input = Input,
}
|
-- strictly used for ServerSceneFramework test file due to conflict when replacing Init with a magic mock
|
SeekPermissions.timesInitiated = 0
SeekPermissions.Init = function()
SeekPermissions.SetSeekPermissionsEvent.Event:Connect(SeekPermissions.SetSeekingPermissions)
SeekPermissions.Players.PlayerRemoving:Connect(function(Player)
if SeekPermissions.PlayersWithPermission[Player] then
SeekPermissions.PlayersWithPermission[Player] = nil
end
end)
SeekPermissions.Players.PlayerAdded:Connect(function(Player)
-- Not sure if we need this conditional here
if SeekPermissions.Players:FindFirstChild(Player.Name) then
SeekPermissions.CheckAndApplySeekPermissions(Player)
end
end)
SeekPermissions.timesInitiated += 1
end
return SeekPermissions
|
-- Public Methods
|
function ViewportWindow:Destroy()
self.SurfaceGUI:Destroy()
end
function ViewportWindow:AddSkybox(skybox)
if (skybox and skybox:IsA("Sky")) then
self.SkyboxFrame:ClearAllChildren()
SkyboxModel(skybox).Parent = self.SkyboxFrame
end
end
function ViewportWindow:AddWithLookup(children, cloneFunc, parent, lookup)
lookup = lookup or {}
parent = parent or self.ViewportFrame
cloneFunc = cloneFunc or defaultCloneFunc
for _, part in next, children do
if (not part:IsA("LuaSourceContainer")) then
local archivable = part.Archivable
part.Archivable = true
local clone = part:Clone()
if (clone) then
clone:ClearAllChildren()
cloneFunc(part, clone)
clone.Parent = parent
self:AddWithLookup(part:GetChildren(), cloneFunc, clone, lookup)
lookup[part] = clone
end
part.Archivable = archivable
end
end
return lookup
end
function ViewportWindow:GetPart()
return self.SurfaceGUI.Adornee
end
function ViewportWindow:GetSurfaceInfo()
local part = self.SurfaceGUI.Adornee
local partCF, partSize = part.CFrame, part.Size
local back = -Vector3.FromNormalId(self.SurfaceGUI.Face)
local axis = (math.abs(back.y) == 1) and Vector3.new(back.y, 0, 0) or UNIT_Y
local right = CFrame.fromAxisAngle(axis, PI2) * back
local top = back:Cross(right).Unit
local cf = partCF * CFrame.fromMatrix(-back*partSize/2, right, top, back)
local size = Vector3.new((partSize * right).Magnitude, (partSize * top).Magnitude, (partSize * back).Magnitude)
return cf, size
end
function ViewportWindow:RenderFrame(camCF, surfaceCF, surfaceSize)
local camera = game.Workspace.CurrentCamera
camCF = camCF or camera.CFrame
if not (surfaceCF and surfaceSize) then
surfaceCF, surfaceSize = self:GetSurfaceInfo()
end
--
local tc = surfaceCF * Vector3.new(0, surfaceSize.y/2, 0)
local bc = surfaceCF * Vector3.new(0, -surfaceSize.y/2, 0)
local cross = camCF.LookVector:Cross(surfaceCF.UpVector)
local right = cross:Dot(cross) > 0 and cross.Unit or camCF.RightVector
local levelCamCF = CFrame.fromMatrix(camCF.p, right, surfaceCF.UpVector, right:Cross(surfaceCF.UpVector))
local levelCamCFInv = levelCamCF:Inverse()
local csbc = levelCamCFInv * bc
local cstc = levelCamCFInv * tc
local v1 = (csbc*YZ).Unit
local v2 = (cstc*YZ).Unit
local alpha = math.sign(v1.y)*math.acos(v1:Dot(UNIT_NZ))
local beta = math.sign(v2.y)*math.acos(v2:Dot(UNIT_NZ))
local fh = 2*math.tan(math.rad(camera.FieldOfView)/2)
local hPrime = math.tan(beta) - math.tan(alpha)
local refHeight = hPrime / fh
--
local c2p = surfaceCF:VectorToObjectSpace(surfaceCF.p - camCF.p)
local c2pXZ = c2p * XZ
local c2pYZ = c2p * YZ
local dpX = c2pXZ.Unit:Dot(UNIT_NZ)
local camXZ = (surfaceCF:VectorToObjectSpace(camCF.LookVector) * XZ)
local scale = camXZ.Unit:Dot(c2pXZ.Unit) / UNIT_NZ:Dot(c2pXZ.Unit)
local tanArcCos = math.sqrt(1 - dpX*dpX) / dpX
--
local w, h = 1, (surfaceSize.x / surfaceSize.y)
local dx = math.sign(c2p.x*c2p.z)*tanArcCos
local dy = c2pYZ.y / c2pYZ.z * h
local d = math.abs(scale * refHeight * h)
local ncf = (surfaceCF - surfaceCF.p) * Y_SPIN * CFrame.new(0, 0, 0, w, 0, 0, 0, h, 0, dx, dy, d)
local c = {ncf:GetComponents()}
local max = {}
for i = 1, #c do max[i] = math.abs(c[i]) end
max = math.max(unpack(max))
ncf = CFrame.new(c[1], c[2], c[3], c[4]/max, c[5]/max, c[6]/max, c[7]/max, c[8]/max, c[9]/max, c[10]/max, c[11]/max, c[12]/max)
--
--[[
-- can set w and h to 1 and use this as an alternative scaling method, but I find the above is better
local ratioXY = (surfaceSize.x / surfaceSize.y)
local ratioYX = (surfaceSize.y / surfaceSize.x)
if (ratioXY > ratioYX) then
self.SurfaceGUI.CanvasSize = Vector2.new(1024, 1024 * ratioYX)
else
self.SurfaceGUI.CanvasSize = Vector2.new(1024 * ratioXY, 1024)
end
--]]
local ncamCF = ncf + camCF.p
self.Camera.FieldOfView = camera.FieldOfView
self.Camera.CFrame = ncamCF
self.Camera.Focus = ncamCF * CFrame.new(0, 0, camCF:PointToObjectSpace(surfaceCF.p).z)
end
|
--[=[
Extends the value onto the emitted brio
@since 3.6.0
@param ... T
@return (source: Observable<Brio<U>>) -> Observable<Brio<U | T>>
]=]
|
function RxBrioUtils.extend(...)
local args = table.pack(...)
return Rx.map(function(brio)
assert(Brio.isBrio(brio), "Bad brio")
return BrioUtils.extend(brio, table.unpack(args, 1, args.n))
end)
end
|
--[=[
Set a handler that will be called only if the Promise resolves or is cancelled. This method is similar to `finally`, except it doesn't catch rejections.
:::caution
`done` should be reserved specifically when you want to perform some operation after the Promise is finished (like `finally`), but you don't want to consume rejections (like in <a href="/roblox-lua-promise/lib/Examples.html#cancellable-animation-sequence">this example</a>). You should use `andThen` instead if you only care about the Resolved case.
:::
:::warning
Like `finally`, if the Promise is cancelled, any Promises chained off of it with `andThen` won't run. Only Promises chained with `done` and `finally` will run in the case of cancellation.
:::
Returns a new promise chained from this promise.
@param doneHandler (status: Status) -> ...any
@return Promise<...any>
]=]
|
function Promise.prototype:done(finallyHandler)
assert(
finallyHandler == nil or type(finallyHandler) == "function",
string.format(ERROR_NON_FUNCTION, "Promise:done")
)
return self:_finally(debug.traceback(nil, 2), finallyHandler, true)
end
|
-- Script thanks to the roblox wiki :D
|
local PhysicsService = game:GetService("PhysicsService")
local Players = game:GetService("Players")
local playerCollisionGroupName = "Players"
PhysicsService:CreateCollisionGroup(playerCollisionGroupName)
PhysicsService:CollisionGroupSetCollidable(playerCollisionGroupName, playerCollisionGroupName, false)
local previousCollisionGroups = {}
local function setCollisionGroup(object)
if object:IsA("BasePart") then
previousCollisionGroups[object] = object.CollisionGroupId
PhysicsService:SetPartCollisionGroup(object, playerCollisionGroupName)
end
end
local function setCollisionGroupRecursive(object)
setCollisionGroup(object)
for _, child in ipairs(object:GetChildren()) do
setCollisionGroupRecursive(child)
end
end
local function resetCollisionGroup(object)
local previousCollisionGroupId = previousCollisionGroups[object]
if not previousCollisionGroupId then return end
local previousCollisionGroupName = PhysicsService:GetCollisionGroupName(previousCollisionGroupId)
if not previousCollisionGroupName then return end
PhysicsService:SetPartCollisionGroup(object, previousCollisionGroupName)
previousCollisionGroups[object] = nil
end
local function onCharacterAdded(character)
setCollisionGroupRecursive(character)
character.DescendantAdded:Connect(setCollisionGroup)
character.DescendantRemoving:Connect(resetCollisionGroup)
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterAdded)
end
Players.PlayerAdded:Connect(onPlayerAdded)
|
-- If config.CreateOutlinesAutomatically == true, then this will start outlining players
| |
--[[Run]]
|
--Print Version
local ver=require(car["A-Chassis Tune"].README)
print("//INSPARE: AC6 Loaded - Build "..ver)
--Runtime Loops
-- ~60 c/s
game["Run Service"].Stepped:connect(function()
--Steering
Steering()
--RPM
RPM()
--Update External Values
_IsOn = script.Parent.IsOn.Value
_InControls = script.Parent.ControlsOpen.Value
script.Parent.Values.Gear.Value = _CGear
script.Parent.Values.RPM.Value = _RPM
script.Parent.Values.Horsepower.Value = _HP
script.Parent.Values.Torque.Value = _HP * _Tune.EqPoint / _RPM
script.Parent.Values.TransmissionMode.Value = _TMode
script.Parent.Values.Throttle.Value = _GThrot
script.Parent.Values.Brake.Value = _GBrake
script.Parent.Values.SteerC.Value = _GSteerC*(1-math.min(car.DriveSeat.Velocity.Magnitude/_Tune.SteerDecay,1-(_Tune.MinSteer/100)))
script.Parent.Values.SteerT.Value = _GSteerT
script.Parent.Values.PBrake.Value = _PBrake
script.Parent.Values.TCS.Value = _TCS
script.Parent.Values.TCSActive.Value = _TCSActive
script.Parent.Values.ABS.Value = _ABS
script.Parent.Values.ABSActive.Value = _ABSActive
script.Parent.Values.MouseSteerOn.Value = _MSteer
script.Parent.Values.Velocity.Value = car.DriveSeat.Velocity
end)
-- ~15 c/s
while wait(.0667) do
--Power
Engine()
--Flip
if _Tune.AutoFlip then Flip() end
end
|
-- We need to add 2 to these values as a workaround to a documented engine bug
|
local TextService = game:GetService("TextService")
local function getTextHeight(text, fontSize, font, widthCap)
return TextService:GetTextSize(text, fontSize, font, Vector2.new(widthCap, 10000)).Y + 2
end
local function getTextWidth(text, fontSize, font)
return TextService:GetTextSize(text, fontSize, font, Vector2.new(10000, 10000)).X + 2
end
local FitTextLabel = Roact.PureComponent:extend("FitTextLabel")
FitTextLabel.Width = {
FitToText = {},
}
FitTextLabel.defaultProps = {
Font = Enum.Font.SourceSans,
Text = "Label",
TextSize = 12,
TextWrapped = true,
maximumWidth = math.huge,
}
function FitTextLabel:init()
self.frameRef = Roact.createRef()
self.onResize = function()
if not self.frameRef.current then
return
end
self.frameRef.current.Size = self:__getSize(self.frameRef.current)
end
end
function FitTextLabel:render()
return Roact.createElement("TextLabel", self:__getFilteredProps())
end
function FitTextLabel:didMount()
self.onResize()
end
function FitTextLabel:didUpdate()
self.onResize()
end
function FitTextLabel:__getFilteredProps()
-- Will return a new prop map after removing
-- Roact.Children and any defaultProps in an effort
-- to only return safe Roblox Instance "TextLabel"
-- properties that may be present.
local filteredProps = {
width = Cryo.None,
maximumWidth = Cryo.None,
Size = UDim2.new(self.props.width, UDim.new(0, 0)),
[Roact.Ref] = self.frameRef,
[Roact.Children] = Cryo.Dictionary.join(self.props[Roact.Children] or {}, {
sizeConstraint = self.props.maximumWidth < math.huge and Roact.createElement("UISizeConstraint", {
MaxSize = Vector2.new(self.props.maximumWidth, math.huge),
})
})
}
return Cryo.Dictionary.join(self.props, filteredProps)
end
function FitTextLabel:__getSize(rbx)
local maximumWidth = self.props.maximumWidth
local width = self.props.width
if width == FitTextLabel.Width.FitToText then
local textWidth = getTextWidth(self.props.Text, self.props.TextSize, self.props.Font)
width = UDim.new(0, math.min(textWidth, maximumWidth))
end
local widthCap = math.max(maximumWidth < math.huge and maximumWidth or 0, rbx.AbsoluteSize.X)
local textHeight = getTextHeight(
self.props.Text,
self.props.TextSize,
self.props.Font,
widthCap
)
return UDim2.new(width, UDim.new(0, textHeight))
end
return FitTextLabel
|
-- animação para o TextLabel
|
local function animateTextLabel()
local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local startingText = textLabel.Text
local currentValue = tonumber(numValue.Value)
local targetValue = currentValue
local decimal = string.match(tostring(currentValue), "%.(%d+)")
if decimal then
targetValue = math.floor(currentValue)
end
for i = 1, 10^(#tostring(targetValue)-1) do
local newValue = currentValue - (currentValue % i)
if newValue == targetValue then
textLabel.Text = commaSeparateNumber(tostring(newValue)) .. (decimal and "." .. decimal or "")
break
else
textLabel.Text = commaSeparateNumber(tostring(newValue)) .. (decimal and "." .. decimal or "")
wait(0.05)
end
end
wait(0.5)
textLabel.Text = startingText
end
updateTextLabel() -- atualiza o TextLabel ao iniciar o jogo
|
--[=[
Determines whether a value is a promise or not.
@param value any
@return boolean
]=]
|
function Promise.isPromise(value)
return type(value) == "table" and value.ClassName == "Promise"
end
|
--[[
___ _____
/ _ |/ ___/ Avxnturador | Novena
/ __ / /__ LuaInt | Novena
/_/ |_\___/ Build 6C, Version 1.4, Update 4
Please install this chassis from scratch.
More info can be found in the README.
New values will have (Username) appended to the end of the description.
]]
|
local Tune = {}
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local autoscaling = false --Estimates top speed
local UNITS = { --Click on speed to change units
--First unit is default
{
units = "KP/H" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 370 ,
spInc = 40 , -- Increment between labelled notches
},
{
units = "KP/H" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 370 ,
spInc = 40 , -- Increment between labelled notches
},
{
units = "KP/H" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 370 ,
spInc = 40 , -- Increment between labelled notches
}
}
|
-----------------------
--| Local Functions |--
-----------------------
|
local function CastRay(fromPoint, toPoint, ignoreList)
local vector = toPoint - fromPoint
local ray = Ray.new(fromPoint, vector.Unit * math.min(vector.Magnitude, 999))
return workspace:FindPartOnRayWithIgnoreList(ray, ignoreList or {}, false, true)
end
|
--[[Misc]]
|
Tune.LoadDelay = 1.0 -- Delay before initializing chassis (in seconds)
Tune.AutoStart = true -- Set to false if using manual ignition plugin
Tune.AutoFlip = true -- Set to false if using manual flip plugin
Tune.AutoUpdate = true -- Automatically applies minor updates to the chassis if any are found.
-- Will NOT apply major updates, but will notify you of any.
-- Set to false to mute notifications, or if using modified Drive.
|
--print(GBCF(n.CFrame,v[1].p))
|
pcall(function() n.CFrame = GBCF(n.CFrame,v[1]:inverse().p)*(v[1]:inverse()-v[1]:inverse().p) end)
end
end
wait()
end
end
Finished = Finished+1
end)
end
repeat wait() until Finished >= AF
Close = false
Opened = false
|
------//High Ready Animations
|
self.RightHighReady = CFrame.new(-1, .45, -1.15) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0));
self.LeftHighReady = CFrame.new(.75,.45,-1.15) * CFrame.Angles(math.rad(-90),math.rad(45),math.rad(0));
self.RightElbowHighReady = CFrame.new(0,-0.45,-0.45) * CFrame.Angles(math.rad(-75), math.rad(0), math.rad(0));
self.LeftElbowHighReady = CFrame.new(0,-.4,-.4) * CFrame.Angles(math.rad(-60), math.rad(30), math.rad(0));
self.RightWristHighReady = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0));
self.LeftWristHighReady = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0));
|
--Made by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
RunService = game:GetService("RunService")
UserInputService = game:GetService("UserInputService")
InputCheck = Instance.new("ScreenGui")
InputCheck.Name = "InputCheck"
InputButton = Instance.new("Frame")
InputButton.Name = "InputMonitor"
InputButton.BackgroundTransparency = 1
InputButton.Size = UDim2.new(1, 0, 1, 0)
InputButton.Parent = InputCheck
Animations = {}
LocalObjects = {}
ServerControl = Tool:WaitForChild("ServerControl")
ClientControl = Tool:WaitForChild("ClientControl")
ToolEquipped = false
function SetAnimation(mode, value)
if not ToolEquipped or not CheckIfAlive() then
return
end
if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
for i, v in pairs(Animations) do
if v.Animation == value.Animation then
v.AnimationTrack:Stop()
table.remove(Animations, i)
end
end
local AnimationTrack = Humanoid:LoadAnimation(value.Animation)
table.insert(Animations, {Animation = value.Animation, AnimationTrack = AnimationTrack})
AnimationTrack:Play(value.FadeTime, value.Weight, value.Speed)
elseif mode == "StopAnimation" and value then
for i, v in pairs(Animations) do
if v.Animation == value.Animation then
v.AnimationTrack:Stop(value.FadeTime)
table.remove(Animations, i)
end
end
end
end
function DisableJump(Boolean)
if PreventJump then
PreventJump:disconnect()
end
if Boolean then
PreventJump = Humanoid.Changed:connect(function(Property)
if Property == "Jump" then
Humanoid.Jump = false
end
end)
end
end
function CheckIfAlive()
return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Head and Head.Parent and Player and Player.Parent) and true) or false)
end
function Equipped(Mouse)
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
Head = Character:FindFirstChild("Head")
ToolEquipped = true
if not CheckIfAlive() then
return
end
PlayerMouse = Mouse
Mouse.KeyDown:connect(function(Key)
InvokeServer("KeyPress", {Key = Key, Down = true})
end)
Mouse.KeyUp:connect(function(Key)
InvokeServer("KeyPress", {Key = Key, Down = false})
end)
Mouse.Button1Down:connect(function()
InvokeServer("Button1Click", {Down = true})
end)
Mouse.Button1Up:connect(function()
InvokeServer("Button1Click", {Down = false})
end)
local PlayerGui = Player:FindFirstChild("PlayerGui")
if PlayerGui then
if UserInputService.TouchEnabled then
InputCheckClone = InputCheck:Clone()
InputCheckClone.InputMonitor.InputBegan:connect(function()
InvokeServer("Button1Click", {Down = true})
end)
InputCheckClone.InputMonitor.InputEnded:connect(function()
InvokeServer("Button1Click", {Down = false})
end)
InputCheckClone.Parent = PlayerGui
end
end
end
function Unequipped()
ToolEquipped = false
if InputCheckClone and InputCheckClone.Parent then
InputCheckClone:Destroy()
end
for i, v in pairs(Animations) do
if v and v.AnimationTrack then
v.AnimationTrack:Stop()
end
end
for i, v in pairs(LocalObjects) do
if v.Object then
v.Object.LocalTransparencyModifier = 0
end
end
for i, v in pairs({PreventJump, ObjectLocalTransparencyModifier}) do
if v then
v:disconnect()
end
end
Animations = {}
LocalObjects = {}
end
function InvokeServer(mode, value)
local ServerReturn
pcall(function()
ServerReturn = ServerControl:InvokeServer(mode, value)
end)
return ServerReturn
end
function OnClientInvoke(mode, value)
if not ToolEquipped or not CheckIfAlive() or not mode then
return
end
if mode == "PlayAnimation" and value then
SetAnimation("PlayAnimation", value)
elseif mode == "StopAnimation" and value then
SetAnimation("StopAnimation", value)
elseif mode == "PlaySound" and value then
value:Play()
elseif mode == "StopSound" and value then
value:Stop()
elseif mode == "MouseData" then
return {Position = PlayerMouse.Hit.p, Target = PlayerMouse.Target}
elseif mode == "DisableJump" then
DisableJump(value)
elseif mode == "SetLocalTransparencyModifier" and value then
pcall(function()
local ObjectFound = false
for i, v in pairs(LocalObjects) do
if v == value then
ObjectFound = true
end
end
if not ObjectFound then
table.insert(LocalObjects, value)
if ObjectLocalTransparencyModifier then
ObjectLocalTransparencyModifier:disconnect()
end
ObjectLocalTransparencyModifier = RunService.RenderStepped:connect(function()
local Camera = game:GetService("Workspace").CurrentCamera
for i, v in pairs(LocalObjects) do
if v.Object and v.Object.Parent then
local CurrentTransparency = v.Object.LocalTransparencyModifier
local ViewDistance = (Camera.CoordinateFrame.p - Head.Position).Magnitude
if ((not v.AutoUpdate and (CurrentTransparency == 1 or CurrentTransparency == 0)) or v.AutoUpdate) then
if ((v.Distance and ViewDistance <= v.Distance) or not v.Distance) then
v.Object.LocalTransparencyModifier = v.Transparency
else
v.Object.LocalTransparencyModifier = 0
end
end
else
table.remove(LocalObjects, i)
end
end
end)
end
end)
end
end
ClientControl.OnClientInvoke = OnClientInvoke
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
-- Decompiled with the Synapse X Luau decompiler.
|
local v1 = {};
v1.__index = v1;
v1.CameraShakeState = {
FadingIn = 0,
FadingOut = 1,
Sustained = 2,
Inactive = 3
};
local l__Vector3_new__1 = Vector3.new;
function v1.new(p1, p2, p3, p4)
if p3 == nil then
p3 = 0;
end;
if p4 == nil then
p4 = 0;
end;
assert(type(p1) == "number", "Magnitude must be a number");
assert(type(p2) == "number", "Roughness must be a number");
assert(type(p3) == "number", "FadeInTime must be a number");
assert(type(p4) == "number", "FadeOutTime must be a number");
local v2 = {
Magnitude = p1,
Roughness = p2,
PositionInfluence = l__Vector3_new__1(),
RotationInfluence = l__Vector3_new__1(),
DeleteOnInactive = true,
roughMod = 1,
magnMod = 1,
fadeOutDuration = p4,
fadeInDuration = p3,
sustain = p3 > 0
};
local v3
if p3 > 0 then
v3 = 0;
else
v3 = 1;
end;
v2.currentFadeTime = v3;
v2.tick = Random.new():NextNumber(-100, 100);
v2._camShakeInstance = true;
return setmetatable(v2, v1);
end;
local l__math_noise__2 = math.noise;
function v1.UpdateShake(p5, p6)
local l__tick__4 = p5.tick;
local v5 = p5.currentFadeTime;
if p5.fadeInDuration > 0 and p5.sustain then
if v5 < 1 then
v5 = v5 + p6 / p5.fadeInDuration;
elseif p5.fadeOutDuration > 0 then
p5.sustain = false;
end;
end;
if not p5.sustain then
v5 = v5 - p6 / p5.fadeOutDuration;
end;
if p5.sustain then
p5.tick = l__tick__4 + p6 * p5.Roughness * p5.roughMod;
else
p5.tick = l__tick__4 + p6 * p5.Roughness * p5.roughMod * v5;
end;
p5.currentFadeTime = v5;
return l__Vector3_new__1(l__math_noise__2(l__tick__4, 0) * 0.5, l__math_noise__2(0, l__tick__4) * 0.5, l__math_noise__2(l__tick__4, l__tick__4) * 0.5) * p5.Magnitude * p5.magnMod * v5;
end;
function v1.StartFadeOut(p7, p8)
if p8 == 0 then
p7.currentFadeTime = 0;
end;
p7.fadeOutDuration = p8;
p7.fadeInDuration = 0;
p7.sustain = false;
end;
function v1.StartFadeIn(p9, p10)
if p10 == 0 then
p9.currentFadeTime = 1;
end;
p9.fadeInDuration = p10 or p9.fadeInDuration;
p9.fadeOutDuration = 0;
p9.sustain = true;
end;
function v1.GetScaleRoughness(p11)
return p11.roughMod;
end;
function v1.SetScaleRoughness(p12, p13)
p12.roughMod = p13;
end;
function v1.GetScaleMagnitude(p14)
return p14.magnMod;
end;
function v1.SetScaleMagnitude(p15, p16)
p15.magnMod = p16;
end;
function v1.GetNormalizedFadeTime(p17)
return p17.currentFadeTime;
end;
function v1.IsShaking(p18)
local v6 = true;
if not (p18.currentFadeTime > 0) then
v6 = p18.sustain;
end;
return v6;
end;
function v1.IsFadingOut(p19)
return not p19.sustain and p19.currentFadeTime > 0;
end;
function v1.IsFadingIn(p20)
local v7 = false;
if p20.currentFadeTime < 1 then
v7 = p20.sustain and p20.fadeInDuration > 0;
end;
return v7;
end;
function v1.GetState(p21)
if p21:IsFadingIn() then
return v1.CameraShakeState.FadingIn;
end;
if p21:IsFadingOut() then
return v1.CameraShakeState.FadingOut;
end;
if p21:IsShaking() then
return v1.CameraShakeState.Sustained;
end;
return v1.CameraShakeState.Inactive;
end;
return v1;
|
--- Add a task to clean up
-- @usage
-- Maid[key] = (function) Adds a task to perform
-- Maid[key] = (event connection) Manages an event connection
-- Maid[key] = (Maid) Maids can act as an event connection, allowing a Maid to have other maids to clean up.
-- Maid[key] = (Object) Maids can cleanup objects with a `Destroy` method
-- Maid[key] = nil Removes a named task. If the task is an event, it is disconnected. If it is an object,
-- it is destroyed.
|
function Maid:__newindex(index, newTask)
if (Maid[index] ~= nil) then
error(("'%s' is reserved"):format(tostring(index)), 2)
end
local tasks = self._tasks
local oldTask = tasks[index]
tasks[index] = newTask
if (oldTask) then
if (type(oldTask) == "function") then
oldTask()
elseif (typeof(oldTask) == "RBXScriptConnection") then
oldTask:Disconnect()
elseif (oldTask.Destroy) then
oldTask:Destroy()
elseif (Promise.Is(oldTask)) then
oldTask:Cancel()
end
end
end
|
--// Recoil Settings
|
gunrecoil = -0.75; -- How much the gun recoils backwards when not aiming
camrecoil = 0.26; -- How much the camera flicks when not aiming
AimGunRecoil = -0.75; -- How much the gun recoils backwards when aiming
AimCamRecoil = 0.23; -- How much the camera flicks when aiming
CamShake = 8; -- THIS IS NEW!!!! CONTROLS CAMERA SHAKE WHEN FIRING
AimCamShake = 6; -- THIS IS ALSO NEW!!!!
Kickback = 10.2; -- Upward gun rotation when not aiming
AimKickback = 9.11; -- Upward gun rotation when aiming
|
-- print(animName .. " " .. idx .. " [" .. origRoll .. "]")
|
local anim = animTable[animName][idx].anim
-- load it to the humanoid; get AnimationTrack
currentAnimTrack = humanoid:LoadAnimation(anim)
-- play the animation
if animName == "walk" then
currentAnimTrack:Play(nil,nil,2)
else
currentAnimTrack:Play(transitionTime)
end
currentAnim = animName
-- set up keyframe name triggers
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
end
end
|
--Do not change anything besides the lines mentioned below.
|
model = script.Parent.Parent--Indicates that the script interacts with the model the button is grouped with.
messageText = "Regen"--If you want a message to appear upon pressing, type it here.
message = Instance.new("Message")
message.Text = messageText
backup = model:clone()
enabled = true
function regenerate()
message.Parent = game.Workspace
model:remove()
wait(2)--Change this number to display the regen message as long as you want in seconds.
model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
message.Parent = nil
script.Disabled = true
script.Parent.BrickColor = BrickColor.new(69)
wait(10)--Change this number to change the time in between regenerations via the button, in seconds..
script.Parent.BrickColor = BrickColor.new(197)
script.Disabled = false
end
function onHit(hit)
if (hit.Parent:FindFirstChild("Humanoid") ~= nil) and enabled then
regenerate()
end
end
script.Parent.Touched:connect(onHit)
|
--unfreeze the character
|
for i = 1, #iceParts do
local C = iceParts[i]:GetChildren()
for ii = 1,#C do
if C[ii].className == "Weld" then
C[ii]:Destroy()
end
end
local dir = (iceParts[i].Position-iceParts[i].CFrame.p+Vector3.new(0, 1, 0)).unit
iceParts[i].Velocity = (dir+Vector3.new(math.random()-.5, 1, math.random()-.5))*20
iceParts[i].RotVelocity = (dir+Vector3.new(math.random()-.5, math.random()-.5, math.random()-.5))*10
local force = Instance.new("BodyForce")
force.Force = dir * 50 * iceParts[i]:GetMass()
force.Parent = iceParts[i]
delay(.25, function() force:Destroy() end)
end
for i = 1, #iceParts2 do
local C = iceParts2[i]:GetChildren()
for ii = 1,#C do
if C[ii].className == "Weld" then
C[ii]:Destroy()
end
end
local dir = (iceParts2[i].Position-iceParts2[i].CFrame.p+Vector3.new(0, 1, 0)).unit
iceParts2[i].Velocity = (dir+Vector3.new(math.random()-.5, 1, math.random()-.5))*20
iceParts2[i].RotVelocity = (dir+Vector3.new(math.random()-.5, math.random()-.5, math.random()-.5))*10
local force = Instance.new("BodyForce")
force.Force = dir * 50 * iceParts2[i]:GetMass()
force.Parent = iceParts2[i]
delay(.25, function() force:Destroy() end)
end
EnableMove()
IceShatter = Instance.new("Sound")
IceShatter.Name = "IceShatter"
IceShatter.SoundId = "rbxassetid://"..shatterSounds[math.random(1,#shatterSounds)]
IceShatter.Parent = Head
IceShatter.PlaybackSpeed = 1
IceShatter.Volume = 1.5
game.Debris:AddItem(IceShatter, 10)
delay(0, function() IceShatter:Play() end)
IceShatter.Ended:connect(function()
if script then
script:Destroy()
end
end)
|
-- Version 3
-- Last updated: 31/07/2020
|
local Module = {}
DebugEnabled = false
Debris = game:GetService("Debris")
function Module.FracturePart(PartToFracture)
local BreakingPointAttachment = PartToFracture:FindFirstChild("BreakingPoint")
-- Settings
local Configuration = PartToFracture:FindFirstChild("Configuration")
local DebrisDespawn = false
local DebrisDespawnDelay = 0
local WeldDebris = false
local AnchorDebris = false
if DebugEnabled then
local DebugPart = Instance.new("Part")
DebugPart.Shape = "Ball"
DebugPart.CanCollide = false
DebugPart.Anchored = true
DebugPart.Size = Vector3.new(0.5, 0.5, 0.5)
DebugPart.Color = Color3.fromRGB(255, 0, 0)
DebugPart.Position = BreakingPointAttachment.WorldPosition
DebugPart.Parent = workspace
end
local BreakSound = PartToFracture:FindFirstChild("BreakSound")
if BreakSound then
local SoundPart = Instance.new("Part")
SoundPart.Size = Vector3.new(0.2, 0.2, 0.2)
SoundPart.Position = PartToFracture.Position
SoundPart.Name = "TemporarySoundEmitter"
SoundPart.Anchored = true
SoundPart.CanCollide = false
SoundPart.Transparency = 1
local Sound = BreakSound:Clone()
Sound.Parent = SoundPart
SoundPart.Parent = workspace
Sound:Play()
Debris:AddItem(SoundPart, Sound.PlaybackSpeed)
end
if Configuration then
DebrisDespawn = Configuration.DebrisDespawn.Value
DebrisDespawnDelay = Configuration.DebrisDespawnDelay.Value
WeldDebris = Configuration.WeldDebris.Value
AnchorDebris = Configuration.AnchorDebris.Value
else
warn("The 'Configuration' is not a valid member of " .. PartToFracture.Name .. ". Please insert a 'Configuration' with the following values; 'DebrisDespawn' (bool), 'WeldDebris' (bool), 'DebrisDespawnDelay' (number/int)")
end
if not BreakingPointAttachment then
warn("The 'BreakingPoint' attachment is not a valid member of " .. PartToFracture.Name .. ". Please insert an attachment named 'BreakingPoint'")
end
local BreakingPointY = BreakingPointAttachment.Position.Y
local BreakingPointZ = BreakingPointAttachment.Position.Z
local ShardBottomLeft = Instance.new("WedgePart")
local ShardBottomRight = Instance.new("WedgePart")
local ShardTopLeft = Instance.new("WedgePart")
local ShardTopRight = Instance.new("WedgePart")
local BreakSound = PartToFracture:FindFirstChild("BreakSound")
-- Bottom Left
ShardBottomLeft.Material = PartToFracture.Material
ShardBottomLeft.Color = PartToFracture.Color
ShardBottomLeft.CanCollide = false
ShardBottomLeft.Transparency = PartToFracture.Transparency
ShardBottomLeft.Size = PartToFracture.Size - Vector3.new(0, (PartToFracture.Size.Y / 2) - BreakingPointY, (PartToFracture.Size.Z / 2) + BreakingPointZ)
local OldSizeY = ShardBottomLeft.Size.Y
local OldSizeZ = ShardBottomLeft.Size.Z
ShardBottomLeft.CFrame = PartToFracture.CFrame * CFrame.new(0, BreakingPointY - (ShardBottomLeft.Size.Y / 2), BreakingPointZ + (ShardBottomLeft.Size.Z / 2))
ShardBottomLeft.CFrame = ShardBottomLeft.CFrame * CFrame.Angles(math.rad(90), 0, 0)
ShardBottomLeft.Size = Vector3.new(ShardBottomLeft.Size.X, OldSizeZ, OldSizeY)
local ShardBottomLeft2 = ShardBottomLeft:Clone()
ShardBottomLeft2.CFrame = ShardBottomLeft2.CFrame * CFrame.Angles(math.rad(180), 0, 0)
-- Bottom Right
ShardBottomRight.Material = PartToFracture.Material
ShardBottomRight.Color = PartToFracture.Color
ShardBottomLeft.CanCollide = false
ShardBottomRight.Transparency = PartToFracture.Transparency
ShardBottomRight.Size = PartToFracture.Size - Vector3.new(0, (PartToFracture.Size.Y / 2) + BreakingPointY, (PartToFracture.Size.Z / 2) + BreakingPointZ)
ShardBottomRight.CFrame = PartToFracture.CFrame * CFrame.new(0, BreakingPointY + (ShardBottomRight.Size.Y / 2), BreakingPointZ + (ShardBottomRight.Size.Z / 2))
local ShardBottomRight2 = ShardBottomRight:Clone()
ShardBottomRight2.CFrame = ShardBottomRight2.CFrame * CFrame.Angles(math.rad(180), 0, 0)
-- Top Left
ShardTopLeft.Material = PartToFracture.Material
ShardTopLeft.Color = PartToFracture.Color
ShardBottomLeft.CanCollide = false
ShardTopLeft.Transparency = PartToFracture.Transparency
ShardTopLeft.Size = PartToFracture.Size - Vector3.new(0, (PartToFracture.Size.Y / 2) + BreakingPointY, (PartToFracture.Size.Z / 2) - BreakingPointZ)
local OldSizeY = ShardTopLeft.Size.Y
local OldSizeZ = ShardTopLeft.Size.Z
ShardTopLeft.CFrame = PartToFracture.CFrame * CFrame.new(0, BreakingPointY + (ShardTopLeft.Size.Y / 2), BreakingPointZ - (ShardTopLeft.Size.Z / 2))
ShardTopLeft.CFrame = ShardTopLeft.CFrame * CFrame.Angles(math.rad(90), 0, 0)
ShardTopLeft.Size = Vector3.new(ShardTopLeft.Size.X, OldSizeZ, OldSizeY)
local ShardTopLeft2 = ShardTopLeft:Clone()
ShardTopLeft2.CFrame = ShardTopLeft2.CFrame * CFrame.Angles(math.rad(180), 0, 0)
-- Top Right
ShardTopRight.Material = PartToFracture.Material
ShardTopRight.Color = PartToFracture.Color
ShardBottomLeft.CanCollide = false
ShardTopRight.Transparency = PartToFracture.Transparency
ShardTopRight.Size = PartToFracture.Size - Vector3.new(0, (PartToFracture.Size.Y / 2) - BreakingPointY, (PartToFracture.Size.Z / 2) - BreakingPointZ)
ShardTopRight.CFrame = PartToFracture.CFrame * CFrame.new(0, BreakingPointY - (ShardTopRight.Size.Y / 2), BreakingPointZ - (ShardTopRight.Size.Z / 2))
local ShardTopRight2 = ShardTopRight:Clone()
ShardTopRight2.CFrame = ShardTopRight2.CFrame * CFrame.Angles(math.rad(180), 0, 0)
local ShardDictionary = {ShardBottomLeft, ShardBottomLeft2, ShardBottomRight, ShardBottomRight2, ShardTopLeft, ShardTopLeft2, ShardTopRight, ShardTopRight2}
local FirstShard = nil
for Index, Shard in ipairs(ShardDictionary) do
if not FirstShard then
FirstShard = Shard
end
Shard.Anchored = AnchorDebris
if not AnchorDebris then
Shard.Velocity = PartToFracture.Velocity
Shard.RotVelocity = PartToFracture.RotVelocity
end
if WeldDebris and FirstShard then
local Weld = Instance.new("WeldConstraint")
Weld.Name = "ShardWeld"
Weld.Part0 = FirstShard
Weld.Part1 = Shard
Weld.Parent = Shard
end
Shard.Name = "Shard"
Shard.Parent = PartToFracture.Parent
if DebrisDespawn then
Debris:AddItem(Shard, DebrisDespawnDelay)
end
end
PartToFracture:Destroy()
end
return Module
|
--[[
Creates a (perfectly centered) host part for particles. Pretty tight use-case. Returns (part, attachment).
Functions.CreateParticleHost(
CFrame/Vector3 <-- |REQ| As stated
)
--]]
|
return function(pos)
--- Create host part for particles
local part = Instance.new("Part")
part.Anchored = true
part.CanCollide = false
part.Transparency = 1
part.Material = Enum.Material.SmoothPlastic
part.CastShadow = false
part.Size = Vector3.new()
part.CFrame = typeof(pos) == "Vector3" and CFrame.new(pos) or pos
part.Name = "host"
--- Create attachment to center particles on point
local attachment = Instance.new("Attachment")
attachment.Parent = part
--- Parent
part.Parent = game.Workspace.TG_w9YYRt8Eb1AkGy
--
return part, attachment
end
|
--[[
Package link auto-generated by Rotriever
]]
|
local PackageIndex = script.Parent.Parent.Parent._Index
local Package = require(PackageIndex["Picomatch"]["Picomatch"])
return Package
|
---------------------------------------------------------------|
------// SETTINGS //-------------------------------------------|
---------------------------------------------------------------|
|
local FireRate = 600
local LimbsDamage = {52,54}
local TorsoDamage = {70,86}
local HeadDamage = {140,145}
local FallOfDamage = 1
local BulletPenetration = 75
local RegularWalkspeed = 12
local SearchingWalkspeed = 8
local ShootingWalkspeed = 4
local Spread = 6
local MinDistance = 100
local MaxInc = 16
local Mode = 2
local Tracer = true
local TracerColor = Color3.fromRGB(255,255,255)
local BulletFlare = false
local BulletFlareColor = Color3.fromRGB(255,255,255)
|
-- How many times per second the gun can fire
|
local FireRate = .4
|
--[[Chassis Spawning]]
|
--
local fWheel = bike.FrontSection.Wheel
local rWheel = bike.RearSection.Wheel
|
--[[
TODO: Double tap directional key to run
]]
| |
--[=[
Unpacks the observables value if a table is received
@param observable Observable<{T}>
@return Observable<T>
]=]
|
function Rx.unpacked(observable)
assert(Observable.isObservable(observable), "Bad observable")
return Observable.new(function(sub)
return observable:Subscribe(function(value)
if type(value) == "table" then
sub:Fire(unpack(value))
else
warn(("[Rx.unpacked] - Observable didn't return a table got type %q")
:format(type(value)))
end
end, sub:GetFailComplete())
end)
end
|
--[[[Default Controls]]
|
--Peripheral Deadzones
Tune.Peripherals = {
MSteerWidth = 67 , -- Mouse steering control width (0 - 100% of screen width)
MSteerDZone = 10 , -- Mouse steering deadzone (0 - 100%)
ControlLDZone = 5 , -- Controller steering L-deadzone (0 - 100%)
ControlRDZone = 5 , -- Controller steering R-deadzone (0 - 100%)
}
--Control Mapping
Tune.Controls = {
--Keyboard Controls
--Mode Toggles
ToggleTransMode = Enum.KeyCode.M ,
--Primary Controls
Throttle = Enum.KeyCode.Up ,
Brake = Enum.KeyCode.Down ,
SteerLeft = Enum.KeyCode.Left ,
SteerRight = Enum.KeyCode.Right ,
--Secondary Controls
Throttle2 = Enum.KeyCode.W ,
Brake2 = Enum.KeyCode.S ,
SteerLeft2 = Enum.KeyCode.A ,
SteerRight2 = Enum.KeyCode.D ,
--Manual Transmission
ShiftUp = Enum.KeyCode.E ,
ShiftDown = Enum.KeyCode.Q ,
Clutch = Enum.KeyCode.LeftShift ,
--Handbrake
PBrake = Enum.KeyCode.P ,
--Mouse Controls
MouseThrottle = Enum.UserInputType.MouseButton1 ,
MouseBrake = Enum.UserInputType.MouseButton2 ,
MouseClutch = Enum.KeyCode.W ,
MouseShiftUp = Enum.KeyCode.E ,
MouseShiftDown = Enum.KeyCode.Q ,
MousePBrake = Enum.KeyCode.LeftShift ,
--Controller Mapping
ContlrThrottle = Enum.KeyCode.ButtonR2 ,
ContlrBrake = Enum.KeyCode.ButtonL2 ,
ContlrSteer = Enum.KeyCode.Thumbstick1 ,
ContlrShiftUp = Enum.KeyCode.ButtonY ,
ContlrShiftDown = Enum.KeyCode.ButtonX ,
ContlrClutch = Enum.KeyCode.ButtonR1 ,
ContlrPBrake = Enum.KeyCode.ButtonL1 ,
ContlrToggleTMode = Enum.KeyCode.DPadUp ,
ContlrToggleTCS = Enum.KeyCode.DPadDown ,
ContlrToggleABS = Enum.KeyCode.DPadRight ,
}
|
--//Setup//--
|
local WindLines = require(script.WindLines)
local WindShake = require(script.WindShake)
local WindSpeed = 20
local WindShakeSettings = {
WindPower = 0.75,
WindSpeed = WindSpeed,
WindDirection = Vector3.new(5, 0, 5)
}
local WindLinesSettings = {
WindDirection = Vector3.new(5, 0, 5),
WindSpeed = WindSpeed,
LifeTime = 9,
SpawnRate = 15
}
local ShakableObjects = {
"Leaf",
"Leaves",
"Bush"
}
|
--------------------------------------------------------------------
|
if setupmode == "Manual" then
if soundplugin == "StockSound" then
mouse.KeyDown:connect(function(key)
if key == camkey and enabled == false then
enabled = true
local sound = car.DriveSeat.Rev
local effect = script.soundeffect:Clone()
effect.Name = "soundeffectCop"
effect.Parent = sound
elseif key == camkey and enabled == true then
enabled = false
local sound = car.DriveSeat.Rev
sound.soundeffectCop:Destroy()
end
end)
car.DriveSeat.ChildRemoved:Connect(function(child)
if child.Name == "SeatWeld" then
local sound = car.DriveSeat.Rev
sound.soundeffectCop:Destroy()
end
end)
elseif soundplugin == "SoundSuite" then
mouse.KeyDown:connect(function(key)
if key == camkey and enabled == false then
enabled = true
local descendants = car.Body.Exh:GetDescendants()
for index, descendant in pairs(descendants) do
if descendant:IsA("Sound") then
local effect = script.soundeffect:Clone()
effect.Name = "soundeffectCop"
effect.Parent = descendant
end
end
elseif key == camkey and enabled == true then
enabled = false
local descendants = car.Body.Exh:GetDescendants()
for index, descendant in pairs(descendants) do
if descendant:IsA("Sound") then
descendant.soundeffectCop:Destroy()
end
end
end
end)
car.DriveSeat.ChildRemoved:Connect(function(child)
if child.Name == "SeatWeld" then
local descendants = car.Body.Exh:GetDescendants()
for index, descendant in pairs(descendants) do
if descendant:IsA("Sound") then
descendant.soundeffectCop:Destroy()
end
end
end
end)
elseif soundplugin == "1.5 Sound" then
mouse.KeyDown:connect(function(key)
if key == camkey and enabled == false then
enabled = true
local descendants = car.Body.Engine:GetDescendants()
for index, descendant in pairs(descendants) do
if descendant:IsA("Sound") then
local effect = script.soundeffect:Clone()
effect.Name = "soundeffectCop"
effect.Parent = descendant
end
end
local descendants = car.Body.Exhaust:GetDescendants()
for index, descendant in pairs(descendants) do
if descendant:IsA("Sound") then
local effect = script.soundeffect:Clone()
effect.Name = "soundeffectCop"
effect.Parent = descendant
end
end
elseif key == camkey and enabled == true then
enabled = false
local descendants = car.Body.Engine:GetDescendants()
for index, descendant in pairs(descendants) do
if descendant:IsA("Sound") then
descendant.soundeffectCop:Destroy()
end
end
local descendants = car.Body.Exhaust:GetDescendants()
for index, descendant in pairs(descendants) do
if descendant:IsA("Sound") then
descendant.soundeffectCop:Destroy()
end
end
end
car.DriveSeat.ChildRemoved:Connect(function(child)
if child.Name == "SeatWeld" then
local descendants = car.Body.Engine:GetDescendants()
for index, descendant in pairs(descendants) do
if descendant:IsA("Sound") then
descendant.soundeffectCop:Destroy()
end
end
local descendants = car.Body.Exhaust:GetDescendants()
for index, descendant in pairs(descendants) do
if descendant:IsA("Sound") then
descendant.soundeffectCop:Destroy()
end
end
end
end)
end)
end
|
-- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
|
local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
function configureAnimationSet(name, fileList)
if (animTable[name] ~= nil) then
for _, connection in pairs(animTable[name].connections) do
connection:Disconnect()
end
end
animTable[name] = {}
animTable[name].count = 0
animTable[name].totalWeight = 0
animTable[name].connections = {}
local allowCustomAnimations = true
local AllowDisableCustomAnimsUserFlag = false
local success, msg = pcall(function()
AllowDisableCustomAnimsUserFlag = UserSettings():IsUserFeatureEnabled("UserAllowDisableCustomAnims2")
end)
if (AllowDisableCustomAnimsUserFlag) then
local success, msg = pcall(function() allowCustomAnimations = game:GetService("StarterPlayer").AllowCustomAnimations end)
if not success then
allowCustomAnimations = true
end
end
-- check for config values
local config = script:FindFirstChild(name)
if (allowCustomAnimations and config ~= nil) then
table.insert(animTable[name].connections, config.ChildAdded:Connect(function(child) configureAnimationSet(name, fileList) end))
table.insert(animTable[name].connections, config.ChildRemoved:Connect(function(child) configureAnimationSet(name, fileList) end))
local idx = 1
for _, childPart in pairs(config:GetChildren()) do
if (childPart:IsA("Animation")) then
table.insert(animTable[name].connections, childPart.Changed:Connect(function(property) configureAnimationSet(name, fileList) end))
animTable[name][idx] = {}
animTable[name][idx].anim = childPart
local weightObject = childPart:FindFirstChild("Weight")
if (weightObject == nil) then
animTable[name][idx].weight = 1
else
animTable[name][idx].weight = weightObject.Value
end
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
idx = idx + 1
end
end
end
-- fallback to defaults
if (animTable[name].count <= 0) then
for idx, anim in pairs(fileList) do
animTable[name][idx] = {}
animTable[name][idx].anim = Instance.new("Animation")
animTable[name][idx].anim.Name = name
animTable[name][idx].anim.AnimationId = anim.id
animTable[name][idx].weight = anim.weight
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
|
--activeBullets, rPly, realHitObj, bulletId, fallOff
|
function BulletServerModule.validateClientBulletHit(activeBullets, rPly, realHitObj, bulletId, fallOff, waitTime)
if not activeBullets or not rPly or not realHitObj or not bulletId or not fallOff then return end
if not string.find(bulletId, tostring(rPly.UserId)) then return end
local bulletObj = activeBullets[bulletId]
local startTime = tick()
while not bulletObj and tick() - startTime <= 0.5 do
bulletObj = activeBullets[bulletId]
task.wait(waitTime or 0.05)
end
if not bulletObj then return end --This player has above 500 ms most likely, so we can ignore them
local serverDir = (realHitObj.Position - bulletObj.ORIGIN).unit
if bulletObj.DIRECTION:Dot(serverDir) < 0.5 then return end
return true
end
return BulletServerModule
|
---- Services ----
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.