prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--[=[
Gives a task to the maid for cleanup, but uses an incremented number as a key.
@param task MaidTask -- An item to clean
@return number -- taskId
]=]
|
function Maid:GiveTask(maidTask)
if not maidTask then
error("Task cannot be false or nil", 2)
end
local taskId = #self._tasks+1
self[taskId] = maidTask
if type(maidTask) == "table" and (not maidTask.Destroy) then
warn("[Maid.GiveTask] - Gave table task without .Destroy\n\n" .. debug.traceback())
end
return taskId
end
|
-- functions
|
function onDied()
stopLoopedSounds()
sDied:Play()
end
local fallCount = 0
local fallSpeed = 0
function onStateFall(state, sound)
fallCount = fallCount + 1
if state then
sound.Volume = 0
sound:Play()
task.spawn(function()
local t = 0
local thisFall = fallCount
while t < 1.5 and fallCount == thisFall do
local vol = math.max(t - 0.3 , 0)
sound.Volume = vol
task.wait(0.1)
t = t + 0.1
end
end)
else
sound:Stop()
end
fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.Y))
end
function onStateNoStop(state, sound)
if state then
sound:Play()
end
end
function onRunning(speed)
sClimbing:Stop()
sSwimming:Stop()
if (prevState == "FreeFall" and fallSpeed > 0.1) then
local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
sLanding.Volume = vol
sLanding:Play()
fallSpeed = 0
end
if speed>0.5 then
sRunning.Playing = true
sRunning.Pitch = 1.85
else
sRunning:Stop()
end
prevState = "Run"
end
function onSwimming(speed)
if (prevState ~= "Swim" and speed > 0.1) then
local volume = math.min(1.0, speed / 350)
sSplash.Volume = volume
sSplash:Play()
prevState = "Swim"
end
sClimbing:Stop()
sRunning:Stop()
sSwimming.Pitch = 1.6
sSwimming:Play()
end
function onClimbing(speed)
sRunning:Stop()
sSwimming:Stop()
if speed>0.01 then
sClimbing:Play()
sClimbing.Pitch = speed / 5.5
else
sClimbing:Stop()
end
prevState = "Climb"
end
|
-- hello naca
-- things you'll need in this config:
| |
--<Action Code>--
|
script.Parent.Touched:connect(function(other)
if other and game.Players:GetPlayerFromCharacter(other.Parent) then
local player = game.Players:GetPlayerFromCharacter(other.Parent);
local PlayerGui = player.PlayerGui
if not PlayerGui:FindFirstChild("_PlayOnTouchedSound") then
CreateSound(SoundID, Volume, player.PlayerGui);
elseif PlayerGui:FindFirstChild("_PlayOnTouchedSound") and
PlayerGui:FindFirstChild("_PlayOnTouchedSound").SoundId ~= "rbxassetid://"..SoundID then
PlayerGui:FindFirstChild("_PlayOnTouchedSound"):Remove()
CreateSound(SoundID, Volume, player.PlayerGui);
end;
end;
end);
|
-- Ring2 ascending
|
for l = 1,#lifts2 do
if (lifts2[l].className == "Part") then
lifts2[l].BodyPosition.position = Vector3.new((lifts2[l].BodyPosition.position.x),(lifts2[l].BodyPosition.position.y+2),(lifts2[l].BodyPosition.position.z))
end
end
wait(0.1)
for p = 1,#parts2 do
parts2[p].CanCollide = true
end
wait(0.5)
|
------------------------------------
|
function onTouched(part)
if part.Parent ~= nil then
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
local teleportfrom=script.Parent.Enabled.Value
if teleportfrom~=0 then
if h==humanoid then
return
end
local teleportto=script.Parent.Parent:findFirstChild(modelname)
if teleportto~=nil then
local torso = h.Parent.Torso
local location = {teleportto.Position}
local i = 1
local x = location[i].x
local y = location[i].y
local z = location[i].z
x = x + math.random(-0, 0)
z = z + math.random(-0, 0)
y = y + math.random(2, 3)
local cf = torso.CFrame
local lx = 0
local ly = y
local lz = 0
script.Parent.Enabled.Value=0
teleportto.Enabled.Value=0
torso.CFrame = CFrame.new(Vector3.new(x,y,z), Vector3.new(lx,ly,lz))
wait(0)
script.Parent.Enabled.Value=1
teleportto.Enabled.Value=1
else
print("Could not find teleporter!")
end
end
end
end
end
script.Parent.Touched:connect(onTouched)
|
--LockController
|
Closed = true
function LockUnlock()
if script.Parent.Locked.Value == true then
script.Parent.SwitchArm.Interactive.ClickDetector.MaxActivationDistance = 0
else
script.Parent.SwitchArm.Interactive.ClickDetector.MaxActivationDistance = 10
end
end
script.Parent.Enclosure.Touched:connect(function(P)
if P ~= nil and P.Parent ~= nil and P.Parent:FindFirstChild("CardNumber") ~= nil and P.Parent.CardNumber.Value == 0 then
if Closed == true then
script.Parent.Locked.Value = false
Closed = 1
LockUnlock()
wait(1)
Closed = false
return
end
if Closed == false then
script.Parent.Locked.Value = true
Closed = 1
LockUnlock()
wait(1)
Closed = true
return
end
end
end)
LockUnlock() --Check
|
-- Initialize the tool
|
local RotateTool = {
Name = 'Rotate Tool';
Color = BrickColor.new 'Bright green';
-- Default options
Increment = 15;
Pivot = 'Center';
};
|
--Physical Util
|
function Util.checkDist(a,b)
local pointA, pointB
if typeof(a) == "Vector3" then
pointA = a
else
pointA = a.Position
end
if typeof(b) == "Vector3" then
pointB = b
else
pointB = b.Position
end
return (pointA - pointB).Magnitude
end
|
--[[**
ensures value matches given interface definition strictly
@param checkTable The interface definition
@returns A function that will return true iff the condition is passed
**--]]
|
function t.strictInterface(checkTable)
assert(checkInterface(checkTable))
return function(value)
local tableSuccess, tableErrMsg = t.table(value)
if tableSuccess == false then
return false, tableErrMsg or ""
end
for key, check in pairs(checkTable) do
local success, errMsg = check(value[key])
if success == false then
return false, string.format("[interface] bad value for %s:\n\t%s", tostring(key), errMsg or "")
end
end
for key in pairs(value) do
if not checkTable[key] then
return false, string.format("[interface] unexpected field %q", tostring(key))
end
end
return true
end
end
end
|
--[[**
<description>
Asynchronously saves the data to the data store.
</description>
**--]]
|
function DataStore:SaveAsync()
coroutine.wrap(DataStore.Save)(self)
end
|
--> Variables
|
local Timer = Fountain:GetAttribute("Timer") -- How long you must wait to heal (in seconds)
local WaterColor = {}
|
--local newOre = EntityData.GetEntity(oreName)
|
GU.SpawnItem(oreName,1,root.CFrame*CFrame.new(0,1,0))
end
end)
AttitudeCoroutine()
while true do
if mode == "charLock" then
targetLocation = (charRoot.CFrame*CFrame.new(-1,-2,5)).p
targetLook = charRoot.CFrame*CFrame.new(charRoot.CFrame.lookVector*1000)
end
bg.CFrame = targetLook
bp.Position = targetLocation
wait()
end
|
--[[
LOWGames Studios
Date: 27 October 2022
by Elder
]]
|
--
local u1 = nil;
coroutine.wrap(function()
u1 = require(game.ReplicatedStorage:WaitForChild("Framework"):WaitForChild("Library"));
end)();
return function(p1, p2)
if type(p1) == "string" then
p1 = game.Players:FindFirstChild(p1);
end;
if type(p2) == "string" then
p2 = game.Players:FindFirstChild(p2);
end;
if p1 and p2 and p1.Character and p2.Character then
local l__HumanoidRootPart__1 = p1.Character:FindFirstChild("HumanoidRootPart");
local l__HumanoidRootPart__2 = p2.Character:FindFirstChild("HumanoidRootPart");
if l__HumanoidRootPart__1 and l__HumanoidRootPart__2 then
return (l__HumanoidRootPart__1.CFrame.p - l__HumanoidRootPart__2.CFrame.p).Magnitude;
end;
end;
end;
|
--- Effect kind of like a flashbang (for when you need to surprise the user maybe?)
|
return function(addTime, decayTime, color, transparency)
--- Variables
addTime = addTime or 1
decayTime = decayTime or 1
color = color or Color3.new(1, 1, 1)
transparency = transparency or 0
--
local animationStartTime = tick()
--- Main
coroutine.wrap(function()
--- Create flash gui
local flashGui = Instance.new("Frame")
flashGui.BackgroundTransparency = 1
flashGui.BackgroundColor3 = color
flashGui.Size = UDim2.new(2, 0, 2, 0)
flashGui.AnchorPoint = Vector2.new(0.5, 0.5)
flashGui.Position = UDim2.new(0.5, 0, 0.5, 0)
flashGui.BorderSizePixel = 0
flashGui.Parent = _L.GUIFX.GetHolder()
--- Flash!
if addTime > 0 then
_L.Functions.FastTween(flashGui, {BackgroundTransparency = transparency}, {addTime, "Linear", "Out"})
wait(addTime)
else
flashGui.BackgroundTransparency = transparency
end
--- Fade away flash
if decayTime > 0 then
_L.Functions.FastTween(flashGui, {BackgroundTransparency = 1}, {decayTime, "Sine", "Out"})
wait(decayTime)
else
flashGui.BackgroundTransparency = 1
end
--- Destroy flash
flashGui:Destroy()
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
ToggleTCS = Enum.KeyCode.T ,
ToggleABS = Enum.KeyCode.Y ,
ToggleTransMode = Enum.KeyCode.At ,
ToggleMouseDrive = Enum.KeyCode.F4 ,
--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 ,
}
|
--[=[
Sets the current and target position, and sets the velocity to 0.
@prop pt number
@within AccelTween
]=]
|
function AccelTween:__index(index)
if AccelTween[index] then
return AccelTween[index]
elseif index == "p" then
local pos, _ = self:_getstate(tick())
return pos
elseif index == "v" then
local _, vel = self:_getstate(tick())
return vel
elseif index == "a" then
return self._accel
elseif index == "t" then
return self._y1
elseif index == "rtime" then
local time = tick()
return time < self._t1 and self._t1 - time or 0
else
error(("Bad index %q"):format(tostring(index)))
end
end
function AccelTween:__newindex(index, value)
if index == "p" then
self:_setstate(value, nil, nil, nil)
elseif index == "v" then
self:_setstate(nil, value, nil, nil)
elseif index == "a" then
self:_setstate(nil, nil, value, nil)
elseif index == "t" then
self:_setstate(nil, nil, nil, value)
elseif index == "pt" then
self:_setstate(value, 0, nil, value)
else
error(("Bad index %q"):format(tostring(index)))
end
end
function AccelTween:_getstate(time)
if time < (self._t0 + self._t1)/2 then
local t = time - self._t0
return self._y0 + t*t/2*self._a0, t*self._a0
elseif time < self._t1 then
local t = time - self._t1
return self._y1 + t*t/2*self._a1, t*self._a1
else
return self._y1, 0
end
end
function AccelTween:_setstate(newpos, newvel, newaccel, newtarg)
local time = tick()
local pos, vel = self:_getstate(time)
pos = newpos or pos
vel = newvel or vel
self._accel = newaccel or self._accel
local targ = newtarg or self._y1
if self._accel*self._accel < 1e-8 then
self._t0, self._y0, self._a0 = 0, pos, 0
self._t1, self._y1, self._a1 = math.huge, targ, 0
else
local conda = targ < pos
local condb = vel < 0
local condc = pos - vel*vel/(2*self._accel) < targ
local condd = pos + vel*vel/(2*self._accel) < targ
if conda and condb and condc or not conda and (condb or not condb and condd) then
self._a0 = self._accel
self._t1 = time + ((2*vel*vel + 4*self._accel*(targ - pos))^0.5 - vel)/self._accel
else
self._a0 = -self._accel
self._t1 = time + ((2*vel*vel - 4*self._accel*(targ - pos))^0.5 + vel)/self._accel
end
self._t0 = time - vel/self._a0
self._y0 = pos - vel*vel/(2*self._a0)
self._y1 = targ
self._a1 = -self._a0
end
end
return AccelTween
|
-- Set up the event handler for the GClippsly button
|
gClippslyButton.MouseButton1Click:Connect(toggleWindow)
|
--Tune
|
OverheatSpeed = 0.2 --How fast the car will overheat
CoolingEfficiency = 0.05 --How fast the car will cool down
RunningTemp = 82 --In degrees
Fan = true --Cooling fan
FanTemp = 93 --At what temperature the cooling fan will activate
FanSpeed = .05
FanVolume = .25
BlowupTemp = 140 --At what temperature the engine will blow up
GUI = true --GUI temperature gauge
|
----- MAGIC NUMBERS ABOUT THE TOOL -----
-- How much damage a bullet does
|
local Damage = 1000
|
--- Returns a unique array of all registered commands (not including aliases)
|
function Registry:GetCommands ()
return self.CommandsArray
end
|
-- Variables for the zombie, its humanoid, and destination
|
local zombie = hroot
local destination = nil
|
--[[Controls]]
|
local _CTRL = _Tune.Controls
local Controls = Instance.new("Folder",script.Parent)
Controls.Name = "Controls"
for i,v in pairs(_CTRL) do
local a=Instance.new("StringValue",Controls)
a.Name=i
a.Value=v.Name
a.Changed:connect(function()
if i=="MouseThrottle" or i=="MouseBrake" then
if a.Value == "MouseButton1" or a.Value == "MouseButton2" then
_CTRL[i]=Enum.UserInputType[a.Value]
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
end)
end
|
--[[
The golden hit detection script! For experimental mode, mainly.
Rather than detect superball and slingshot hits by having the
ball look for a player in any object it touches, this script
makes the player check if any object it touches is a ball or
slingshot projectile. It works better because it has all your
body parts (about 6 or 7 parts for R6, many more for R15)
checking for hits, rather than just one part!
--]]
|
local ds2=true
local dp2=true
function dmg(Part)
script.Parent.Humanoid:TakeDamage(Part.damage.Value)
script.Parent.Humanoid.Died:connect(function()
if not script.Parent.Humanoid:FindFirstChild("creator") then
if Part:FindFirstChild("creator") then
if Part:WaitForChild("creator",1).Value:FindFirstChild("leaderstats") then
Part:WaitForChild("creator",1):Clone().Parent=script.Parent.Humanoid
end
end
end
end)
end
script.Parent:WaitForChild("Humanoid",1).Touched:connect(function(Part,Limb)
local player=game.Players:GetPlayerFromCharacter(script.Parent)
if Part.Name=="Cannon Shot" then
if ds2==true then
ds2=false
if Part:WaitForChild("creator",1).Value~=player then
if script.Parent.Humanoid.Health~=0 then
if player:WaitForChild("AntiTeamKill",1).Value==true then
if player.TeamColor~=Part:WaitForChild("creator",1).Value.TeamColor then
dmg(Part)
end
else
dmg(Part)
end
end
end
wait(1/30)
ds2=true
end
elseif Part.Name=="Pellet" then
if dp2==true then
ds2=false
if Part:WaitForChild("creator",1).Value~=player then
if script.Parent.Humanoid.Health~=0 then
if player:WaitForChild("AntiTeamKill",1).Value==true then
if player.TeamColor~=Part:WaitForChild("creator",1).Value.TeamColor then
dmg(Part)
end
else
dmg(Part)
end
end
end
wait(.2)
ds2=true
end
end
end)
|
--[[
Sets up event listeners and modifies emote configurations for the user
given
Parameters:
player - The player to set up for
humanoidDescription - The HumanoidDecription of the user to set up for
]]
|
function EmoteManager:setup(player, humanoidDescription)
-- Send default emotes to the player
self:updateEmotes(player, humanoidDescription)
if not self.playerOwnedEmotes[player.UserId] then
self:getOwnedEmotesAsync(player, function(ownedEmotes)
-- Send paid emotes that the player owns to the player
self.playerOwnedEmotes[player.UserId] = ownedEmotes
self:updateEmotes(player, humanoidDescription)
self.updatedPlayerEmotes:Fire(player.UserId)
end)
end
end
|
--// If this module returns a ScreenGui object, the script will use that as the gui and
--// take care of registering and running the code module n all that.
--// RETURNED SCREENGUI MUST CONTAIN A "Config" FOLDER;
--// If no Code module is given the default code module will be used.
| |
--edit the below function to execute code when this response is chosen OR this prompt is shown
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local ClassInformationTable = require(game.ReplicatedStorage.Source.Modules.CharacterScripts.Classes.ClassInformation)
ClassInformationTable:GetClassFolder(player,"Brawler").GuardBreak.Value = true
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
plrData.Money.Gold.Value = plrData.Money.Gold.Value - 45 -- TODO track for dissertation
end
|
--Automatic Gauge Scaling
|
if autoscaling then
local Drive={}
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("FL")~= nil then
table.insert(Drive,car.Wheels.FL)
end
if car.Wheels:FindFirstChild("FR")~= nil then
table.insert(Drive,car.Wheels.FR)
end
if car.Wheels:FindFirstChild("F")~= nil then
table.insert(Drive,car.Wheels.F)
end
end
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("RL")~= nil then
table.insert(Drive,car.Wheels.RL)
end
if car.Wheels:FindFirstChild("RR")~= nil then
table.insert(Drive,car.Wheels.RR)
end
if car.Wheels:FindFirstChild("R")~= nil then
table.insert(Drive,car.Wheels.R)
end
end
local wDia = 0
for i,v in pairs(Drive) do
if v.Size.x>wDia then wDia = v.Size.x end
end
Drive = nil
for i,v in pairs(UNITS) do
v.maxSpeed = math.ceil(v.scaling*wDia*math.pi*_lRPM/60/_Tune.Ratios[#_Tune.Ratios]/_Tune.FinalDrive)
v.spInc = math.max(math.ceil(v.maxSpeed/200)*20,20)
end
end
for i=0,revEnd*2 do
local ln = script.Parent.ln:clone()
ln.Parent = script.Parent.Tach
ln.Rotation = 45 + i * 225 / (revEnd*2)
ln.Num.Text = i/2
ln.Num.Rotation = -ln.Rotation
if i*500>=math.floor(_pRPM/500)*500 then
ln.Frame.BackgroundColor3 = Color3.new(1,0,0)
if i<revEnd*2 then
ln2 = ln:clone()
ln2.Parent = script.Parent.Tach
ln2.Rotation = 45 + (i+.5) * 225 / (revEnd*2)
ln2.Num:Destroy()
ln2.Visible=true
end
end
if i%2==0 then
ln.Frame.Size = UDim2.new(0,3,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
ln.Num.Visible = true
else
ln.Num:Destroy()
end
ln.Visible=true
end
local lns = Instance.new("Frame",script.Parent.Speedo)
lns.Name = "lns"
lns.BackgroundTransparency = 1
lns.BorderSizePixel = 0
lns.Size = UDim2.new(0,0,0,0)
for i=1,90 do
local ln = script.Parent.ln:clone()
ln.Parent = lns
ln.Rotation = 45 + 225*(i/90)
if i%2==0 then
ln.Frame.Size = UDim2.new(0,2,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
else
ln.Frame.Size = UDim2.new(0,3,0,5)
end
ln.Num:Destroy()
ln.Visible=true
end
for i,v in pairs(UNITS) do
local lnn = Instance.new("Frame",script.Parent.Speedo)
lnn.BackgroundTransparency = 1
lnn.BorderSizePixel = 0
lnn.Size = UDim2.new(0,0,0,0)
lnn.Name = v.units
if i~= 1 then lnn.Visible=false end
for i=0,v.maxSpeed,v.spInc do
local ln = script.Parent.ln:clone()
ln.Parent = lnn
ln.Rotation = 45 + 225*(i/v.maxSpeed)
ln.Num.Text = i
ln.Num.TextSize = 14
ln.Num.Rotation = -ln.Rotation
ln.Frame:Destroy()
ln.Num.Visible=true
ln.Visible=true
end
end
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
script.Parent.Parent.IsOn.Changed:connect(function()
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
script.Parent.Parent.Values.RPM.Changed:connect(function()
script.Parent.Tach.Needle.Rotation = 45 + 225 * math.min(1,script.Parent.Parent.Values.RPM.Value / (revEnd*1000))
end)
script.Parent.Parent.Values.Gear.Changed:connect(function()
local gearText = script.Parent.Parent.Values.Gear.Value
if gearText == 0 then gearText = "N"
elseif gearText == -1 then gearText = "R"
end
script.Parent.Gear.Text = gearText
end)
script.Parent.Parent.Values.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCS.Value then
script.Parent.TCS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.TCSActive.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = true
script.Parent.TCS.TextColor3 = Color3.new(1,0,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.Parent.Values.TCSActive.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
end
else
if script.Parent.TCS.Visible then
script.Parent.TCS.Visible = false
end
end
end)
script.Parent.Parent.Values.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABS.Value then
script.Parent.ABS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.ABSActive.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = true
script.Parent.ABS.TextColor3 = Color3.new(1,0,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.Parent.Values.ABSActive.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
end
else
if script.Parent.ABS.Visible then
script.Parent.ABS.Visible = false
end
end
end)
function PBrake()
script.Parent.PBrake.Visible = script.Parent.Parent.Values.PBrake.Value
end
script.Parent.Parent.Values.PBrake.Changed:connect(PBrake)
function Gear()
if script.Parent.Parent.Values.TransmissionMode.Value == "Auto" then
script.Parent.TMode.Text = "A/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(1,170/255,0)
elseif script.Parent.Parent.Values.TransmissionMode.Value == "Semi" then
script.Parent.TMode.Text = "S/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(0, 170/255, 127/255)
else
script.Parent.TMode.Text = "M/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(1,85/255,.5)
end
end
script.Parent.Parent.Values.TransmissionMode.Changed:connect(Gear)
script.Parent.Parent.Values.Velocity.Changed:connect(function(property)
script.Parent.Speedo.Needle.Rotation =45 + 225 * math.min(1,UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude/UNITS[currentUnits].maxSpeed)
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
script.Parent.Speed.MouseButton1Click:connect(function()
if currentUnits==#UNITS then
currentUnits = 1
else
currentUnits = currentUnits+1
end
for i,v in pairs(script.Parent.Speedo:GetChildren()) do
v.Visible=v.Name==UNITS[currentUnits].units or v.Name=="Needle" or v.Name=="lns"
end
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
wait(.1)
Gear()
PBrake()
|
-- medical station containing NOTHING because we DON'T LIKE GRUNTS that ARE INJURED.
|
local pivot = script.Parent.Pivot
local TS = game:GetService("TweenService")
local deb = false
local CD = Instance.new("ClickDetector",script.Parent.Door)
CD.MaxActivationDistance = 4
local toggle = false
CD.MouseClick:Connect(function()
if not deb then
deb = true
local anim
if not toggle then
anim = TS:Create(pivot,TweenInfo.new(.6,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0),{CFrame = pivot.CFrame * CFrame.Angles(math.rad(140),0,0)})
else
anim = TS:Create(pivot,TweenInfo.new(.6,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0),{CFrame = pivot.CFrame * CFrame.Angles(-math.rad(140),0,0)})
end
anim.Completed:Connect(function()
toggle = not toggle
deb = false
end)
anim:Play()
end
end)
|
-- DISGUSTING. NEVER DO THIS.
|
function nearPlayer()
local p = game.Players:GetPlayers()
for i=1,#p do
if (p[i].Character) then
local t = p[i].Character:FindFirstChild("Torso")
if t then
if (Board.Position - t.Position).magnitude < 20 then
return true
end
end
end
end
return false
end
function sepuku() -- +1
if not nearPlayer() then
if Board.Parent and Board.Parent.Name=="Snowboard" then
Board.Parent:remove()
else
Board:remove()
end
end
end
while true do
wait(30)
sepuku()
end
|
-- Moment of Inertia of any rectangular prism.
-- 1/12 * m * sum(deminsionlengths^2)
|
local function MomentOfInertia(Part, Axis, Origin)
--- Calculates the moment of inertia of a cuboid.
-- Part is part
-- Axis is the axis
-- Origin is the origin of the axis
local PartSize = Part.Size
local Mass = Part:GetMass()
local Radius = (Part.Position - Origin):Cross(Axis)
local r2 = Radius:Dot(Radius)
local ip = Mass * r2--Inertia based on Position
local s2 = PartSize*PartSize
local sa = (Part.CFrame-Part.Position):inverse()*Axis
local id = (Vector3.new(s2.y+s2.z, s2.z+s2.x, s2.x+s2.y)):Dot(sa*sa)*Mass/12 -- Inertia based on Direction
return ip+id
end
local function BodyMomentOfInertia(Parts, Axis, Origin)
--- Given a connected body of parts, returns the moment of inertia of these parts
-- @param Parts The parts to use
-- @param Axis the axis to use (Should be torque, or offset cross force)
-- @param Origin The origin of the axis (should be center of mass of the parts)
local TotalBodyInertia = 0
for _, Part in pairs(Parts) do
TotalBodyInertia = TotalBodyInertia + MomentOfInertia(Part, Axis, Origin)
end
return TotalBodyInertia
end
local function GetBackVector(CFrameValue)
--- Get's the back vector of a CFrame Value
-- @param CFrameValue A CFrame, of which the vector will be retrieved
-- @return The back vector of the CFrame
local _,_,_,_,_,r6,_,_,r9,_,_,r12 = CFrameValue:components()
return Vector3.new(r6,r9,r12)
end
local function GetCFrameFromTopBack(CFrameAt, Top, Back)
--- Get's the CFrame fromt he "top back" vector. or something
local Right = Top:Cross(Back) -- Get's the "right" cframe lookvector.
return CFrame.new(CFrameAt.x, CFrameAt.y, CFrameAt.z,
Right.x, Top.x, Back.x,
Right.y, Top.y, Back.y,
Right.z, Top.z, Back.z
)
end
local function GetRotationInXZPlane(CFrameValue)
--- Get's the rotation in the XZ plane (global).
local Back = GetBackVector(CFrameValue)
return GetCFrameFromTopBack(CFrameValue.p,
Vector3.new(0,1,0), -- Top lookVector (straight up)
Vector3.new(Back.x, 0, Back.z).unit -- Right facing direction (removed Y axis.)
)
end
local function Sign(Number)
-- Return's the mathetmatical sign of an object
if Number == 0 then
return 0
elseif Number > 0 then
return 1
else
return -1
end
end
local EasyConfiguration = require(WaitForChild(script, "EasyConfiguration"))
|
--s.Pitch = 0.7
--s.Pitch = 0.7
|
while true do
while s.Pitch<0.67 do
s.Pitch=s.Pitch+0.010
s:Play()
if s.Pitch>0.67 then
s.Pitch=0.67
end
wait(0.001)
end
|
--use this to determine if you want this human to be harmed or not, returns boolean
|
function boom()
wait(2)
Used = true
Object.Anchored = true
Object.CanCollide = false
Object.Sparks.Enabled = false
Object.Orientation = Vector3.new(0,0,0)
Object.Transparency = 1
Object.Fuse:Stop()
Object.Explode:Play()
Object.Dist1:Play()
Object.Dist2:Play()
Object.Explosion:Emit(100)
Object.Smoke1:Emit(150)
Object.Smoke2:Emit(150)
Object.Smoke3:Emit(150)
Object.Smoke4:Emit(50)
Object.Debris:Emit(1000)
Object.Debris2:Emit(1000)
Object.Shockwave:Emit(5)
Explode()
end
boom()
|
--Gas.InputChanged:Connect(TouchThrottle)
|
local function TouchBrake(input, GPE)
if input.UserInputState == Enum.UserInputState.Begin then
_GBrake = 1
else
_GBrake = 0
end
end
Brake.InputBegan:Connect(TouchBrake)
Brake.InputEnded:Connect(TouchBrake)
|
----------------------------------
------------FUNCTIONS-------------
----------------------------------
|
function UnDigify(digit)
if digit < 1 or digit > 61 then
return ""
elseif digit == 1 then
return "1"
elseif digit == 2 then
return "!"
elseif digit == 3 then
return "2"
elseif digit == 4 then
return "@"
elseif digit == 5 then
return "3"
elseif digit == 6 then
return "4"
elseif digit == 7 then
return "$"
elseif digit == 8 then
return "5"
elseif digit == 9 then
return "%"
elseif digit == 10 then
return "6"
elseif digit == 11 then
return "^"
elseif digit == 12 then
return "7"
elseif digit == 13 then
return "8"
elseif digit == 14 then
return "*"
elseif digit == 15 then
return "9"
elseif digit == 16 then
return "("
elseif digit == 17 then
return "0"
elseif digit == 18 then
return "q"
elseif digit == 19 then
return "Q"
elseif digit == 20 then
return "w"
elseif digit == 21 then
return "W"
elseif digit == 22 then
return "e"
elseif digit == 23 then
return "E"
elseif digit == 24 then
return "r"
elseif digit == 25 then
return "t"
elseif digit == 26 then
return "T"
elseif digit == 27 then
return "y"
elseif digit == 28 then
return "Y"
elseif digit == 29 then
return "u"
elseif digit == 30 then
return "i"
elseif digit == 31 then
return "I"
elseif digit == 32 then
return "o"
elseif digit == 33 then
return "O"
elseif digit == 34 then
return "p"
elseif digit == 35 then
return "P"
elseif digit == 36 then
return "a"
elseif digit == 37 then
return "s"
elseif digit == 38 then
return "S"
elseif digit == 39 then
return "d"
elseif digit == 40 then
return "D"
elseif digit == 41 then
return "f"
elseif digit == 42 then
return "g"
elseif digit == 43 then
return "G"
elseif digit == 44 then
return "h"
elseif digit == 45 then
return "H"
elseif digit == 46 then
return "j"
elseif digit == 47 then
return "J"
elseif digit == 48 then
return "k"
elseif digit == 49 then
return "l"
elseif digit == 50 then
return "L"
elseif digit == 51 then
return "z"
elseif digit == 52 then
return "Z"
elseif digit == 53 then
return "x"
elseif digit == 54 then
return "c"
elseif digit == 55 then
return "C"
elseif digit == 56 then
return "v"
elseif digit == 57 then
return "V"
elseif digit == 58 then
return "b"
elseif digit == 59 then
return "B"
elseif digit == 60 then
return "n"
elseif digit == 61 then
return "m"
else
return "?"
end
end
function IsBlack(note)
if note%12 == 2 or note%12 == 4 or note%12 == 7 or note%12 == 9 or note%12 == 11 then
return true
end
end
local TweenService = game:GetService("TweenService")
function fade(cln,t)
local Goal = {}
Goal.Transparency = 1
local TwInfo = TweenInfo.new(t)
local Tween = TweenService:Create(cln, TwInfo, Goal)
Tween:Play()
Tween.Completed:wait()
return
end
function clone(key,sharp)
if sharp then
local cln = key:Clone()
cln.Material = "Neon" --You can change / remove the neon if you want
cln.Color = Color3.fromRGB(70,70,70) --along with the color
cln.Anchored = true
cln.Parent = key
cln.Position = key.Position
cln.CanCollide = false
for i,v in pairs(cln:GetChildren()) do
if v and v:IsA("MeshPart") then
v:Destroy()
end
end
local light = Instance.new("PointLight",cln)
light.Brightness = 2
light.Range = 5
light.Color = Color3.fromRGB(120, 120, 120)
local Goal = {}
Goal.Position = Vector3.new(cln.Position.x,cln.Position.y + 5,cln.Position.z)
local TwInfo = TweenInfo.new(1,Enum.EasingStyle.Linear)
local Tween = TweenService:Create(cln, TwInfo, Goal)
coroutine.resume(coroutine.create(fade),cln,1)
Tween:Play()
Tween.Completed:wait()
local l = cln:FindFirstChildOfClass("PointLight")
if l then
l:Destroy()
end
if cln.Transparency ~= 1 then cln.Transparency = 1 end
cln:Destroy()
else
local cln = key:Clone()
cln.Material = "Neon" --You can change / remove the neon if you want
cln.Color = Color3.fromRGB(255,255,255) --along with the color
cln.Anchored = true
cln.Parent = key
cln.Position = key.Position
cln.CanCollide = false
for i,v in pairs(cln:GetChildren()) do
if v and v:IsA("MeshPart") then
v:Destroy()
end
end
local light = Instance.new("PointLight",cln)
light.Brightness = 2
light.Range = 5
light.Color = Color3.fromRGB(120, 120, 120)
local Goal = {}
Goal.Position = Vector3.new(cln.Position.x,cln.Position.y + 5,cln.Position.z)
local TwInfo = TweenInfo.new(1,Enum.EasingStyle.Linear)
local Tween = TweenService:Create(cln, TwInfo, Goal)
coroutine.resume(coroutine.create(fade),cln,1)
Tween:Play()
Tween.Completed:wait()
local l = cln:FindFirstChildOfClass("PointLight")
if l then
l:Destroy()
end
if cln.Transparency ~= 1 then cln.Transparency = 1 end
cln:Destroy()
end
return
end
function HighlightPianoKey(note1,transpose)
if not Settings.KeyAesthetics then return end
local octave = math.ceil(note1/12)
local note2 = (note1 - 1)%12 + 1
local key = Keys[octave][note2]
key.Material = "Neon"
if IsBlack(note1) then
key.Color = Color3.fromRGB(70,70,70)
coroutine.resume(coroutine.create(clone),key,true)
wait(.2)
key.Color = Color3.fromRGB(10,10,10)
key.Material = "SmoothPlastic"
else
coroutine.resume(coroutine.create(clone),key,false)
wait(.2)
key.Material = "SmoothPlastic"
end
return
end
|
--------------------[ GUI UPDATE FUNCTIONS ]------------------------------------------
|
local function updateClipAmmo()
clipAmmoGUI.Text = Ammo.Value
clipAmmoGUI.TextColor3 = (Ammo.Value <= (ClipSize.Value / 3) and Color3.new(1, 0, 0) or Color3.new(1, 1, 1))
end
local function updateStoredAmmo()
storedAmmoGUI.Text = StoredAmmo.Value
storedAmmoGUI.TextColor3 = (StoredAmmo.Value <= (ClipSize.Value * 2) and Color3.new(1, 0, 0) or Color3.new(1, 1, 1))
end
local function updateHealth()
HUD.Health.Num.Text = CEIL(Humanoid.Health).."%"
HUD.Health.Num.TextColor3 = (
(Humanoid.Health > 200 / 3) and Color3.new(1, 1, 1) or
(Humanoid.Health <= 200 / 3 and Humanoid.Health > 100 / 3) and Color3.new(1, 1, 0) or
(Humanoid.Health <= 100 / 3) and Color3.new(1, 0, 0)
)
end
local function updateModeLabels(prevState, newState, X)
for Num, Mode in pairs(fireModes:GetChildren()) do
local guiAngOffset2 = guiAngOffset + 90
local Ang = numLerp(
(guiAngOffset2 * prevState) - (guiAngOffset2 * Num) - guiAngOffset2,
(guiAngOffset2 * newState) - (guiAngOffset2 * Num) - guiAngOffset2,
Sine(X)
) + guiAngOffset
local XPos = COS(RAD(Ang))
local YPos = SIN(RAD(Ang))
Mode.Position = UDim2.new(0.5, XPos * 100, 0.5, YPos * 100)
local R = COS(math.atan2(Mode.Position.Y.Offset, Mode.Position.X.Offset) + RAD(90))
Mode.Label.TextTransparency = 1 - ((R / 4) + 0.75)
local Scale = (R * 10) + 50
Mode.Label.Position = UDim2.new(0, -Scale / 2, 0, 0)
Mode.Label.Size = UDim2.new(0, Scale, 0, Scale / 2)
end
end
|
-- Set Pet Canvas Size --
|
module.SetCanvasSize = function(ScrollingFrame)
local PADDING,SIZE,MaxCells = getSizes()
local UIGridLayout = ScrollingFrame.UIGridLayout
local AbsoluteSize = ScrollingFrame.AbsoluteSize
local NewPadding = PADDING * AbsoluteSize
NewPadding = UDim2.new(0, NewPadding .X, 0, NewPadding .Y)
local NewSize = SIZE * AbsoluteSize
NewSize = UDim2.new(0, NewSize.X, 0, NewSize.Y)
UIGridLayout.CellPadding = NewPadding
UIGridLayout.CellSize = NewSize
local items = getItems(ScrollingFrame) --ScrollingFrame:GetChildren()
local frameSizeY = ScrollingFrame.AbsoluteSize.Y
local ySize = UIGridLayout.CellSize.Y.Offset
local yPadding = UIGridLayout.CellPadding.Y.Offset
UIGridLayout.FillDirectionMaxCells = MaxCells
local rows = math.ceil((items-1)/UIGridLayout.FillDirectionMaxCells)
local pixels = rows*ySize + (rows-1)*yPadding
ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, (pixels + 5))
end
local main = script.Parent.Parent.Parent.Parent.Parent:WaitForChild("main")
local weaponShopUI = main.WeaponShop
function module:Int()
game:GetService("Workspace").CurrentCamera:GetPropertyChangedSignal("ViewportSize"):Connect(function()
delay(.5, function()
module.SetCanvasSize(weaponShopUI.Storage.Swords)
module.SetCanvasSize(weaponShopUI.Storage.Robot)
module.SetCanvasSize(weaponShopUI.Storage.Storage)
end)
end)
end
return module
|
-- Customizable variables
|
local TWEEN_TIME = .7 -- Time for the animation
local TWEEN_MOVE_DISTANCE = 1 -- Distance to move
|
--[[Transmission]]
|
Tune.TransModes = {"Auto", "Semi"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "Speed" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 2.93 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3.460 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 5.00 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 3.20 ,
--[[ 3 ]] 2.14 ,
--[[ 4 ]] 1.72 ,
--[[ 5 ]] 1.31 ,
--[[ 6 ]] 1.00 ,
--[[ 7 ]] 0.82 ,
--[[ 8 ]] 0.64 ,
}
Tune.FDMult = 2 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
--print("JeepScript: connecting events...")
|
seat.ChildAdded:connect(seatChildAddedHandler)
seat.ChildRemoved:connect(seatChildRemovedHandler)
seat.Changed:connect(seatChangedHandler)
|
--// Event for making player say chat message.
|
function chatBarFocusLost(enterPressed, inputObject)
DoBackgroundFadeIn()
chatBarFocusChanged:Fire(false)
if (enterPressed) then
local message = ChatBar:GetTextBox().Text
if ChatBar:IsInCustomState() then
local customMessage = ChatBar:GetCustomMessage()
if customMessage then
message = customMessage
end
local messageSunk = ChatBar:CustomStateProcessCompletedMessage(message)
ChatBar:ResetCustomState()
if messageSunk then
return
end
end
if not FFlagUserChatNewMessageLengthCheck2 then
message = string.sub(message, 1, ChatSettings.MaximumMessageLength)
end
ChatBar:GetTextBox().Text = ""
if message ~= "" then
--// Sends signal to eventually call Player:Chat() to handle C++ side legacy stuff.
moduleApiTable.MessagePosted:fire(message)
if not CommandProcessor:ProcessCompletedChatMessage(message, ChatWindow) then
if ChatSettings.DisallowedWhiteSpace then
for i = 1, #ChatSettings.DisallowedWhiteSpace do
if ChatSettings.DisallowedWhiteSpace[i] == "\t" then
message = string.gsub(message, ChatSettings.DisallowedWhiteSpace[i], " ")
else
message = string.gsub(message, ChatSettings.DisallowedWhiteSpace[i], "")
end
end
end
message = string.gsub(message, "\n", "")
message = string.gsub(message, "[ ]+", " ")
local targetChannel = ChatWindow:GetTargetMessageChannel()
if targetChannel then
MessageSender:SendMessage(message, targetChannel)
else
MessageSender:SendMessage(message, nil)
end
end
end
end
end
local ChatBarConnections = {}
function setupChatBarConnections()
for i = 1, #ChatBarConnections do
ChatBarConnections[i]:Disconnect()
end
ChatBarConnections = {}
local focusLostConnection = ChatBar:GetTextBox().FocusLost:connect(chatBarFocusLost)
table.insert(ChatBarConnections, focusLostConnection)
local focusGainedConnection = ChatBar:GetTextBox().Focused:connect(chatBarFocused)
table.insert(ChatBarConnections, focusGainedConnection)
end
setupChatBarConnections()
ChatBar.GuiObjectsChanged:connect(setupChatBarConnections)
function getEchoMessagesInGeneral()
if ChatSettings.EchoMessagesInGeneralChannel == nil then
return true
end
return ChatSettings.EchoMessagesInGeneralChannel
end
EventFolder.OnMessageDoneFiltering.OnClientEvent:connect(function(messageData)
if not ChatSettings.ShowUserOwnFilteredMessage then
if messageData.FromSpeaker == LocalPlayer.Name then
return
end
end
local channelName = messageData.OriginalChannel
local channelObj = ChatWindow:GetChannel(channelName)
if channelObj then
channelObj:UpdateMessageFiltered(messageData)
end
if getEchoMessagesInGeneral() and ChatSettings.GeneralChannelName and channelName ~= ChatSettings.GeneralChannelName then
local generalChannel = ChatWindow:GetChannel(ChatSettings.GeneralChannelName)
if generalChannel then
generalChannel:UpdateMessageFiltered(messageData)
end
end
end)
EventFolder.OnNewMessage.OnClientEvent:connect(function(messageData, channelName)
local channelObj = ChatWindow:GetChannel(channelName)
if (channelObj) then
channelObj:AddMessageToChannel(messageData)
if (messageData.FromSpeaker ~= LocalPlayer.Name) then
ChannelsBar:UpdateMessagePostedInChannel(channelName)
end
if getEchoMessagesInGeneral() and ChatSettings.GeneralChannelName and channelName ~= ChatSettings.GeneralChannelName then
local generalChannel = ChatWindow:GetChannel(ChatSettings.GeneralChannelName)
if generalChannel then
generalChannel:AddMessageToChannel(messageData)
end
end
moduleApiTable.MessageCount = moduleApiTable.MessageCount + 1
moduleApiTable.MessagesChanged:fire(moduleApiTable.MessageCount)
DoFadeInFromNewInformation()
end
end)
EventFolder.OnNewSystemMessage.OnClientEvent:connect(function(messageData, channelName)
channelName = channelName or "System"
local channelObj = ChatWindow:GetChannel(channelName)
if (channelObj) then
channelObj:AddMessageToChannel(messageData)
ChannelsBar:UpdateMessagePostedInChannel(channelName)
moduleApiTable.MessageCount = moduleApiTable.MessageCount + 1
moduleApiTable.MessagesChanged:fire(moduleApiTable.MessageCount)
DoFadeInFromNewInformation()
if getEchoMessagesInGeneral() and ChatSettings.GeneralChannelName and channelName ~= ChatSettings.GeneralChannelName then
local generalChannel = ChatWindow:GetChannel(ChatSettings.GeneralChannelName)
if generalChannel then
generalChannel:AddMessageToChannel(messageData)
end
end
else
warn(string.format("Just received system message for channel I'm not in [%s]", channelName))
end
end)
function HandleChannelJoined(channel, welcomeMessage, messageLog, channelNameColor, addHistoryToGeneralChannel,
addWelcomeMessageToGeneralChannel)
if ChatWindow:GetChannel(channel) then
--- If the channel has already been added, remove it first.
ChatWindow:RemoveChannel(channel)
end
if (channel == ChatSettings.GeneralChannelName) then
DidFirstChannelsLoads = true
end
if channelNameColor then
ChatBar:SetChannelNameColor(channel, channelNameColor)
end
local channelObj = ChatWindow:AddChannel(channel)
if (channelObj) then
if (channel == ChatSettings.GeneralChannelName) then
DoSwitchCurrentChannel(channel)
end
if (messageLog) then
local startIndex = 1
if #messageLog > ChatSettings.MessageHistoryLengthPerChannel then
startIndex = #messageLog - ChatSettings.MessageHistoryLengthPerChannel
end
for i = startIndex, #messageLog do
channelObj:AddMessageToChannel(messageLog[i])
end
if getEchoMessagesInGeneral() and addHistoryToGeneralChannel then
if ChatSettings.GeneralChannelName and channel ~= ChatSettings.GeneralChannelName then
local generalChannel = ChatWindow:GetChannel(ChatSettings.GeneralChannelName)
if generalChannel then
generalChannel:AddMessagesToChannelByTimeStamp(messageLog, startIndex)
end
end
end
end
if (welcomeMessage ~= "") then
local welcomeMessageObject = {
ID = -1,
FromSpeaker = nil,
SpeakerUserId = 0,
OriginalChannel = channel,
IsFiltered = true,
MessageLength = string.len(welcomeMessage),
Message = trimTrailingSpaces(welcomeMessage),
MessageType = ChatConstants.MessageTypeWelcome,
Time = os.time(),
ExtraData = nil,
}
channelObj:AddMessageToChannel(welcomeMessageObject)
if getEchoMessagesInGeneral() and addWelcomeMessageToGeneralChannel and not ChatSettings.ShowChannelsBar then
if channel ~= ChatSettings.GeneralChannelName then
local generalChannel = ChatWindow:GetChannel(ChatSettings.GeneralChannelName)
if generalChannel then
generalChannel:AddMessageToChannel(welcomeMessageObject)
end
end
end
end
DoFadeInFromNewInformation()
end
end
EventFolder.OnChannelJoined.OnClientEvent:connect(function(channel, welcomeMessage, messageLog, channelNameColor)
HandleChannelJoined(channel, welcomeMessage, messageLog, channelNameColor, false, true)
end)
EventFolder.OnChannelLeft.OnClientEvent:connect(function(channel)
ChatWindow:RemoveChannel(channel)
DoFadeInFromNewInformation()
end)
EventFolder.OnMuted.OnClientEvent:connect(function(channel)
--// Do something eventually maybe?
--// This used to take away the chat bar in channels the player was muted in.
--// We found out this behavior was inconvenient for doing chat commands though.
end)
EventFolder.OnUnmuted.OnClientEvent:connect(function(channel)
--// Same as above.
end)
EventFolder.OnMainChannelSet.OnClientEvent:connect(function(channel)
DoSwitchCurrentChannel(channel)
end)
coroutine.wrap(function()
-- ChannelNameColorUpdated may not exist if the client version is older than the server version.
local ChannelNameColorUpdated = DefaultChatSystemChatEvents:WaitForChild("ChannelNameColorUpdated", 5)
if ChannelNameColorUpdated then
ChannelNameColorUpdated.OnClientEvent:connect(function(channelName, channelNameColor)
ChatBar:SetChannelNameColor(channelName, channelNameColor)
end)
end
end)()
|
--game.Lighting:WaitForChild("Blur").Enabled = true
--game.Lighting.ColorCorrection.Enabled = true
|
local contenProvider = game:GetService("ContentProvider")
game.Loaded:Wait()
local toLoad = workspace:GetDescendants()
local total = #toLoad
for i,v in pairs(toLoad) do
loadingScreen.Background.Counter.Text = "Loading: " .. i .. "/" .. total .. " " .. v.Name
contenProvider:PreloadAsync({v})
end
|
--[=[
@param object any -- Object to track
@param cleanupMethod string? -- Optional cleanup name override
@return object: any
Adds an object to the trove. Once the trove is cleaned or
destroyed, the object will also be cleaned up.
The object must be any of the following:
- Roblox instance (e.g. Part)
- RBXScriptConnection (e.g. `workspace.ChildAdded:Connect(function() end)`)
- Function
- Table with either a `Destroy` or `Disconnect` method
- Table with custom `cleanupMethod` name provided
Returns the object added.
```lua
-- Add a part to the trove, then destroy the trove,
-- which will also destroy the part:
local part = Instance.new("Part")
trove:Add(part)
trove:Destroy()
-- Add a function to the trove:
trove:Add(function()
print("Cleanup!")
end)
trove:Destroy()
-- Standard cleanup from table:
local tbl = {}
function tbl:Destroy()
print("Cleanup")
end
trove:Add(tbl)
-- Custom cleanup from table:
local tbl = {}
function tbl:DoSomething()
print("Do something on cleanup")
end
trove:Add(tbl, "DoSomething")
```
]=]
|
function Trove:Add(object: any, cleanupMethod: string?): any
local cleanup = GetObjectCleanupFunction(object, cleanupMethod)
table.insert(self._objects, {object, cleanup})
return object
end
|
--[[
Creates a new promise that receives the result of this promise.
The given callbacks are invoked depending on that result.
]]
|
function Promise.prototype:_andThen(traceback, successHandler, failureHandler)
self._unhandledRejection = false
-- Create a new promise to follow this part of the chain
return Promise._new(traceback, function(resolve, reject)
-- Our default callbacks just pass values onto the next promise.
-- This lets success and failure cascade correctly!
local successCallback = resolve
if successHandler then
successCallback = createAdvancer(traceback, successHandler, resolve, reject)
end
local failureCallback = reject
if failureHandler then
failureCallback = createAdvancer(traceback, failureHandler, resolve, reject)
end
if self._status == Promise.Status.Started then
-- If we haven't resolved yet, put ourselves into the queue
table.insert(self._queuedResolve, successCallback)
table.insert(self._queuedReject, failureCallback)
elseif self._status == Promise.Status.Resolved then
-- This promise has already resolved! Trigger success immediately.
successCallback(unpack(self._values, 1, self._valuesLength))
elseif self._status == Promise.Status.Rejected then
-- This promise died a terrible death! Trigger failure immediately.
failureCallback(unpack(self._values, 1, self._valuesLength))
elseif self._status == Promise.Status.Cancelled then
-- We don't want to call the success handler or the failure handler,
-- we just reject this promise outright.
reject(Error.new({
error = "Promise is cancelled",
kind = Error.Kind.AlreadyCancelled,
context = "Promise created at\n\n" .. traceback,
}))
end
end, self)
end
|
--Supercharger
|
local Whine_Pitch = 1.4 --max pitch of the whine (not exact so might have to mess with it)
|
--[[
Controller for the sounds of the vehicle
]]
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local Debris = game:GetService("Debris")
local SoundsFolder = ReplicatedStorage:FindFirstChild("SFX")
local CarSoundsFolder = SoundsFolder:FindFirstChild("Car")
local VehicleSoundComponent = {}
local tweenInfo = TweenInfo.new(0.6)
|
-- Libraries
|
local Libraries = Tool:WaitForChild 'Libraries'
local Signal = require(Libraries:WaitForChild 'Signal')
History = {
-- Record stack
Stack = {},
-- Current position in record stack
Index = 0,
-- History change event
Changed = Signal.new()
};
function History.Undo()
-- Unapplies the previous record in stack
-- Stay within boundaries
if History.Index - 1 < 0 then
return;
end;
-- Get the history record, unapply it
local Record = History.Stack[History.Index];
Record:Unapply();
-- Update the index
History.Index = History.Index - 1;
-- Fire the Changed event
History.Changed:Fire();
end;
function History.Redo()
-- Applies the next record in stack
-- Stay within boundaries
if History.Index + 1 > #History.Stack then
return;
end;
-- Update the index
History.Index = History.Index + 1;
-- Get the history record and apply it
local Record = History.Stack[History.Index];
Record:Apply();
-- Fire the Changed event
History.Changed:Fire();
end;
function History.Add(Record)
-- Adds new history record to stack
-- Update the index
History.Index = History.Index + 1;
-- Register the new history record
History.Stack[History.Index] = Record;
-- Clear history ahead
for Index = History.Index + 1, #History.Stack do
History.Stack[Index] = nil;
end;
-- Fire the Changed event
History.Changed:Fire();
end;
return History;
|
-- other code
|
local bgm = handle.SONG
tool.Equipped:Connect(function()
bgm:Play()
-- other code
end)
tool.Unequipped:Connect(function()
bgm:Stop()
-- other code
end)
|
--Player related
|
local Camera = Workspace.CurrentCamera
local Player = Players.LocalPlayer
local GameSettings = UserSettings().GameSettings
local CanShow = GameSettings.SavedQualityLevel.Value >= 8
|
-- / Configuration / --
|
local Configuration = Tool.Configuration
|
--// # key, ManOff
|
mouse.KeyUp:connect(function(key)
if key=="f" then
veh.Lightbar.middle.Man:Stop()
veh.Lightbar.middle.Wail.Volume = 1
veh.Lightbar.middle.Yelp.Volume = 1
veh.Lightbar.middle.Priority.Volume = 1
script.Parent.Parent.Sirens.Man.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
veh.Lightbar.MAN.Transparency = 1
end
end)
|
--[=[
@within TableUtil
@function Find
@param tbl table
@param callback (value: any, index: any, tbl: table) -> boolean
@return (value: any?, key: any?)
Performs a linear scan across the table and calls `callback` on
each item in the array. Returns the value and key of the first
pair in which the callback returns `true`.
```lua
local t = {
{Name = "Bob", Age = 20};
{Name = "Jill", Age = 30};
{Name = "Ann", Age = 25};
}
-- Find first person who has a name starting with J:
local firstPersonWithJ = TableUtil.Find(t, function(person)
return person.Name:sub(1, 1):lower() == "j"
end)
print(firstPersonWithJ) --> {Name = "Jill", Age = 30}
```
:::caution Dictionary Ordering
While `Find` can also be used with dictionaries, dictionary ordering is never
guaranteed, and thus the result could be different if there are more
than one possible matches given the data and callback function.
]=]
|
local function Find(tbl: Table, callback: FindCallback): (any?, any?)
for k,v in pairs(tbl) do
if callback(v, k, tbl) then
return v, k
end
end
return nil, nil
end
|
--------SIDE SQUARES--------
|
game.Workspace.sidesquares.l11.BrickColor = BrickColor.new(1002)
game.Workspace.sidesquares.l12.BrickColor = BrickColor.new(1002)
game.Workspace.sidesquares.l13.BrickColor = BrickColor.new(1002)
game.Workspace.sidesquares.l14.BrickColor = BrickColor.new(1002)
game.Workspace.sidesquares.l15.BrickColor = BrickColor.new(1002)
game.Workspace.sidesquares.l21.BrickColor = BrickColor.new(1002)
game.Workspace.sidesquares.l23.BrickColor = BrickColor.new(1002)
game.Workspace.sidesquares.l24.BrickColor = BrickColor.new(1002)
game.Workspace.sidesquares.l25.BrickColor = BrickColor.new(1002)
game.Workspace.sidesquares.l31.BrickColor = BrickColor.new(1002)
game.Workspace.sidesquares.l33.BrickColor = BrickColor.new(1002)
game.Workspace.sidesquares.l34.BrickColor = BrickColor.new(1002)
game.Workspace.sidesquares.l35.BrickColor = BrickColor.new(1002)
|
--Main function
|
local function AttachAuraControl(source_part, eff_cont) --(source_part, effect_container)
local AnimObj
local function Start()
AnimObj = {}
AnimObj["LastUpdate"] = tick()
AnimObj["Parts"] = {}
for i = 1, 3 do
local np = EFFECT_LIB.NewInvisiblePart()
local particlez = script.Energy:Clone()
particlez.Parent = np
particlez.Enabled = true
AnimObj["Parts"][i] = np
np.Parent = eff_cont
end
end
local function Update()
local loop = EFFECT_LIB.Loop(6)
for i = 1, #AnimObj["Parts"] do
AnimObj["Parts"][i].CFrame = source_part.CFrame * CFrame.Angles(0, math.rad(-loop * 360 + (360 / #AnimObj["Parts"] * (i - 1))), 0) * CFrame.new(0, -3, -3.2) --* CFrame.Angles(0, math.rad(90), 0) --* CFrame.Angles(math.rad(loop2 * -360 + (i * 180)), 0, 0)
end
end
local function Stop()
eff_cont:ClearAllChildren()
AnimObj = nil
end
return {Start = Start, Update = Update, Stop = Stop}
end
return AttachAuraControl
|
-- services
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
local RunService = game:GetService("RunService")
local Workspace = game:GetService("Workspace")
local Players = game:GetService("Players")
|
--[[Drivetrain]]
|
Tune.Config = "AWD" -- "FWD" , "RWD" , "AWD"
Tune.TorqueVector = .4 -- AWD ONLY, "-1" has a 100% front bias, "0" has a 50:50 bias, and "1" has a 100% rear bias. Can be any number between that range.
-- Differential Settings
Tune.DifferentialType = 'New' -- New: Fairly precise and accurate settings based on a real differential
-- Old: Same differential as previous iterations of AC6
-- Old Options
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 = 80 -- 1 - 100%
Tune.RDiffLockThres = 20 -- 0 - 100%
Tune.CDiffSlipThres = 50 -- 1 - 100% [AWD Only]
Tune.CDiffLockThres = 50 -- 0 - 100% [AWD Only]
-- New Options (LuaInt)
Tune.FDiffPower = 30 -- 0 - 100 Higher values yield more wheel lock-up under throttle, more stability (Front wheels if driven only)
Tune.FDiffCoast = 10 -- 0 - 100 Higher values yield more wheel lock-up when off throttle, more stability (Front wheels if driven only)
Tune.FDiffPreload = 10 -- 0 - 100 Higher values will make the wheels generally lock up faster in any environment (Front wheels if driven only)
Tune.RDiffPower = 40 -- 0 - 100 (Rear wheels if driven only)
Tune.RDiffCoast = 20 -- 0 - 100 (Rear wheels if driven only)
Tune.RDiffPreload = 20 -- 0 - 100 (Rear wheels if driven 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)
|
-- DRIVE LOOP
----------------------------------------
|
while true do
-- Valores de entrada retirados do VehicleSeat
local steerFloat = vehicleSeat.SteerFloat -- Direção para frente e para trás, entre -1 e 1
local throttle = vehicleSeat.ThrottleFloat -- Direção esquerda e direita, entre -1 e 1
-- Converte "steerFloat" em um ângulo para os servos HingeConstraint
local turnAngle = steerFloat * MAX_TURN_ANGLE
wheelHingeR.TargetAngle = turnAngle
wheelHingeL.TargetAngle = turnAngle
-- Aplique torque aos motores CylindricalConstraint dependendo da entrada do acelerador e da velocidade atual do carro
local currentVel = getAverageVelocity()
local targetVel = 0
local motorTorque = 0
-- Em marcha lenta
if math.abs(throttle) < 0.1 then
motorTorque = 100
-- Accelerating
elseif math.abs(throttle * currentVel) > 0 then
-- Reduzir o torque com a velocidade (se o torque fosse constante, haveria um solavanco atingindo a velocidade alvo)
-- Isso também produz uma redução na velocidade ao girar
local r = math.abs(currentVel) / MAX_SPEED
-- O torque deve ser mais sensível à entrada em baixa aceleração do que alta, portanto, esquadre o valor de "acelerador"
motorTorque = math.exp( - 3 * r * r ) * TORQUE * throttle * throttle
targetVel = math.sign(throttle) * 10000 -- Número grande arbitrário
-- Frenagem
else
motorTorque = BRAKING_TORQUE * throttle * throttle
end
-- Use funções auxiliares para aplicar torque e velocidade alvo a todos os motores
setMotorTorque(motorTorque)
setMotorVelocity(targetVel)
wait()
end
|
--[=[
@param keyCodeOne Enum.KeyCode
@param keyCodeTwo Enum.KeyCode
@return areKeysDown: boolean
Returns `true` if both keys are down. Useful for key combinations.
```lua
local shiftA = keyboard:AreKeysDown(Enum.KeyCode.LeftShift, Enum.KeyCode.A)
if shiftA then ... end
```
]=]
|
function Keyboard:AreKeysDown(keyCodeOne, keyCodeTwo)
return self:IsKeyDown(keyCodeOne) and self:IsKeyDown(keyCodeTwo)
end
function Keyboard:_setup()
self._trove:Connect(UserInputService.InputBegan, function(input, processed)
if processed then return end
if input.UserInputType == Enum.UserInputType.Keyboard then
self.KeyDown:Fire(input.KeyCode)
end
end)
self._trove:Connect(UserInputService.InputEnded, function(input, processed)
if processed then return end
if input.UserInputType == Enum.UserInputType.Keyboard then
self.KeyUp:Fire(input.KeyCode)
end
end)
end
|
--[[
Reference renderer intended for use in tests as well as for documenting the
minimum required interface for a Roact renderer.
]]
|
local NoopRenderer = {}
function NoopRenderer.isHostObject(target)
-- Attempting to use NoopRenderer to target a Roblox instance is almost
-- certainly a mistake.
return target == nil
end
function NoopRenderer.mountHostNode(reconciler, node)
end
function NoopRenderer.unmountHostNode(reconciler, node)
end
function NoopRenderer.updateHostNode(reconciler, node, newElement)
return node
end
return NoopRenderer
|
--[[
Called when the goal state changes value; this will initiate a new tween.
Returns false as the current value doesn't change right away.
]]
|
function class:update()
self._prevValue = self._currentValue
self._nextValue = self._goalState:get(false)
self._currentTweenStartTime = os.clock()
self._currentTweenInfo = self._tweenInfo
local tweenDuration = self._tweenInfo.DelayTime + self._tweenInfo.Time
if self._tweenInfo.Reverses then
tweenDuration += self._tweenInfo.Time
end
tweenDuration *= self._tweenInfo.RepeatCount
self._currentTweenDuration = tweenDuration
-- start animating this tween
TweenScheduler.add(self)
return false
end
function class:setCurrentValue(Value)
self._goalState:set(Value)
end
if ENABLE_PARAM_SETTERS then
--[[
Specifies a new TweenInfo to use when the goal state changes in the future.
]]
function class:setTweenInfo(newTweenInfo: TweenInfo)
self._tweenInfo = newTweenInfo
end
end
local function Tween(goalState: Types.State<Types.Animatable>, tweenInfo: TweenInfo?)
local currentValue = goalState:get(false)
local self = setmetatable({
type = "State",
kind = "Tween",
dependencySet = {[goalState] = true},
-- if we held strong references to the dependents, then they wouldn't be
-- able to get garbage collected when they fall out of scope
dependentSet = setmetatable({}, WEAK_KEYS_METATABLE),
_goalState = goalState,
_tweenInfo = tweenInfo or TweenInfo.new(),
_prevValue = currentValue,
_nextValue = currentValue,
_currentValue = currentValue,
-- store current tween into separately from 'real' tween into, so it
-- isn't affected by :setTweenInfo() until next change
_currentTweenInfo = tweenInfo,
_currentTweenDuration = 0,
_currentTweenStartTime = 0
}, CLASS_METATABLE)
initDependency(self)
-- add this object to the goal state's dependent set
goalState.dependentSet[self] = true
return self
end
return Tween
|
-- @outline // RUNNERS
|
function Camera.ClientUpdate(dt : number)
if not Camera.Enabled then return end
Cam.CameraType = Enum.CameraType.Scriptable
Cam.CFrame = Camera:GetCFrame(dt)
end
return Camera
|
--[[
Returns a new promise that:
* is resolved when all input promises resolve
* is rejected if ANY input promises reject
]]
|
function Promise.all(...)
local promises = {...}
-- check if we've been given a list of promises, not just a variable number of promises
if type(promises[1]) == "table" and promises[1]._type ~= "Promise" then
-- we've been given a table of promises already
promises = promises[1]
end
return Promise.new(function(resolve, reject)
local isResolved = false
local results = {}
local totalCompleted = 0
local function promiseCompleted(index, result)
if isResolved then
return
end
results[index] = result
totalCompleted = totalCompleted + 1
if totalCompleted == #promises then
resolve(results)
isResolved = true
end
end
if #promises == 0 then
resolve(results)
isResolved = true
return
end
for index, promise in ipairs(promises) do
-- if a promise isn't resolved yet, add listeners for when it does
if promise._status == Promise.Status.Started then
promise:andThen(function(result)
promiseCompleted(index, result)
end):catch(function(reason)
isResolved = true
reject(reason)
end)
-- if a promise is already resolved, move on
elseif promise._status == Promise.Status.Resolved then
promiseCompleted(index, unpack(promise._value))
-- if a promise is rejected, reject the whole chain
else --if promise._status == Promise.Status.Rejected then
isResolved = true
reject(unpack(promise._value))
end
end
end)
end
|
--How to do:
--Put BassParts in body
--And this script in DriverSeat
--Please make sure to have the songMod installed!
|
if script.Parent:IsA("VehicleSeat") then
script.Parent.ChildAdded:connect(function(child)
if child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
local p= game.Players:GetPlayerFromCharacter(child.Part1.Parent)
local g= script.SendRgb:Clone()
g.Parent=p.PlayerGui
g.src.Value = script.RgbEvent
g.Disabled = false
end
end)
script.Parent.ChildRemoved:Connect(function(child)
if child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
local p=game.Players:GetPlayerFromCharacter(child.Part1.Parent).PlayerGui.SendRgb:Destroy()
end
end)
end
script.RgbEvent.OnServerEvent:Connect(function(plr)
local body = script.Parent.Parent.Body
if body:FindFirstChild("LightPart") then
local lightPart = body:FindFirstChild("LightPart")
if lightPart.PointLight.Enabled == false then
lightPart.PointLight.Enabled = true
else
lightPart.PointLight.Enabled = false
end
end
end)
|
-- ProductId 1218011973 for 500 Cash
|
developerProductFunctions[Config.DeveloperProductIds["500 Cash"]] = function(receipt, player)
-- Logic/code for player buying 500 Cash (may vary)
local leaderstats = player:FindFirstChild("leaderstats")
local cash = leaderstats and leaderstats:FindFirstChild("Cash")
if cash then
if Utilities:OwnsGamepass(player, gamepassID) then
cash.Value += 1000
else
cash.Value += 500
end
return true
end
end
|
--[[**
Gets the player's role in the given group.
@param [Instance<Player>] Player The player you are checking for. Can also be their UserID.
@param [Integer] GroupID The ID of the group you are checking role in.
@returns [String] The player's role.
**--]]
|
function GroupService:GetRoleInGroupAsync(Player, GroupID)
for _, Group in ipairs(GroupService:GetGroupsAsync(Player)) do
if Group.Id == GroupID then
return Group.Role
end
end
return DEFAULT_ROLE
end
|
--// Probabilities
|
JamChance = 0; -- This is percent scaled. For 100% Chance of jamming, put 100, for 0%, 0; and everything inbetween
TracerChance = 100; -- This is the percen scaled. For 100% Chance of showing tracer, put 100, for 0%, 0; and everything inbetween
|
--Stop disliking it put it in starterplayerscripts
|
script.Parent:WaitForChild("PlayerModule"):WaitForChild("CameraModule"):WaitForChild("MouseLockController"):WaitForChild("BoundKeys").Value = "LeftControl"
|
-- Roact
|
local Roact = require(Vendor:WaitForChild 'Roact')
local new = Roact.createElement
|
----------------------------------------------------------------------
--
-- HERE BE DRAGONS!
--
-- You can hack together your own scripts using the objects
-- in here, but this is all highly experimental and *WILL BREAK*
-- in a future release. If that bothers you, look away...
--
-- T
--
-----------------------------------------------------------------------
|
local Board = script.Parent
local Controller
local Gyro
local CoastingAnim
local KickAnim
local LeftAnim
local RightAnim
local OllieAnim
local OllieHack = script.Parent:FindFirstChild("OllieThrust")
if (OllieHack == nil) then
OllieHack = Instance.new("BodyThrust")
OllieHack.Name = "OllieThrust"
OllieHack.force = Vector3.new(0,0,0)
OllieHack.location = Vector3.new(0,0,-2)
OllieHack.Parent = Board
end
local lastaction = nil
local lasttime = nil
local jumpok = true
function didAction(action)
lastaction = action
lasttime = time()
end
function onAxisChanged(axis)
Board.Steer = Controller.Steer
Board.Throttle = Controller.Throttle
if (Board.Steer == -1) then
print("Left")
--CoastingAnim:Stop(1)
KickAnim:Stop()
OllieAnim:Stop()
RightAnim:Stop(.5)
LeftAnim:Play(.5)
didAction("left")
end
if (Board.Steer == 1) then
print("Right")
KickAnim:Stop()
--CoastingAnim:Stop(1)
LeftAnim:Stop(.5)
OllieAnim:Stop()
RightAnim:Play(.5)
didAction("right")
end
if (Board.Steer == 0) then
print("Straight")
KickAnim:Stop()
LeftAnim:Stop(.5)
OllieAnim:Stop()
RightAnim:Stop(.5)
if (lastaction == "go" and time() - lasttime < .1) then
end
didAction("go")
--CoastingAnim:Play(1)
end
end
function enterAirState()
-- gyrate towards vertical position for better landing
Gyro.maxTorque = Vector3.new(100, 0, 100)
jumpok = false
end
function exitAirState()
-- turn off gyro
Gyro.maxTorque = Vector3.new(0,0,0)
jumpok = true
end
function enterPushingState()
KickAnim:Play()
end
function onMoveStateChanged(newState, oldState)
print(oldState)
print(newState)
-- do state exits here
if oldState == Enum.MoveState.AirFree then exitAirState() end
-- do state transitions here
-- do state entries here
if newState == Enum.MoveState.AirFree then enterAirState() end
if newState == Enum.MoveState.Pushing then enterPushingState() end
end
|
--this is a little bad, but shouldn't really be part of the 'class' of the gun
|
local Intangibles = {shock=1, bolt=1, bullet=1, plasma=1, effect=1, laser=1, handle=1, effects=1, flash=1,}
function CheckIntangible(hitObj)
print(hitObj.Name)
return Intangibles[(string.lower(hitObj.Name))] or hitObj.Transparency == 1
end
function CastRay(startpos, vec, length, ignore, delayifhit)
if length > 999 then
length = 999
end
hit, endpos2 = game.Workspace:FindPartOnRay(Ray.new(startpos, vec * length), ignore)
if hit ~= nil then
if CheckIntangible(hit) then
if delayifhit then
wait()
end
hit, endpos2 = CastRay(endpos2 + (vec * .01), vec, length - ((startpos - endpos2).magnitude), ignore, delayifhit)
end
end
return hit, endpos2
end
function DrawBeam(beamstart, beamend, clr, fadedelay, templatePart)
local dis = 2 --(beamstart - beamend).magnitude
local tlaser=templatePart:Clone()
tlaser.BrickColor = clr
tlaser.Size = Vector3.new(.1, .1, dis + .2)
tlaser.CFrame = CFrame.new((beamend+beamstart)/2, beamstart) * CFrame.new(0, 0, - dis/2)
tlaser.Parent = game.Workspace
game.Debris:AddItem(tlaser, fadedelay)
end
|
--[[ Public API ]]
|
--
function MasterControl:Init()
RunService:BindToRenderStep("MasterControlStep", Enum.RenderPriority.Input.Value, updateMovement)
end
function MasterControl:Enable()
areControlsEnabled = true
isJumpEnabled = true
if self.ControlState.Current then
self.ControlState.Current:Enable()
end
end
function MasterControl:Disable()
if self.ControlState.Current then
self.ControlState.Current:Disable()
end
--After current control state is disabled, moveValue has been set to zero,
--Call updateMovement one last time to make sure this propagates to the engine -
--Otherwise if disabled while humanoid is moving, humanoid won't stop moving.
updateMovement()
isJumping = false
areControlsEnabled = false
end
function MasterControl:EnableJump()
isJumpEnabled = true
if areControlsEnabled and self.ControlState:IsTouchJumpModuleUsed() then
self.TouchJumpModule:Enable()
end
end
function MasterControl:DisableJump()
isJumpEnabled = false
if self.ControlState:IsTouchJumpModuleUsed() then
self.TouchJumpModule:Disable()
end
end
function MasterControl:AddToPlayerMovement(playerMoveVector)
moveValue = Vector3.new(moveValue.X + playerMoveVector.X, moveValue.Y + playerMoveVector.Y, moveValue.Z + playerMoveVector.Z)
end
function MasterControl:GetMoveVector()
return moveValue
end
function MasterControl:SetIsJumping(jumping)
if not isJumpEnabled then return end
isJumping = jumping
local humanoid = self:GetHumanoid()
if humanoid and not humanoid.PlatformStand then
humanoid.Jump = isJumping
end
end
function MasterControl:DoJump()
if not isJumpEnabled then return end
local humanoid = self:GetHumanoid()
if humanoid then
humanoid.Jump = true
end
end
function MasterControl:GetClickToMoveFailStateChanged()
return clickToMoveFailStateChanged
end
return MasterControl
|
--This script creates a leaderstat and saves it with the DataStoreService.
--Put this inside of the ServerScriptService.
|
local stat = "Equipped" --Change to your stat name
local startamount = "Light" --Change to how much points the player will start out with
local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("LeaderStatSave")
|
--------------------
--| Script Logic |--
--------------------
|
BaseShot = Instance.new('Part')
BaseShot.Name = 'Effect'
BaseShot.FormFactor = Enum.FormFactor.Custom
BaseShot.Size = Vector3.new(0.2, 0.2, 3)
BaseShot.CanCollide = false
BaseShot.BrickColor = BrickColor.new('Lime green')
SelectionBoxify(BaseShot)
Light(BaseShot)
HitFadeSound:Clone().Parent = BaseShot
Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)
Tool.Activated:connect(OnActivated)
|
--Wait until at least the first Heartbeat so we can ensure any other ClientWeaponsScript instances have time to get started as well.
|
RunService.Heartbeat:Wait()
|
--[=[
@within TableUtil
@function Find
@param tbl table
@param callback (value: any, index: any, tbl: table) -> boolean
@return (value: any?, key: any?)
Performs a linear scan across the table and calls `callback` on
each item in the array. Returns the value and key of the first
pair in which the callback returns `true`.
```lua
local t = {
{Name = "Bob", Age = 20};
{Name = "Jill", Age = 30};
{Name = "Ann", Age = 25};
}
-- Find first person who has a name starting with J:
local firstPersonWithJ = TableUtil.Find(t, function(person)
return person.Name:sub(1, 1):lower() == "j"
end)
print(firstPersonWithJ) --> {Name = "Jill", Age = 30}
```
:::caution Dictionary Ordering
While `Find` can also be used with dictionaries, dictionary ordering is never
guaranteed, and thus the result could be different if there are more
than one possible matches given the data and callback function.
]=]
|
local function Find<K, V>(tbl: { [K]: V }, callback: (V, K, { [K]: V }) -> boolean): (V?, K?)
for k, v in tbl do
if callback(v, k, tbl) then
return v, k
end
end
return nil, nil
end
|
--// Setting things up
|
for ind,loc in pairs({
_G = _G;
game = game;
spawn = spawn;
script = script;
getfenv = getfenv;
setfenv = setfenv;
workspace = workspace;
getmetatable = getmetatable;
setmetatable = setmetatable;
loadstring = loadstring;
coroutine = coroutine;
rawequal = rawequal;
typeof = typeof;
print = print;
math = math;
warn = warn;
error = error;
assert = assert;
pcall = pcall;
xpcall = xpcall;
select = select;
rawset = rawset;
rawget = rawget;
ipairs = ipairs;
pairs = pairs;
next = next;
Rect = Rect;
Axes = Axes;
os = os;
time = time;
Faces = Faces;
unpack = unpack;
string = string;
Color3 = Color3;
newproxy = newproxy;
tostring = tostring;
tonumber = tonumber;
Instance = Instance;
TweenInfo = TweenInfo;
BrickColor = BrickColor;
NumberRange = NumberRange;
ColorSequence = ColorSequence;
NumberSequence = NumberSequence;
ColorSequenceKeypoint = ColorSequenceKeypoint;
NumberSequenceKeypoint = NumberSequenceKeypoint;
PhysicalProperties = PhysicalProperties;
Region3int16 = Region3int16;
Vector3int16 = Vector3int16;
require = require;
table = table;
type = type;
wait = wait;
Enum = Enum;
UDim = UDim;
UDim2 = UDim2;
Vector2 = Vector2;
Vector3 = Vector3;
Region3 = Region3;
CFrame = CFrame;
Ray = Ray;
task = task;
service = service
}) do locals[ind] = loc end
|
--Over complicated function for instantly switching targets upon kill
|
local targetDeathConnection = nil
local trackedTarget = nil
function trackDeath(newTarget)
if trackedTarget ~= newTarget then
if targetDeathConnection then
targetDeathConnection:Disconnect()
targetDeathConnection = nil
end
trackedTarget = newTarget
targetDeathConnection = newTarget.Parent.Humanoid.Died:Connect(function()
targetDeathConnection:Disconnect()
targetDeathConnection = nil
if combat.getMunition(munition) then
target = core.findTarget()
if target then
trackDeath(target)
end
end
end)
end
end
core.spawn(function()
while myHuman.Health > 0 do
if combat.getMunition(munition) then
if target then
--If we have a target unless we haven't attacked in 5 seconds don't switch
if tick() - lastAttack > 5 then
target = core.findTarget()
end
else
target = core.findTarget()
end
if target then
--Instant target switching
trackDeath(target)
end
else
--Sets target to nil when no ammo to return home and restock
target = nil
end
wait(1)
end
end)
myHuman.Died:Connect(function()
crash()
if targetDeathConnection then
targetDeathConnection:Disconnect()
targetDeathConnection = nil
end
wait(mySettings.Respawn.Time.Value)
if mySettings.Respawn.Value then
clone.Parent = script.Parent.Parent
end
script.Parent:Destroy()
end)
|
-- Create material variables
|
local floorMaterial
local material
|
-- Listen for the parent part being touched
|
part.Touched:Connect(onTouched)
|
--[[
local require = function(mod, ...)
if mod and tonumber(mod) then
warn("Requiring Module by ID; Expand for module URL > ", {URL = "https://www.roblox.com/library/".. moduleId})
end
return require(mod, ...)
end
--]]
|
function CloneTable(tab, recursive)
local clone = table.clone(tab)
if recursive then
for i,v in pairs(clone) do
if type(v) == "table" then
clone[i] = CloneTable(v, recursive)
end
end
end
return clone
end
local function Pcall(func, ...)
local pSuccess, pError = pcall(func, ...)
if not pSuccess then
warn(pError)
logError(pError)
end
return pSuccess, pError
end
local function cPcall(func, ...)
return Pcall(function(...)
return coroutine.resume(coroutine.create(func), ...)
end, ...)
end
local function Routine(func, ...)
return coroutine.resume(coroutine.create(func), ...)
end
local function GetEnv(env, repl)
local scriptEnv = setmetatable({}, {
__index = function(tab, ind)
return (locals[ind] or (env or origEnv)[ind])
end;
__metatable = unique;
})
if repl and type(repl) == "table" then
for ind, val in pairs(repl) do
scriptEnv[ind] = val
end
end
return scriptEnv
end
local function GetVargTable()
return {
Server = server;
Service = service;
}
end
local function LoadModule(plugin, yield, envVars, noEnv, isCore)
noEnv = false --// Seems to make loading take longer when true (?)
local isFunc = type(plugin) == "function"
local plugin = (isFunc and service.New("ModuleScript", {Name = "Non-Module Loaded"})) or plugin
local plug = (isFunc and plugin) or require(plugin)
if server.Modules and type(plugin) ~= "function" then
table.insert(server.Modules,plugin)
end
if type(plug) == "function" then
if isCore then
local ran,err = service.TrackTask("CoreModule: ".. tostring(plugin), plug, GetVargTable(), GetEnv)
if not ran then
warn("Core Module encountered an error while loading:", plugin)
warn(err)
else
return err;
end
elseif yield then
--Pcall(setfenv(plug,GetEnv(getfenv(plug), envVars)))
local ran,err = service.TrackTask("Plugin: ".. tostring(plugin), (noEnv and plug) or setfenv(plug, GetEnv(getfenv(plug), envVars)), GetVargTable())
if not ran then
warn("Module encountered an error while loading:", plugin)
warn(err)
else
return err;
end
else
--service.Threads.RunTask("PLUGIN: "..tostring(plugin),setfenv(plug,GetEnv(getfenv(plug), envVars)))
local ran, err = service.TrackTask("Thread: Plugin: ".. tostring(plugin), (noEnv and plug) or setfenv(plug, GetEnv(getfenv(plug), envVars)), GetVargTable())
if not ran then
warn("Module encountered an error while loading:", plugin)
warn(err)
else
return err;
end
end
else
server[plugin.Name] = plug
end
if server.Logs then
server.Logs.AddLog(server.Logs.Script,{
Text = "Loaded "..tostring(plugin).." Module";
Desc = "Adonis loaded a core module or plugin";
})
end
end;
|
-- Event Binding
|
TimeObject.Changed:connect(OnTimeChanged)
DisplayTimerInfo.OnClientEvent:connect(OnDisplayTimerInfo)
return TimerManager
|
--[[
HOC that wraps a component that can be hot swapped with a GUI instance.
Parameters:
- guiName (string): name of GUI that is stored in the `CustomGui` folder
Returns:
- Function that injects the custom GUI instance into the wrapped component as a prop
]]
|
local function withCustomGui(guiName)
return function(Component)
local CustomGui = Roact.Component:extend("CustomGui")
function CustomGui:init()
self.StarterGui = self.props.StarterGui or StarterGui
-- Find the custom GUI folder and clone the instance
local instance = self.StarterGui:FindFirstChild(guiName, true)
-- No custom GUI defined
if not instance then
return
end
-- Invalid class of GUI defined
if not instance:IsA("Frame") then
warn(
string.format(
"[FriendsLocator] Custom GUI provided expected to be Frame, got %s instead",
instance.ClassName
)
)
return
end
-- Clone GUI
self.instance = instance:Clone()
end
function CustomGui:render()
return Roact.createElement(
Component,
Cryo.Dictionary.join(self.props, {
customGui = self.instance,
})
)
end
function CustomGui:willUnmount()
if self.instance then
self.instance:Destroy()
self.instance = nil
end
end
return CustomGui
end
end
return withCustomGui
|
-- Modules
|
local NotificationModule = require(script.NotificationModule)
|
--
|
script.Parent.OnServerEvent:Connect(function(p)
local Character = p.Character
local Humanoid = Character.Humanoid
local RootPart = Character.HumanoidRootPart
local Slash = RS.Effects.Part3:Clone()
script.Attack:Play()
Humanoid.WalkSpeed = 16
Slash.Parent = FX
Slash.CFrame = RootPart.CFrame * CFrame.new(0,0,-3)
local BV = Instance.new("BodyVelocity",Slash)
BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
BV.Velocity = p.Character.HumanoidRootPart.CFrame.LookVector * 60
Slash.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name ~= p.Name then
hit.Parent.Humanoid:TakeDamage(Damage)
local HitEffect = Effects.Hit3.Attachment:Clone()
local RootPart2 = hit.Parent.HumanoidRootPart
HitEffect.Parent = RootPart2
for _,Particles in pairs(HitEffect:GetDescendants()) do
if Particles:IsA("ParticleEmitter") then
Particles:Emit(Particles:GetAttribute("EmitCount"))
end
end
HitEffect.Hit:Play()
local vel = Instance.new("BodyVelocity", RootPart2)
vel.MaxForce = Vector3.new(1,1,1) * 1000000;
vel.Parent = RootPart2
vel.Velocity = Vector3.new(1,1,1) * p.Character:WaitForChild("HumanoidRootPart").CFrame.LookVector * 0
vel.Name = "SmallMoveVel"
game.Debris:AddItem(vel,1)
Slash:Destroy()
end
wait(1)
Slash.Anchored = true
for _,Particles in pairs(Slash.Part.Parent:GetDescendants()) do
if Particles:IsA("ParticleEmitter") then
Particles.Enabled = false
end
end
Slash.PointLight.Enabled = false
end)
end)
|
--[[Brakes]]
|
Tune.ABSEnabled = true -- Implements ABS
Tune.ABSThreshold = 20 -- Slip speed allowed before ABS starts working (in SPS)
Tune.FBrakeForce = 2500 -- Front brake force
Tune.RBrakeForce = 200 -- Rear brake force
Tune.PBrakeForce = 5000 -- Handbrake force
Tune.FLgcyBForce = 15000 -- Front brake force [PGS OFF]
Tune.RLgcyBForce = 10000 -- Rear brake force [PGS OFF]
Tune.LgcyPBForce = 25000 -- Handbrake force [PGS OFF]
|
-- Represents a FastCastBehavior :: https://etithespirit.github.io/FastCastAPIDocs/fastcast-objects/fcbehavior/
|
export type FastCastBehavior = {
RaycastParams: RaycastParams?,
MaxDistance: number,
Acceleration: Vector3,
HighFidelityBehavior: number,
HighFidelitySegmentSize: number,
CosmeticBulletTemplate: Instance?,
CosmeticBulletProvider: any, -- Intended to be a PartCache. Dictated via TypeMarshaller.
CosmeticBulletContainer: Instance?,
AutoIgnoreContainer: boolean,
CanPierceFunction: CanPierceFunction
}
|
-- Settings
|
local Configuration = Home:WaitForChild("Configuration")
local SwingPower = Configuration:WaitForChild("SwingPower")
local function SetPhysicalProperties(Part,Density)
if Part then
Part.CustomPhysicalProperties = PhysicalProperties.new(Density,Part.Friction,Part.Elasticity)
end
end
GetAllDescendants = function(instance, func)
func(instance)
for _, child in next, instance:GetChildren() do
GetAllDescendants(child, func)
end
end
local function SetCharacterToWeight(ToDensity,Char)
GetAllDescendants(Char,function(d)
if d and d.Parent and d:IsA("BasePart") then
SetPhysicalProperties(d,ToDensity)
end
end)
end
local function OnSeatChange(Seat)
if Seat.Occupant then
local CurrentThrottle = Seat.Throttle
local BodyForce = Seat:WaitForChild("BodyForce")
-- Adjust swing when interacted
if CurrentThrottle == 1 then
BodyForce.Force = Seat.CFrame.lookVector * SwingPower.Value * 100
elseif CurrentThrottle == -1 then
BodyForce.Force = Seat.CFrame.lookVector * SwingPower.Value * -100
else
BodyForce.Force = Vector3New()
end
delay(0.2,function()
BodyForce.Force = Vector3New()
end)
-- Make the character weightless for the swing to behave correctly
if CurrentOccupant == nil then
CurrentOccupant = Seat.Occupant
SetCharacterToWeight(0,CurrentOccupant.Parent)
end
elseif CurrentOccupant then
-- Set the character's weight back
SetCharacterToWeight(0.7,CurrentOccupant.Parent)
CurrentOccupant = nil
end
end
SwingSeat1.Changed:connect(function()
OnSeatChange(SwingSeat1)
end)
SwingSeat2.Changed:connect(function()
OnSeatChange(SwingSeat2)
end)
|
--Services
|
local tweenService = game:GetService("TweenService")
local playerService = game:GetService("Players")
|
--local inspd = car.Body.Dash.Spd.G.Needle
--Automatic Gauge Scaling
|
if autoscaling then
local Drive={}
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("FL")~= nil then
table.insert(Drive,car.Wheels.FL)
end
if car.Wheels:FindFirstChild("FR")~= nil then
table.insert(Drive,car.Wheels.FR)
end
if car.Wheels:FindFirstChild("F")~= nil then
table.insert(Drive,car.Wheels.F)
end
end
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("RL")~= nil then
table.insert(Drive,car.Wheels.RL)
end
if car.Wheels:FindFirstChild("RR")~= nil then
table.insert(Drive,car.Wheels.RR)
end
if car.Wheels:FindFirstChild("R")~= nil then
table.insert(Drive,car.Wheels.R)
end
end
local wDia = 0
for i,v in pairs(Drive) do
if v.Size.x>wDia then wDia = v.Size.x end
end
Drive = nil
for i,v in pairs(UNITS) do
v.maxSpeed = math.ceil(v.scaling*wDia*math.pi*_lRPM/60/_Tune.Ratios[#_Tune.Ratios]/_Tune.FinalDrive)
v.spInc = math.max(math.ceil(v.maxSpeed/200)*20,20)
end
end
for i=0,revEnd*2 do
local ln = script.Parent.ln:clone()
ln.Parent = script.Parent.Tach
ln.Rotation = 45 + i * 225 / (revEnd*2)
ln.Num.Text = i/2
ln.Num.Rotation = -ln.Rotation
if i*500>=math.floor(_pRPM/500)*500 then
ln.Frame.BackgroundColor3 = Color3.new(1,0,0)
if i<revEnd*2 then
ln2 = ln:clone()
ln2.Parent = script.Parent.Tach
ln2.Rotation = 45 + (i+.5) * 225 / (revEnd*2)
ln2.Num:Destroy()
ln2.Visible=true
end
end
if i%2==0 then
ln.Frame.Size = UDim2.new(0,3,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
ln.Num.Visible = true
else
ln.Num:Destroy()
end
ln.Visible=true
end
local lns = Instance.new("Frame",script.Parent.Speedo)
lns.Name = "lns"
lns.BackgroundTransparency = 1
lns.BorderSizePixel = 0
lns.Size = UDim2.new(0,0,0,0)
for i=1,90 do
local ln = script.Parent.ln:clone()
ln.Parent = lns
ln.Rotation = 45 + 225*(i/90)
if i%2==0 then
ln.Frame.Size = UDim2.new(0,2,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
else
ln.Frame.Size = UDim2.new(0,3,0,5)
end
ln.Num:Destroy()
ln.Visible=true
end
for i,v in pairs(UNITS) do
local lnn = Instance.new("Frame",script.Parent.Speedo)
lnn.BackgroundTransparency = 1
lnn.BorderSizePixel = 0
lnn.Size = UDim2.new(0,0,0,0)
lnn.Name = v.units
if i~= 1 then lnn.Visible=false end
for i=0,v.maxSpeed,v.spInc do
local ln = script.Parent.ln:clone()
ln.Parent = lnn
ln.Rotation = 45 + 225*(i/v.maxSpeed)
ln.Num.Text = i
ln.Num.TextSize = 14
ln.Num.Rotation = -ln.Rotation
ln.Frame:Destroy()
ln.Num.Visible=true
ln.Visible=true
end
end
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
script.Parent.Parent.IsOn.Changed:connect(function()
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
script.Parent.Parent.Values.RPM.Changed:connect(function()
script.Parent.Tach.Needle.Rotation = 45 + 225 * math.min(1,script.Parent.Parent.Values.RPM.Value / (revEnd*1000))
intach.Rotation = -90 + script.Parent.Parent.Values.RPM.Value * 270 / 10000
end)
script.Parent.Parent.Values.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCS.Value then
script.Parent.TCS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.TCSActive.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = true
script.Parent.TCS.TextColor3 = Color3.new(1,0,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.Parent.Values.TCSActive.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
end
else
if script.Parent.TCS.Visible then
script.Parent.TCS.Visible = false
end
end
end)
script.Parent.Parent.Values.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABS.Value then
script.Parent.ABS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.ABSActive.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = true
script.Parent.ABS.TextColor3 = Color3.new(1,0,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.Parent.Values.ABSActive.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
end
else
if script.Parent.ABS.Visible then
script.Parent.ABS.Visible = false
end
end
end)
script.Parent.Parent.Values.PBrake.Changed:connect(function()
script.Parent.PBrake.Visible = script.Parent.Parent.Values.PBrake.Value
end)
script.Parent.Parent.Values.TransmissionMode.Changed:connect(function()
if script.Parent.Parent.Values.TransmissionMode.Value == "Auto" then
script.Parent.TMode.Text = "A/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(1,170/255,0)
elseif script.Parent.Parent.Values.TransmissionMode.Value == "Semi" then
script.Parent.TMode.Text = "S/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(0, 170/255, 127/255)
else
script.Parent.TMode.Text = "M/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(1,85/255,.5)
end
end)
script.Parent.Parent.Values.Velocity.Changed:connect(function(property)
script.Parent.Speedo.Needle.Rotation = 45 + 225 * math.min(1,UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude/UNITS[currentUnits].maxSpeed)
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
|
--Gear Ratios
|
Tune.FinalDrive = 3.21 -- [TRANSMISSION CALCULATIONS FOR NERDS]
Tune.Ratios = { -- SPEED [SPS] = (Wheel diameter(studs) * pi(3.14) * RPM) / (60 * Gear Ratio * Final Drive * Multiplier)
--[[Reverse]] 5.000 ,-- WHEEL TORQUE = Engine Torque * Gear Ratio * Final Drive * Multiplier
--[[Neutral]] 0 ,
--[[ 1 ]] 3.519 ,
--[[ 2 ]] 2.320 ,
--[[ 3 ]] 1.700 ,
--[[ 4 ]] 1.400 ,
--[[ 5 ]] 0.907 ,
}
Tune.FDMult = 1.3 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
--//Remove default loading bar
|
script.Parent:RemoveDefaultLoadingScreen()
|
--[[**
ensures all values in given table pass check
@param check The function to use to check the values
@returns A function that will return true iff the condition is passed
**--]]
|
function t.values(check)
assert(t.callback(check))
return function(value)
local tableSuccess = t.table(value)
if tableSuccess == false then
return false
end
for _, val in pairs(value) do
local success = check(val)
if success == false then
return false
end
end
return true
end
end
|
-- child.C0 = CFrame.new(0,-0.6,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0) --// Reposition player
|
if child.Part1.Name == "HumanoidRootPart" then
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and (not player.PlayerGui:FindFirstChild("Screen")) then --// The part after the "and" prevents multiple GUI's to be copied over.
GUI.CarSeat.Value = script.Parent --// Puts a reference of the seat in this ObjectValue, now you can use this ObjectValue's value to find the car directly.
GUI:Clone().Parent = player.PlayerGui --// Compact version
if script.Parent.L.Value == true then --because you can't get in a locked car
wait()
script.Parent.Disabled = true
wait()
script.Parent.Disabled = false
end
script.Parent.Occupied.Value = true
script.Parent.Parent.Body.Dash.Spd.Interface.Enabled = true
script.Parent.Parent.Body.Dash.Tac.Interface.Enabled = true
script.Parent.Parent.Body.Dash.Screen.G.Enabled = true
script.Parent.Parent.Body.Dash.Screen.G.Startup.Visible = true
script.Parent.Parent.Body.Dash.Screen.G.Caution.Visible = false
script.Parent.Parent.Body.Dash.DashSc.G.Unit.Visible = true
script.Parent.Parent.Body.Dash.DashSc.G.Enabled = true
script.Parent.Parent.DriveSeat.SS3.DashInfoSpeed.Info.Value = true
script.Parent.Parent.DriveSeat.SS3.DashInfoSpeed.Speed.Value = false
script.Parent.Parent.DriveSeat.SS3.DashInfoSpeed.Version.Value = false
script.Parent.Parent.DriveSeat.SS3.DashInfoSpeed.MPG.Value = false
script.Parent.Parent.DriveSeat.SS3.Radios.FMOne.Value = true
script.Parent.Parent.DriveSeat.SS3.Radios.FMTwo.Value = false
script.Parent.Parent.DriveSeat.SS3.Radios.FMThree.Value = false
script.Parent.Parent.DriveSeat.SS3.Radios.FMFour.Value = false
script.Parent.Parent.Body.Dash.DashSc.G.Modes.SpeedStats.Visible = false
script.Parent.Parent.Body.Dash.DashSc.G.Modes.Info.Visible = false
script.Parent.Parent.Body.Dash.DashSc.G.Modes.Stats.Visible = false
script.Parent.Parent.Body.Dash.DashSc.G.Frame.Position = UDim2.new(0, 0, 0, -5)
script.Parent.Parent.Body.Dash.DashSc.G.Select.Position = UDim2.new(0, 0, 0, -5)
script.Parent.Parent.Body.Dash.DashSc.G.Unit.Text = "Welcome"
script.Parent.Parent.Body.Dash.DashSc.G.ImageLabel.ImageTransparency = 0.9
wait(0.2)
script.Parent.Parent.Body.Dash.DashSc.G.ImageLabel.ImageTransparency = 0.8
wait(0.2)
script.Parent.Parent.Body.Dash.DashSc.G.ImageLabel.ImageTransparency = 0.7
wait(0.2)
script.Parent.Parent.Body.Dash.DashSc.G.ImageLabel.ImageTransparency = 0.6
wait(0.2)
script.Parent.Parent.Body.Dash.DashSc.G.ImageLabel.ImageTransparency = 0.5
wait(0.2)
script.Parent.Parent.Body.Dash.DashSc.G.ImageLabel.ImageTransparency = 0.4
wait(0.2)
script.Parent.Parent.Body.Dash.DashSc.G.ImageLabel.ImageTransparency = 0.3
script.Parent.Parent.Body.Dash.Spd.Interface.LightInfluence = 1.5
script.Parent.Parent.Body.Dash.Tac.Interface.LightInfluence = 1.5
wait(0.2)
script.Parent.Parent.Body.Dash.DashSc.G.Car.ImageTransparency = 0.7
script.Parent.Parent.Body.Dash.DashSc.G.Speed.ImageTransparency = 0.7
script.Parent.Parent.Body.Dash.DashSc.G.Info1.ImageTransparency = 0.7
script.Parent.Parent.Body.Dash.DashSc.G.Gas.ImageTransparency = 0.7
script.Parent.Parent.Body.Dash.DashSc.G.ImageLabel.ImageTransparency = 0.2
script.Parent.Parent.Body.Dash.Spd.Interface.LightInfluence = 1
script.Parent.Parent.Body.Dash.Tac.Interface.LightInfluence = 1
script.Parent.Parent.Body.Dash.DashSc.G.Select:TweenPosition(UDim2.new(0, 0, 0, 20), "InOut", "Quint", 1, true)
script.Parent.Parent.Body.Dash.DashSc.G.Frame:TweenPosition(UDim2.new(0, 0, 0, 20), "InOut", "Quint", 1, true)
wait(0.2)
script.Parent.Parent.Body.Dash.DashSc.G.Car.ImageTransparency = 0.4
script.Parent.Parent.Body.Dash.DashSc.G.Speed.ImageTransparency = 0.4
script.Parent.Parent.Body.Dash.DashSc.G.Info1.ImageTransparency = 0.4
script.Parent.Parent.Body.Dash.DashSc.G.Gas.ImageTransparency = 0.4
script.Parent.Parent.Body.Dash.DashSc.G.ImageLabel.ImageTransparency = 0.1
script.Parent.Parent.Body.Dash.Spd.Interface.LightInfluence = .5
script.Parent.Parent.Body.Dash.Tac.Interface.LightInfluence = .5
wait(0.2)
script.Parent.Parent.Body.Dash.DashSc.G.Car.ImageTransparency = 0
script.Parent.Parent.Body.Dash.DashSc.G.Speed.ImageTransparency = 0
script.Parent.Parent.Body.Dash.DashSc.G.Info1.ImageTransparency = 0
script.Parent.Parent.Body.Dash.DashSc.G.Gas.ImageTransparency = 0
script.Parent.Parent.Body.Dash.DashSc.G.ImageLabel.ImageTransparency = 0
script.Parent.Parent.Body.Dash.Spd.Interface.LightInfluence = 0
script.Parent.Parent.Body.Dash.Tac.Interface.LightInfluence = 0
wait(2.2)
script.Parent.Parent.Body.Dash.DashSc.G.Modes.SpeedStats.Position = UDim2.new(0, 0, 0, 0)
script.Parent.Parent.Body.Dash.DashSc.G.Modes.SpeedStats.Visible = true
script.Parent.Parent.Body.Dash.DashSc.G.Unit.Visible = false
script.Parent.Parent.Body.Dash.Screen.G.Startup.Visible = false
script.Parent.Parent.Body.Dash.Screen.G.Caution.Visible = true
wait(6)
script.Parent.Parent.Body.Dash.Screen.G.Caution.Visible = false
|
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
|
local MainFrame = Instance.new("Frame")
MainFrame.Name = "MainFrame"
MainFrame.Size = UDim2.new(1, -1 * ScrollBarWidth, 1, 0)
MainFrame.Position = UDim2.new(0, 0, 0, 0)
MainFrame.BackgroundTransparency = 1
MainFrame.ClipsDescendants = true
MainFrame.Parent = PropertiesFrame
ContentFrame = Instance.new("Frame")
ContentFrame.Name = "ContentFrame"
ContentFrame.Size = UDim2.new(1, 0, 0, 0)
ContentFrame.BackgroundTransparency = 1
ContentFrame.Parent = MainFrame
scrollBar = ScrollBar(false)
scrollBar.PageIncrement = 1
Create(scrollBar.GUI,{
Position = UDim2.new(1,-ScrollBarWidth,0,0);
Size = UDim2.new(0,ScrollBarWidth,1,0);
Parent = PropertiesFrame;
})
scrollBarH = ScrollBar(true)
scrollBarH.PageIncrement = ScrollBarWidth
Create(scrollBarH.GUI,{
Position = UDim2.new(0,0,1,-ScrollBarWidth);
Size = UDim2.new(1,-ScrollBarWidth,0,ScrollBarWidth);
Visible = false;
Parent = PropertiesFrame;
})
do
local listEntries = {}
local nameConnLookup = {}
function scrollBar.UpdateCallback(self)
scrollBar.TotalSpace = ContentFrame.AbsoluteSize.Y
scrollBar.VisibleSpace = MainFrame.AbsoluteSize.Y
ContentFrame.Position = UDim2.new(ContentFrame.Position.X.Scale,ContentFrame.Position.X.Offset,0,-1*scrollBar.ScrollIndex)
end
function scrollBarH.UpdateCallback(self)
end
MainFrame.Changed:connect(function(p)
if p == 'AbsoluteSize' then
scrollBarH.VisibleSpace = math.ceil(MainFrame.AbsoluteSize.x)
scrollBarH:Update()
scrollBar.VisibleSpace = math.ceil(MainFrame.AbsoluteSize.y)
scrollBar:Update()
end
end)
local wheelAmount = Row.Height
PropertiesFrame.MouseWheelForward:connect(function()
if scrollBar.VisibleSpace - 1 > wheelAmount then
scrollBar:ScrollTo(scrollBar.ScrollIndex - wheelAmount)
else
scrollBar:ScrollTo(scrollBar.ScrollIndex - scrollBar.VisibleSpace)
end
end)
PropertiesFrame.MouseWheelBackward:connect(function()
if scrollBar.VisibleSpace - 1 > wheelAmount then
scrollBar:ScrollTo(scrollBar.ScrollIndex + wheelAmount)
else
scrollBar:ScrollTo(scrollBar.ScrollIndex + scrollBar.VisibleSpace)
end
end)
end
scrollBar.VisibleSpace = math.ceil(MainFrame.AbsoluteSize.y)
scrollBar:Update()
showProperties(GetSelection())
bindSelectionChanged.Event:connect(function()
showProperties(GetSelection())
end)
bindSetAwait.Event:connect(function(obj)
if AwaitingObjectValue then
AwaitingObjectValue = false
local mySel = obj
if mySel then
pcall(function()
Set(AwaitingObjectObj, AwaitingObjectProp, mySel)
end)
end
end
end)
propertiesSearch:GetPropertyChangedSignal("Text"):Connect(function()
showProperties(GetSelection())
end)
bindGetApi.OnInvoke = function()
return RbxApi
end
bindGetAwait.OnInvoke = function()
return AwaitingObjectValue
end
|
-- Set first join time
|
function Main:SetFirstJoinTime(newTime: number)
self.FirstJoinTime = newTime
self.Data.FirstJoinTime = newTime
return newTime
end
|
--local ClickerModule = require(343254562)
--local clickEvent = ClickerModule.RemoteEvent
|
local interactiveParts = {}
local activationDistance = 12
local flushing = false
local water = script.Parent.Parent.Water
local sound = script.Parent.Parent.ToiletBowl.Sound
sound:Play()
wait(0.885)
for i, v in pairs(script.Parent.Parent:GetChildren()) do
if v.Name == "WaterSwirl" then
v.ParticleEmitter.Transparency = NumberSequence.new(0.55)
v.ParticleEmitter.Rate = 500
end
end
for i = 1, 4 do
water.CFrame = water.CFrame * CFrame.new(0, 0.01, 0)
wait()
end
wait(4.05)
for i = 1, 10 do
for ii, v in pairs(script.Parent.Parent:GetChildren()) do
if v.Name == "WaterSwirl" then
v.ParticleEmitter.Transparency = NumberSequence.new(0.55 + (0.015 * i))
if i == 10 then
v.ParticleEmitter.Rate = 0
end
end
end
wait(0)
end
wait(1.22)
for i = 1, 52 do
water.Mesh.Scale = water.Mesh.Scale + Vector3.new(-0.007, 0, -0.007)
water.CFrame = water.CFrame * CFrame.new(0, -0.007, 0)
wait()
end
if script.Parent.Parent.ToiletUsed.Value == true then
water.BrickColor = BrickColor.new("Pastel yellow")
end
wait(0.5)
script.Parent.Parent.ToiletUsed.Value = false
water.BrickColor = BrickColor.new("Fog")
for i = 1, 52 do
water.Mesh.Scale = water.Mesh.Scale + Vector3.new(0.0066, 0, 0.0066)
water.CFrame = water.CFrame * CFrame.new(0, 0.0066, 0)
wait()
end
water.CFrame = script.Parent.Parent.WaterResetPos.CFrame
water.Mesh.Scale = Vector3.new(1,0,1)
flushing = false
script.Disabled = true
|
--[=[
@within TableUtil
@function Keys
@param tbl table
@return table
Returns an array with all the keys in the table.
```lua
local t = {A = 10, B = 20, C = 30}
local keys = TableUtil.Keys(t)
print(keys) --> {"A", "B", "C"}
```
:::caution Ordering
The ordering of the keys is never guaranteed. If order is imperative, call
`table.sort` on the resulting `keys` array.
```lua
local keys = TableUtil.Keys(t)
table.sort(keys)
```
]=]
|
local function Keys(tbl: Table): Table
local keys = table.create(#tbl)
for k in pairs(tbl) do
table.insert(keys, k)
end
return keys
end
|
--wait(math.random(0,5)/10)
|
while true do
game:GetService("RunService").Stepped:Wait()
local target = workspace:FindFirstChild(script.Parent.TargetName.Value)--findNearestTorso(script.Parent:WaitForChild("HumanoidRootPart").Position)
if target ~= nil and target:FindFirstChild("HumanoidRootPart") ~= nil then
target = target:FindFirstChild("HumanoidRootPart")
--script.Parent.Humanoid:MoveTo(target.Position, target)
script.Parent.HumanoidRootPart.CFrame = CFrame.new(script.Parent.HumanoidRootPart.Position,target.Position)
script.Parent.HumanoidRootPart.CFrame = script.Parent.HumanoidRootPart.CFrame + (script.Parent.HumanoidRootPart.CFrame.LookVector) / Vector3.new(3.5,3.5,3.5)
if target ~= nil and (target.Position - script.Parent.HumanoidRootPart.Position).Magnitude < 0.5 then
target.Parent.Humanoid.Health = 0
script.Parent:Destroy()
wait()
end
end
end
|
-- Simple realistic suspension script (<100 lines), put inside your car
-- Inside your A-Chassis Tune make sure to change both susAngles to 75 for best results
|
local Wheels = script.Parent.Wheels:GetChildren()
local fSprings = {Wheels[1]:WaitForChild("Spring"), Wheels[2]:WaitForChild("Spring")} -- FL, FR
local rSprings = {Wheels[3]:WaitForChild("Spring"), Wheels[4]:WaitForChild("Spring")} -- RL, RR
local customSettings = {
Thickness = 0.12;
MaxLength = 4; -- Make sure "LimitsEnabled" is true
MinLength = 0.05; -- Make sure "LimitsEnabled" is true
Damping = 180; -- For a less responsive suspension increase this value
FreeLength = 2.5; -- This determines the stance
LimitsEnabled = false;
MaxForce = 50000;
Stiffness = 4500; -- If you have a race car then increase this value
}
|
-- FEATURE METHODS
|
function Icon:bindEvent(iconEventName, eventFunction)
local event = self[iconEventName]
assert(event and typeof(event) == "table" and event.Connect, "argument[1] must be a valid topbarplus icon event name!")
assert(typeof(eventFunction) == "function", "argument[2] must be a function!")
self._bindedEvents[iconEventName] = event:Connect(function(...)
eventFunction(self, ...)
end)
return self
end
function Icon:unbindEvent(iconEventName)
local eventConnection = self._bindedEvents[iconEventName]
if eventConnection then
eventConnection:Disconnect()
self._bindedEvents[iconEventName] = nil
end
return self
end
function Icon:bindToggleKey(keyCodeEnum)
assert(typeof(keyCodeEnum) == "EnumItem", "argument[1] must be a KeyCode EnumItem!")
self._bindedToggleKeys[keyCodeEnum] = true
return self
end
function Icon:unbindToggleKey(keyCodeEnum)
assert(typeof(keyCodeEnum) == "EnumItem", "argument[1] must be a KeyCode EnumItem!")
self._bindedToggleKeys[keyCodeEnum] = nil
return self
end
function Icon:lock()
self.locked = true
return self
end
function Icon:unlock()
self.locked = false
return self
end
function Icon:setTopPadding(offset, scale)
local newOffset = offset or 4
local newScale = scale or 0
self.topPadding = UDim.new(newScale, newOffset)
self.updated:Fire()
return self
end
function Icon:bindToggleItem(guiObjectOrLayerCollector)
if not guiObjectOrLayerCollector:IsA("GuiObject") and not guiObjectOrLayerCollector:IsA("LayerCollector") then
error("Toggle item must be a GuiObject or LayerCollector!")
end
self.toggleItems[guiObjectOrLayerCollector] = true
return self
end
function Icon:unbindToggleItem(guiObjectOrLayerCollector)
self.toggleItems[guiObjectOrLayerCollector] = nil
return self
end
function Icon:_setToggleItemsVisible(bool, byIcon)
for toggleItem, _ in pairs(self.toggleItems) do
if not byIcon or byIcon.toggleItems[toggleItem] == nil then
local property = "Visible"
if toggleItem:IsA("LayerCollector") then
property = "Enabled"
end
toggleItem[property] = bool
end
end
end
function Icon:give(userdata)
local valueToGive = userdata
if typeof(userdata) == "function" then
local returnValue = userdata(self)
if typeof(userdata) ~= "function" then
valueToGive = returnValue
else
valueToGive = nil
end
end
if valueToGive ~= nil then
self._maid:give(valueToGive)
end
return self
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.