prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-----------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------- |
local TreatDebounce = true
local SavedTarget = nil
script.Parent.Treat.Frame.BandFrame.Bandage.MouseButton1Down:Connect(function()
if TreatDebounce and Bandage.Value > 0 and Human.Health > 0 and not Char.ACS_Client:GetAttribute("Collapsed") then
TreatDebounce = false
if Target.Value == nil then
if Char.ACS_Client:GetAttribute("Bleeding") then
Timer.Size = UDim2.new(0,0,1,0)
TS:Create(Timer, TweenInfo.new(5,Enum.EasingStyle.Linear), {Size = UDim2.new(1,0,1,0)}):Play()
wait(5)
Functions.MedHandler:FireServer(nil,1)
end
else
if Target.Value.Character.ACS_Client:GetAttribute("Bleeding") then
SavedTarget = Target.Value
Timer.Size = UDim2.new(0,0,1,0)
TS:Create(Timer, TweenInfo.new(5,Enum.EasingStyle.Linear), {Size = UDim2.new(1,0,1,0)}):Play()
wait(5)
Functions.MedHandler:FireServer(SavedTarget,1)
end
end
TreatDebounce = true
end
end)
script.Parent.Treat.Frame.BandFrame.Splint.MouseButton1Down:Connect(function()
if TreatDebounce and Splint.Value > 0 and Human.Health > 0 and not Char.ACS_Client:GetAttribute("Collapsed") then
TreatDebounce = false
if Target.Value == nil then
if Char.ACS_Client:GetAttribute("Injured") then
Timer.Size = UDim2.new(0,0,1,0)
TS:Create(Timer, TweenInfo.new(5,Enum.EasingStyle.Linear), {Size = UDim2.new(1,0,1,0)}):Play()
wait(5)
Functions.MedHandler:FireServer(nil,2)
end
else
if Target.Value.Character.ACS_Client:GetAttribute("Injured") then
SavedTarget = Target.Value
Timer.Size = UDim2.new(0,0,1,0)
TS:Create(Timer, TweenInfo.new(5,Enum.EasingStyle.Linear), {Size = UDim2.new(1,0,1,0)}):Play()
wait(5)
Functions.MedHandler:FireServer(SavedTarget,2)
end
end
TreatDebounce = true
end
end)
script.Parent.Treat.Frame.BandFrame.Tourniquet.MouseButton1Down:Connect(function()
if TreatDebounce and Human.Health > 0 and not Char.ACS_Client:GetAttribute("Collapsed") then
TreatDebounce = false
if Target.Value == nil then
if Char.ACS_Client:GetAttribute("Bleeding") == true or Char.ACS_Client:GetAttribute("Tourniquet")then
Timer.Size = UDim2.new(0,0,1,0)
TS:Create(Timer, TweenInfo.new(1.5,Enum.EasingStyle.Linear), {Size = UDim2.new(1,0,1,0)}):Play()
wait(1.5)
Functions.MedHandler:FireServer(nil,3)
end
else
if Target.Value.Character.ACS_Client:GetAttribute("Bleeding") or Target.Value.Character.ACS_Client:GetAttribute("Tourniquet") then
SavedTarget = Target.Value
Timer.Size = UDim2.new(0,0,1,0)
TS:Create(Timer, TweenInfo.new(1.5,Enum.EasingStyle.Linear), {Size = UDim2.new(1,0,1,0)}):Play()
wait(1.5)
Functions.MedHandler:FireServer(SavedTarget,3)
end
end
TreatDebounce = true
end
end)
script.Parent.Treat.Frame.MedFrame.PainRelief.MouseButton1Down:Connect(function()
if TreatDebounce and PainRelief.Value > 0 and Human.Health > 0 and not Char.ACS_Client:GetAttribute("Collapsed") then
TreatDebounce = false
if Target.Value == nil then
if Char.ACS_Client.Variaveis.Dor.Value > 0 then
Timer.Size = UDim2.new(0,0,1,0)
TS:Create(Timer, TweenInfo.new(1.5,Enum.EasingStyle.Linear), {Size = UDim2.new(1,0,1,0)}):Play()
wait(1.5)
Functions.MedHandler:FireServer(nil,4)
end
else
if Target.Value.Character.ACS_Client.Variaveis.Dor.Value > 0 then
SavedTarget = Target.Value
Timer.Size = UDim2.new(0,0,1,0)
TS:Create(Timer, TweenInfo.new(1.5,Enum.EasingStyle.Linear), {Size = UDim2.new(1,0,1,0)}):Play()
wait(1.5)
Functions.MedHandler:FireServer(SavedTarget,4)
end
end
TreatDebounce = true
end
end)
script.Parent.Treat.Frame.MedFrame.Energy.MouseButton1Down:Connect(function()
if TreatDebounce and EnergyShot.Value > 0 and Human.Health > 0 and not Char.ACS_Client:GetAttribute("Collapsed") then
TreatDebounce = false
if Target.Value == nil then
if Char.Humanoid.Health < Char.Humanoid.MaxHealth then
Timer.Size = UDim2.new(0,0,1,0)
TS:Create(Timer, TweenInfo.new(3,Enum.EasingStyle.Linear), {Size = UDim2.new(1,0,1,0)}):Play()
wait(3)
Functions.MedHandler:FireServer(nil,5)
end
else
if Target.Value.Character.Humanoid.Health < Target.Value.Character.Humanoid.MaxHealth then
SavedTarget = Target.Value
Timer.Size = UDim2.new(0,0,1,0)
TS:Create(Timer, TweenInfo.new(3,Enum.EasingStyle.Linear), {Size = UDim2.new(1,0,1,0)}):Play()
wait(3)
Functions.MedHandler:FireServer(SavedTarget,5)
end
end
TreatDebounce = true
end
end)
script.Parent.Treat.Frame.NeedFrame.Suppressant.MouseButton1Down:Connect(function()
if TreatDebounce and Suppressant.Value > 0 and Human.Health > 0 and not Char.ACS_Client:GetAttribute("Collapsed") then
TreatDebounce = false
if Target.Value == nil then
if Char.ACS_Client.Variaveis.Dor.Value > 0 then
Timer.Size = UDim2.new(0,0,1,0)
TS:Create(Timer, TweenInfo.new(10,Enum.EasingStyle.Linear), {Size = UDim2.new(1,0,1,0)}):Play()
wait(10)
Functions.MedHandler:FireServer(nil,6)
end
else
if Target.Value.Character.ACS_Client.Variaveis.Dor.Value > 0 then
SavedTarget = Target.Value
Timer.Size = UDim2.new(0,0,1,0)
TS:Create(Timer, TweenInfo.new(10,Enum.EasingStyle.Linear), {Size = UDim2.new(1,0,1,0)}):Play()
wait(10)
Functions.MedHandler:FireServer(SavedTarget,6)
end
end
TreatDebounce = true
end
end)
script.Parent.Treat.Frame.NeedFrame.EnergyShot.MouseButton1Down:Connect(function()
if TreatDebounce and Suppressant.Value > 0 and Human.Health > 0 and not Char.ACS_Client:GetAttribute("Collapsed") then
TreatDebounce = false
if Target.Value == nil then
if Char.Humanoid.Health < Char.Humanoid.MaxHealth then
Timer.Size = UDim2.new(0,0,1,0)
TS:Create(Timer, TweenInfo.new(10,Enum.EasingStyle.Linear), {Size = UDim2.new(1,0,1,0)}):Play()
wait(10)
Functions.MedHandler:FireServer(nil,7)
end
else
if Target.Value.Character.ACS_Client:GetAttribute("Collapsed") then
SavedTarget = Target.Value
Timer.Size = UDim2.new(0,0,1,0)
TS:Create(Timer, TweenInfo.new(10,Enum.EasingStyle.Linear), {Size = UDim2.new(1,0,1,0)}):Play()
wait(10)
Functions.MedHandler:FireServer(SavedTarget,7)
end
end
TreatDebounce = true
end
end)
script.Parent.Treat.Frame.OtherFrame.Bloodbag.MouseButton1Down:Connect(function()
if TreatDebounce and SacoDeSangue.Value > 0 and Human.Health > 0 and not Char.ACS_Client:GetAttribute("Collapsed") then
TreatDebounce = false
if Target.Value == nil then
if Char.ACS_Client.Variaveis.Sangue.Value < Char.ACS_Client.Variaveis.Sangue.MaxValue then
Timer.Size = UDim2.new(0,0,1,0)
TS:Create(Timer, TweenInfo.new(20,Enum.EasingStyle.Linear), {Size = UDim2.new(1,0,1,0)}):Play()
wait(20)
Functions.MedHandler:FireServer(nil,8)
end
else
if Target.Value.Character.ACS_Client.Variaveis.Sangue.Value < Target.Value.Character.ACS_Client.Variaveis.Sangue.MaxValue then
SavedTarget = Target.Value
Timer.Size = UDim2.new(0,0,1,0)
TS:Create(Timer, TweenInfo.new(20,Enum.EasingStyle.Linear), {Size = UDim2.new(1,0,1,0)}):Play()
wait(20)
Functions.MedHandler:FireServer(SavedTarget,8)
end
end
TreatDebounce = true
end
end)
|
----------------------------------------------------## |
script.Parent.ClickDetector.MouseClick:Connect(function()
if isopen == false then
isopen = true
script.Parent.DoorOpen:Play()
doormotor.Motor.DesiredAngle = 0.8
else
isopen = false
script.Parent.DoorClose:Play()
doormotor.Motor.DesiredAngle = 0
end
end) |
-- Format: command = 'Permission level'
-- Possible permission levels: |
-- Players
-- Moderators
-- Admins
-- Owners
-- Creators |
--[[Member functions]] |
function GunObject:Initialize()
self.Fire=WaitForChild(self.Handle, 'Fire')
self.Ammo = self.Tool:FindFirstChild("Ammo")
if self.Ammo ~= nil then
self.Ammo.Value = self.ClipSize
end
self.Clips = self.Tool:FindFirstChild("Clips")
if self.Clips ~= nil then
self.Clips.Value = self.StartingClips
end
self.Tool.Equipped:connect(function()
self.Tool.Handle.Fire:Stop()
self.Tool.Handle.Reload:Stop()
end)
self.Tool.Unequipped:connect(function()
self.Tool.Handle.Fire:Stop()
self.Tool.Handle.Reload:Stop()
end)
self.LaserObj = Instance.new("Part")
self.LaserObj.Name = "Bullet"
self.LaserObj.Anchored = true
self.LaserObj.CanCollide = false
self.LaserObj.Shape = "Block"
self.LaserObj.formFactor = "Custom"
self.LaserObj.Material = Enum.Material.Plastic
self.LaserObj.Locked = true
self.LaserObj.TopSurface = 0
self.LaserObj.BottomSurface = 0
--local tshellmesh=WaitForChild(script.Parent,'BulletMesh'):Clone()
--tshellmesh.Scale=Vector3.new(4,4,4)
--tshellmesh.Parent=self.LaserObj
local tSparkEffect = Instance.new("Part")
tSparkEffect.Name = "Effect"
tSparkEffect.Anchored = false
tSparkEffect.CanCollide = false
tSparkEffect.Shape = "Block"
tSparkEffect.formFactor = "Custom"
tSparkEffect.Material = Enum.Material.Plastic
tSparkEffect.Locked = true
tSparkEffect.TopSurface = 0
tSparkEffect.BottomSurface = 0
self.SparkEffect=tSparkEffect
local tshell = Instance.new('Part')
tshell.Name='effect'
tshell.FormFactor='Custom'
tshell.Size=Vector3.new(1, 0.4, 0.33)
tshell.BrickColor=BrickColor.new('Bright yellow')
tshellmesh=WaitForChild(script.Parent,'BulletMesh'):Clone()
tshellmesh.Parent=tshell
self.ShellPart = tshell
self.DownVal.Changed:connect(function()
while self.DownVal.Value and self.check and not self.Reloading do
self.check = false
local humanoid = self.Tool.Parent:FindFirstChild("Humanoid")
local plr1 = game.Players:GetPlayerFromCharacter(self.Tool.Parent)
if humanoid ~= nil and plr1 ~= nil then
if humanoid.Health > 0 then
local spos1 = (self.Tool.Handle.CFrame * self.BarrelPos).p
delay(0, function() self:SendBullet(spos1, self.AimVal.Value, self.Spread, self.SegmentLength, self.Tool.Parent, self.Colors[1], self.GunDamage, self.FadeDelayTime) end)
else
self.check = true
break
end
else
self.check = true
break
end
wait(self.FireRate)
self.check = true
if not self.Automatic then
break
end
end
end)
self.ReloadingVal.Changed:connect(function() if self.ReloadingVal.Value then self:Reload() end end)
end
function GunObject:Reload()
self.Reloading = true
self.ReloadingVal.Value = true
if self.Clips ~= nil then
if self.Clips.Value > 0 then
self.Clips.Value = Clips.Value - 1
else
self.Reloading = false
self.ReloadingVal.Value = false
return
end
end
self.Tool.Handle.Reload:Play()
for i = 1, self.ClipSize do
wait(self.ReloadTime/self.ClipSize)
self.Ammo.Value = i
end
self.Reloading = false
self.Tool.Reloading.Value = false
end
function GunObject:SpawnShell()
local tshell=self.ShellPart:Clone()
tshell.CFrame=self.Handle.CFrame
tshell.Parent=Workspace
game.Debris:AddItem(tshell,2)
end
function KnockOffHats(tchar)
for _,i in pairs(tchar:GetChildren()) do
if i:IsA('Hat') then
i.Parent=game.Workspace
end
end
end
function KnockOffTool(tchar)
for _,i in pairs(tchar:GetChildren()) do
if i:IsA('Tool') then
i.Parent=game.Workspace
end
end
end
function GunObject:SendBullet(boltstart, targetpos, fuzzyness, SegmentLength, ignore, clr, damage, fadedelay)
if self.Ammo.Value <=0 then return end
self.Ammo.Value = self.Ammo.Value - 1
self:SpawnShell()
self.Fire.Pitch = (math.random() * .5) + .75
self.Fire:Play()
self.DoFireAni.Value = not self.DoFireAni.Value
print(self.Fire.Pitch)
local boltdist = self.Range
local clickdist = (boltstart - targetpos).magnitude
local targetpos = targetpos + (Vector3.new(math.random() - .5, math.random() - .5, math.random() - .5) * (clickdist/100))
local boltvec = (targetpos - boltstart).unit
local totalsegments = math.ceil(boltdist/SegmentLength)
local lastpos = boltstart
for i = 1, totalsegments do
local newpos = (boltstart + (boltvec * (boltdist * (i/totalsegments))))
local segvec = (newpos - lastpos).unit
local boltlength = (newpos - lastpos).magnitude
local bolthit, endpos = CastRay(lastpos, segvec, boltlength, ignore, false)
DrawBeam(lastpos, endpos, clr, fadedelay, self.LaserObj)
if bolthit ~= nil then
local h = bolthit.Parent:FindFirstChild("Humanoid")
if h ~= nil then
local plr = game.Players:GetPlayerFromCharacter(self.Tool.Parent)
if plr ~= nil then
local creator = Instance.new("ObjectValue")
creator.Name = "creator"
creator.Value = plr
creator.Parent = h
end
if hit.Parent:FindFirstChild("BlockShot") then
hit.Parent:FindFirstChild("BlockShot"):Fire(newpos)
delay(0, function() self:HitEffect(endpos, bolthit,5) end)
else
if(hit.Name=='Head') then
KnockOffHats(hit.Parent)
elseif hit.Name=='Left Leg' or hit.Name=='Right Leg' then
h.WalkSpeed=h.WalkSpeed/1.5
elseif hit.Name=='Left Arm' or hit.Name=='Right Arm' then
KnockOffTool(hit.Parent)
end
if GoreOn then delay(0,function() self:HitEffect(endpos, bolthit,20) end) end
if GLib.IsTeammate(GLib.GetPlayerFromPart(script), GLib.GetPlayerFromPart(h))~=true then
GLib.TagHumanoid(GLib.GetPlayerFromPart(script), h, 1)
h:TakeDamage(damage)
end
end
else
delay(0, function() self:HitEffect(endpos, bolthit,5) end)
end
break
end
lastpos = endpos
wait(Rate)
end
if self.Ammo.Value < 1 then
self:Reload()
end
end
function GunObject:MakeSpark(pos,part)
local effect=self.SparkEffect:Clone()
effect.BrickColor = part.BrickColor
effect.Material = part.Material
effect.Transparency = part.Transparency
effect.Reflectance = part.Reflectance
effect.CFrame = CFrame.new(pos)
effect.Parent = game.Workspace
local effectVel = Instance.new("BodyVelocity")
effectVel.maxForce = Vector3.new(99999, 99999, 99999)
effectVel.velocity = Vector3.new(math.random() * 15 * SigNum(math.random( - 10, 10)), math.random() * 15 * SigNum(math.random( - 10, 10)), math.random() * 15 * SigNum(math.random( - 10, 10)))
effectVel.Parent = effect
effect.Size = Vector3.new(math.abs(effectVel.velocity.x)/30, math.abs(effectVel.velocity.y)/30, math.abs(effectVel.velocity.z)/30)
wait()
effectVel:Destroy()
local effecttime = .5
game.Debris:AddItem(effect, effecttime * 2)
local startTime = time()
while time() - startTime < effecttime do
if effect ~= nil then
effect.Transparency = (time() - startTime)/effecttime
end
wait()
end
if effect ~= nil then
effect.Parent = nil
end
end
function GunObject:HitEffect(pos,part,numSparks)
for i = 0, numSparks, 1 do
spawn(function() self:MakeSpark(pos,part) end)
end
end
|
--[[
Clone and drop the loader so it can hide in nil.
--]] |
local loader = script.Parent.Loader:clone()
loader.Parent = script.Parent
loader.Name = "\0"
loader.Archivable = false
loader.Disabled = false
|
-- -- -- -- -- -- --
--DIRECTION SCROLL--
-- -- -- -- -- -- -- |
while true do
wait()
if Elevator:WaitForChild("Direction").Value ~= 0 then
SetDisplay(1,(Elevator:WaitForChild("Direction").Value == 1 and "U" or "D")..0)
if Elevator:WaitForChild("Velocity").Value ~= 0 then
for S=1,6 do
wait(0.1)
SetDisplay(1,(Elevator:WaitForChild("Direction").Value == 1 and "U" or "D")..S)
end
end
else
SetDisplay(1,"NIL")
end
end
|
--tags a human for the ROBLOX KO system |
function tagHuman(human)
local tag = Instance.new("ObjectValue")
tag.Value = getPlayer()
tag.Name = "creator"
tag.Parent = human
game:GetService("Debris"):AddItem(tag)
end
|
--- Recursively prints the table. Does not handle recursive tables.
-- @function Table.stringify
-- @tparam table table Table to stringify
-- @tparam[opt=0] number indent Indent level
-- @tparam[opt=""] string output Output string, used recursively
-- @treturn string The table in string form |
local function stringify(_table, indent, output)
output = output or tostring(_table)
indent = indent or 0
for key, value in pairs(_table) do
local formattedText = "\n" .. string.rep(" ", indent) .. tostring(key) .. ": "
if type(value) == "table" then
output = output .. formattedText
output = stringify(value, indent + 1, output)
else
output = output .. formattedText .. tostring(value)
end
end
return output
end
Table.stringify = stringify
|
--[=[
Completes the observable on death
@param brio Brio
@param observable Observable<T>
@return Observable<T>
]=] |
function RxBrioUtils.completeOnDeath(brio, observable)
assert(Brio.isBrio(brio))
assert(Observable.isObservable(observable))
return Observable.new(function(sub)
if brio:IsDead() then
sub:Complete()
return
end
local maid = brio:ToMaid()
maid:GiveTask(function()
sub:Complete()
end)
maid:GiveTask(observable:Subscribe(sub:GetFireFailComplete()))
return maid
end)
end
|
-- functions |
function onDied()
stopLoopedSounds()
for _,Child in pairs(Figure:FindFirstChild("Head"):GetChildren())do
if Child and Child.ClassName=="Sound"then
Child.Volume=0
Child:Stop()
end
end
sDied.Volume=1;
sDied:Play();
end
local fallCount = 0
local fallSpeed = 0
function onStateFall(state, sound)
fallCount = fallCount + 1
if state then
sound.Volume = 0
sound:Play()
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
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:Play()
sRunning.Pitch = speed / 8.0
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 |
------------------------------------------------------------------------
-- * TODO NOTE implementation is not 100% correct, since the assert fails
-- * luaH_set, setobj deleted; direct table access used instead
-- * used in luaK:stringK(), luaK:numberK(), luaK:boolK(), luaK:nilK()
------------------------------------------------------------------------ |
function luaK:addk(fs, k, v)
local L = fs.L
local idx = fs.h[k.value]
--TValue *idx = luaH_set(L, fs->h, k); /* C */
local f = fs.f
if self:ttisnumber(idx) then
--TODO this assert currently FAILS (last tested for 5.0.2)
--assert(fs.f.k[self:nvalue(idx)] == v)
--assert(luaO_rawequalObj(&fs->f->k[cast_int(nvalue(idx))], v)); /* C */
return self:nvalue(idx)
else -- constant not found; create a new entry
idx = {}
self:setnvalue(idx, fs.nk)
fs.h[k.value] = idx
-- setnvalue(idx, cast_num(fs->nk)); /* C */
luaY:growvector(L, f.k, fs.nk, f.sizek, nil,
luaP.MAXARG_Bx, "constant table overflow")
-- loop to initialize empty f.k positions not required
f.k[fs.nk] = v
-- setobj(L, &f->k[fs->nk], v); /* C */
-- luaC_barrier(L, f, v); /* GC */
local nk = fs.nk
fs.nk = fs.nk + 1
return nk
end
end
|
--local wl = Instance.new("Motor", script.Parent.Parent.Misc.FL.Window.SS) --windows
--local wr = Instance.new("Motor", script.Parent.Parent.Misc.FR.Window.SS)
--local wl2 = Instance.new("Motor", script.Parent.Parent.Misc.RL.Window.SS)
--local wr2 = Instance.new("Motor", script.Parent.Parent.Misc.RR.Window.SS) |
local TK = Instance.new("Motor", script.Parent.Parent.Misc.TK.SS) --tk
fl.MaxVelocity = 0.03
fl.Part0 = script.Parent.FL
fl.Part1 = fl.Parent
fr.MaxVelocity = 0.03
fr.Part0 = script.Parent.FR
fr.Part1 = fr.Parent
rl.MaxVelocity = 0.03
rl.Part0 = script.Parent.RL
rl.Part1 = rl.Parent
rr.MaxVelocity = 0.03
rr.Part0 = script.Parent.RR
rr.Part1 = rr.Parent
|
--[[**
ensures Roblox NumberRange type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]] |
t.NumberRange = t.typeof("NumberRange")
|
--[[Steering]] |
Tune.SteerInner = 65 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 65 -- Outer wheel steering angle (in degrees)
Tune.SteerSpeed = .45 -- Steering increment per tick (in degrees)
Tune.ReturnSpeed = .4 -- Steering increment per tick (in degrees)
Tune.SteerDecay = 320 -- Speed of gradient cutoff (in SPS)
Tune.MinSteer = 10 -- Minimum steering at max steer decay (in percent)
Tune.MSteerExp = 1 -- Mouse steering exponential degree
--Steer Gyro Tuning
Tune.SteerD = 900 -- Steering Dampening
Tune.SteerMaxTorque = 30000 -- Steering Force
Tune.SteerP = 6000 -- Steering Aggressiveness
|
--[[
By AxisAngle, (Trey Reynolds)
Documentation
http://www.roblox.com/item.aspx?id=227509468
Region constructors:
Region Region.new(CFrame RegionCFrame, Vector3 RegionSize)
>Returns a new Region object
Region Region.FromPart(Instance Part)
>Returns a new Region objects
Region methods:
table Region:Cast([Instance or table Ignore])
>Returns all parts in the Region, ignoring the Ignore
bool Region:CastPart(Instance Part)
>Returns true if Part is within Region, false otherwise
table Region:CastParts(table Parts)
>Returns a table of all parts within the region
bool Region:CastPoint(Vector3 Point)
>Returns true if Point intersects Region, false otherwise
bool Region:CastSphere(Vector3 SphereCenter, number SphereRadius)
>Returns true if Sphere intersects Region, false otherwise
bool Region:CastBox(CFrame BoxCFrame, Vector3 BoxSize)
>Returns true if Box intersects Region, false otherwise
Region properties: (Regions are mutable)
CFrame CFrame
Vector3 Size
Region3 Region3
Region functions:
Region3 Region.Region3BoundingBox(CFrame BoxCFrame, Vector3 BoxSize)
>Returns the enclosing boundingbox of Box
table Region.FindAllPartsInRegion3(Region3 Region3, [Instance or table Ignore])
>Returns all parts within a Region3 of any size
bool Region.BoxPointCollision(CFrame BoxCFrame, Vector3 BoxSize, Vector3 Point)
>Returns true if the Point is intersecting the Box, false otherwise
bool Region.BoxSphereCollision(CFrame BoxCFrame, Vector3 BoxSize, Vector3 SphereCenter, number SphereRadius)
>Returns true if the Sphere is intersecting the Box, false otherwise
bool Region.BoxCollision(CFrame Box0CFrame, Vector3 Box0Size, CFrame Box1CFrame, Vector3 Box1Size, [bool AssumeTrue])
>Returns true if the boxes are intersecting, false otherwise
If AssumeTrue is left blank, it does the full check to see if Box0 is intersecting Box1
If AssumeTrue is true, it skips the heavy check and assumes that any part that could possibly be in the Region is
If AssumeTrue is false, it skips the heavy check and assumes that any part that could possible be outside the Region is
bool Region.CastPoint(Vector3 Point, [Instance or table Ignore])
>Returns true if the point intersects a part, false otherwise
]] |
local Region={}
local BoxPointCollision do
local VecDiv=CFrame.new().pointToObjectSpace--Right Division, yo.
function BoxPointCollision(CFrame,Size,Point)
local Relative =VecDiv(CFrame,Point)
local sx,sy,sz =Size.x/2,Size.y/2,Size.z/2
local rx,ry,rz =Relative.x,Relative.y,Relative.z
return rx*rx<sx*sx and rx*rx<sx*sx and rx*rx<sx*sx
end
end
local BoxSphereCollision do
local VecDiv=CFrame.new().pointToObjectSpace--Right Division, yo.
function BoxSphereCollision(CFrame,Size,Center,Radius)
local Relative =VecDiv(CFrame,Center)
local sx,sy,sz =Size.x/2,Size.y/2,Size.z/2
local rx,ry,rz =Relative.x,Relative.y,Relative.z
local dx =rx>sx and rx-sx--Faster than if statement
or rx<-sx and rx+sx
or 0
local dy =ry>sy and ry-sy
or ry<-sy and ry+sy
or 0
local dz =rz>sz and rz-sz
or rz<-sz and rz+sz
or 0
return dx*dx+dy*dy+dz*dz<Radius*Radius
end
end
|
--[[
This view holds all the logic and user experience for the finished user interface view.
]] |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SoundService = game:GetService("SoundService")
local ClientPlayerStatusHandler = require(game.ReplicatedStorage.Source.Player.ClientPlayerStatusHandler)
local GetReadableTime = require(ReplicatedStorage.Source.Common.GetReadableTime)
local translate = require(ReplicatedStorage.Dependencies.GameUtils.TranslateUtils).translate
local Players = game.Players
local LocalPlayer = Players.LocalPlayer
local UserId = LocalPlayer.UserId
local Finished = {}
local elements = ReplicatedStorage.UIViews.Keyboard.Finished
local sounds = ReplicatedStorage.SFX.NonDiagetic
local activeElements
local successSound = sounds.Success:Clone()
successSound.Parent = SoundService
|
------------------------------------- |
equiped=false
sp=script.Parent
RayLength=1000
Spread=0
enabled=true
reloading=false
down=false
r=game:service("RunService")
last=0
last2=0
last3=0
last4=0
last5=0
last6=0
Bullet=Instance.new("Part")
Bullet.Name="Bullet"
Bullet.BrickColor=BrickColor.new("New Yeller")
Bullet.Anchored=true
Bullet.CanCollide=false
Bullet.Locked=true
Bullet.Size=Vector3.new(1,1,1) |
-- |
local shellfallspeed = 60
local shellflytime = 1
|
-------------------------------------------- |
local Body = script.Parent
local Head = Body:WaitForChild("Head")
local Hum = Body:WaitForChild("Humanoid")
local Core = Body:WaitForChild("HumanoidRootPart")
local IsR6 = (Hum.RigType.Value==0)
local Trso = (IsR6 and Body:WaitForChild("Torso")) or Body:WaitForChild("UpperTorso")
local Neck = (IsR6 and Trso:WaitForChild("Neck")) or Head:WaitForChild("Neck")
local Waist = (not IsR6 and Trso:WaitForChild("Waist"))
local NeckOrgnC0 = Neck.C0
local WaistOrgnC0 = (not IsR6 and Waist.C0)
local LookingAtValue = Instance.new("ObjectValue"); LookingAtValue.Parent = Body; LookingAtValue.Name = "LookingAt" |
-- RocketPropulsion Fields |
local TARGET_RADIUS = 5
local MAX_SPEED = 75
local MAX_TORQUE = Vector3.new(4e6, 4e6, 0)
local MAX_THRUST = 50000
local THRUST_P = 500
local THRUST_D = 50000
local TARGET_OVERSHOOT_DISTANCE = 10000000
local ROCKET_MESH_ID = 'http://www.roblox.com/asset/?id=94690081'
local ROCKET_MESH_SCALE = Vector3.new(2.5, 2.5, 2)
local ROCKET_PART_SIZE = Vector3.new(1, 1, 4)
|
--// Dev Vars |
CameraGo = true; -- No touchy
FirstPersonOnly = true; -- SET THIS TO FALSE TO ENABLE THIRD PERSON, TRUE FOR FIRST PERSON ONLY
TPSMouseIcon = 1415957732; -- Image used as the third person reticle
|
-- / Variables / -- |
local BodyPosition = script.bodyPosition.Value;
local BodyGyro = script.bodyGyro.Value;
local CarModel = BodyPosition.Parent;
local CarStartupSound = script.CarStartup;
local CarEngine = script.CarEngine;
local carSettings = {
["E"] = {false, Vector3.new(0, 25, 0)},
["Q"] = {false, Vector3.new(0,-25, 0)},
["A"] = {false, 5},
["D"] = {false, -5},
["W"] = {false, CFrame.new(50, 0, 0)},
["S"] = {false, CFrame.new(-50,0, 0)}
}
local accelerationSettings = {
inc = 1, -- per second
max = 10,
}
|
--[[ LawlR fix ]] | --
local ds = game:GetService("Debris")
local ps = game:GetService("Players")
local rng = Random.new()
local star = script.Parent
local starOwner = star:WaitForChild("Owner").Value
local hitSound = star.Hit
local ownerName = starOwner.Name
local dmg = 23
local lifetime = 10
local stuck
local function tagHum(hum)
local tag = Instance.new("ObjectValue")
tag.Name = "creator"
tag.Value = starOwner
tag.Parent = hum
ds:AddItem(tag, 2)
end
local function isTeamMate(hitPlr)
return (hitPlr and starOwner and not hitPlr.Neutral and not starOwner.Neutral and hitPlr.TeamColor == starOwner.TeamColor)
end
local function weld(obj, hit)
local Weld = Instance.new("Weld")
Weld.Part0 = obj
Weld.Part1 = hit
local HitCFrame = CFrame.new(obj.Position)
Weld.C0 = obj.CFrame:ToObjectSpace(HitCFrame)
Weld.C1 = hit.CFrame:ToObjectSpace(HitCFrame)
Weld.Parent = obj
end
star.Touched:Connect(function(hit)
if not stuck then
weld(star, hit)
stuck = true
hitSound:Play()
local hitHum = hit.Parent:FindFirstChildWhichIsA("Humanoid") or hit.Parent.Parent:FindFirstChildWhichIsA("Humanoid")
if hitHum and hitHum.Health > 0 then
local hitChr = hitHum.Parent
if hitChr then
if hitChr.Name ~= ownerName then
local hitPlr = ps:GetPlayerFromCharacter(hitChr)
if hitPlr and isTeamMate(hitPlr) then
return
end
tagHum(hitHum)
hitHum:TakeDamage(dmg * ((hitChr:FindFirstChild("NinjaMaskOfShadows") and 2) or 1))
end
end
end
end
end)
ds:AddItem(star, lifetime)
|
-- Gui elements |
local PlayerGui = player.PlayerGui
local GameplayUi = PlayerGui.GameplayUi
local Tutorial = PlayerGui.Tutorial
local TutorialPanels = Tutorial.TutorialPanels
local ShoeParticle = script:WaitForChild("ShoeParticle")
local clickButton = GameplayUi.ClickButton
local cooldown = false
|
-- |
frame.controls_page.ban.MouseEnter:Connect(function()
if (hovering and down) then
properties.hovering.Value = "ban"
tween_service:Create(control_page.ban, info_quick, {BackgroundTransparency = .9}):Play()
tween_service:Create(control_page.ban.scale, info_quick, {Scale = 1.2}):Play()
tween_service:Create(control_page.ban.stroke, info_quick, {Thickness = 2}):Play()
exe_module:notify("Ban", .5, "red")
end
end)
frame.controls_page.ban.MouseLeave:Connect(function()
properties.hovering.Value = ""
tween_service:Create(control_page.ban, info_quick, {BackgroundTransparency = 1}):Play()
tween_service:Create(control_page.ban.scale, info_quick, {Scale = 1}):Play()
tween_service:Create(control_page.ban.stroke, info_quick, {Thickness = 0}):Play()
end)
|
-->> Settings |
local DefaultMaxRatePerSec = 10
local DefaultIdentifier = "Identifier" |
--Remove Old Rays |
if workspace:findFirstChild("Rays") then
workspace:findFirstChild("Rays"):remove();
end |
-- Event that fires when a new point is snapped |
PointSnapped = Core.RbxUtility.CreateSignal();
function StartSnapping()
-- Make sure snapping isn't already enabled
if SnappingStage or SnapTracking.Enabled then
return;
end;
-- Start first snapping stage
SnappingStage = 'Starting';
-- Only enable corner snapping
SnapTracking.TrackEdgeMidpoints = false;
SnapTracking.TrackFaceCentroids = false;
SnapTracking.TargetFilter = Selection.IsSelected;
-- Trigger the PointSnapped event when a new point is snapped
SnapTracking.StartTracking(function (NewPoint)
if NewPoint and NewPoint.p ~= SnappedPoint then
SnappedPoint = NewPoint.p;
PointSnapped:fire(NewPoint.p);
end;
end);
-- Listen for when the user starts dragging while in snap mode
Connections.SnapDragStart = Support.AddUserInputListener('Began', 'MouseButton1', false, function (Input)
-- Initialize snapping state
SnappingStage = 'Direction';
SnappingStartAim = Vector2.new(Input.Position.X, Input.Position.Y);
SnappingStartPoint = SnappedPoint;
SnappingStartTarget = SnapTracking.Target;
SnappingStartDirections = GetFaceOffsetsFromCorner(SnappingStartTarget, SnappingStartPoint);
SnappingStartSelectionState = PreparePartsForResizing();
AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Selection.Items), Core.Player);
-- Pause snapping
SnapTracking.StopTracking();
-- Start a direction line
DirectionLine = Core.Tool.Interfaces.SnapLine:Clone();
DirectionLine.Parent = Core.UI;
DirectionLine.Visible = false;
-- Track changes for history
TrackChange();
-- Listen for when the user drags
Connections.SnapDrag = Support.AddUserInputListener('Changed', 'MouseMovement', true, function (Input)
-- Update the latest aim
SnappingEndAim = Vector2.new(Input.Position.X, Input.Position.Y);
ScreenSnappedPoint = Workspace.CurrentCamera:WorldToScreenPoint(SnappingStartPoint);
ScreenSnappedPoint = Vector2.new(ScreenSnappedPoint.X, ScreenSnappedPoint.Y);
-- Calculate direction setting length
local DirectionSettingLength = math.min(50, math.max(50, (SnappingStartAim - ScreenSnappedPoint).magnitude * 1.5));
-- Use the mouse position to figure out the resize direction (until after direction setting length)
if SnappingStage == 'Direction' then
-- Get current angle from snap point
local DragAngle = math.deg(math.atan2(SnappingEndAim.Y - ScreenSnappedPoint.Y, SnappingEndAim.X - ScreenSnappedPoint.X));
DragAngle = (DragAngle > 0) and (DragAngle - 360) or DragAngle;
-- Go through corner offsets representing the possible directions
local Directions = {};
for _, Direction in pairs(SnappingStartDirections) do
-- Map the corner & corner offset to screen points
local ScreenOffsetPoint = Workspace.CurrentCamera:WorldToScreenPoint(Direction.Offset);
-- Get direction angle from snap point
local DirectionAngle = math.deg(math.atan2(ScreenOffsetPoint.Y - ScreenSnappedPoint.Y, ScreenOffsetPoint.X - ScreenSnappedPoint.X));
DirectionAngle = (DirectionAngle > 0) and (DirectionAngle - 360) or DirectionAngle;
-- Calculate delta between drag and direction angles
local AngleDelta = math.abs(DragAngle - DirectionAngle) % 180;
AngleDelta = (AngleDelta > 90) and (180 - AngleDelta) or AngleDelta;
-- Insert the potential direction
table.insert(Directions, {
Face = Direction.Face,
AngleDelta = AngleDelta,
DirectionAngle = DirectionAngle,
Offset = Direction.Offset
});
end;
-- Get the direction most similar to the dragging angle
table.sort(Directions, function (A, B)
return A.AngleDelta < B.AngleDelta;
end);
-- Center direction line at snap point
DirectionLine.Position = UDim2.new(0, ScreenSnappedPoint.X, 0, ScreenSnappedPoint.Y);
-- Orient direction line towards drag direction
if math.abs(DragAngle - Directions[1].DirectionAngle) <= 90 then
DirectionLine.Rotation = Directions[1].DirectionAngle;
else
DirectionLine.Rotation = 180 + Directions[1].DirectionAngle;
end;
-- Show the direction line
DirectionLine.PointMarker.Rotation = -DirectionLine.Rotation;
DirectionLine.SnapProgress.Size = UDim2.new(0, DirectionSettingLength, 2, 0);
DirectionLine.Visible = true;
-- Check if drag has passed direction setting length
local Length = (SnappingEndAim - ScreenSnappedPoint).magnitude;
if Length < DirectionSettingLength then
return;
end;
-- Clear the direction line
DirectionLine:Destroy()
-- Select the resizing direction that was closest to the mouse drag
SnappingDirection = Directions[1].Face;
SnappingDirectionOffset = Directions[1].Offset;
-- Move to the destination-picking stage of snapping
SnappingStage = 'Destination';
-- Set destination-stage snapping options
SnapTracking.TrackEdgeMidpoints = true;
SnapTracking.TrackFaceCentroids = true;
SnapTracking.TargetFilter = function (Target) return not Target.Locked; end;
SnapTracking.TargetBlacklist = Selection.Items;
-- Start a distance alignment line
AlignmentLine = Core.Tool.Interfaces.SnapLineSegment:Clone();
AlignmentLine.Visible = false;
AlignmentLine.Parent = Core.UI;
-- Re-enable snapping to select destination
SnapTracking.StartTracking(function (NewPoint)
if NewPoint and NewPoint.p ~= SnappedPoint then
SnappedPoint = NewPoint.p;
PointSnapped:fire(NewPoint.p);
end;
end);
end;
end);
-- Listen for when a new point is snapped
Connections.Snap = PointSnapped:connect(function (SnappedPoint)
-- Resize to snap point if in the destination stage of snapping
if SnappingStage == 'Destination' then
-- Calculate direction and distance to resize towards
local Direction = (SnappingDirectionOffset - SnappingStartPoint).unit;
local Distance = (SnappedPoint - SnappingStartPoint):Dot(Direction);
-- Resize the parts on the selected faces by the calculated distance
local Success = ResizePartsByFace(SnappingDirection, Distance, 'Normal', SnappingStartSelectionState);
-- Update the UI on resize success
if Success then
-- Update "studs resized" indicator
if ResizeTool.UI then
ResizeTool.UI.Changes.Text.Text = 'resized ' .. Support.Round(Distance, 3) .. ' studs';
end;
-- Get snap point and destination point screen positions for UI alignment
local ScreenStartPoint = Workspace.CurrentCamera:WorldToScreenPoint(SnappingStartPoint + (Direction * Distance));
ScreenStartPoint = Vector2.new(ScreenStartPoint.X, ScreenStartPoint.Y);
local ScreenDestinationPoint = Workspace.CurrentCamera:WorldToScreenPoint(SnappedPoint);
ScreenDestinationPoint = Vector2.new(ScreenDestinationPoint.X, ScreenDestinationPoint.Y)
-- Update the distance alignment line
local AlignmentAngle = math.deg(math.atan2(ScreenDestinationPoint.Y - ScreenStartPoint.Y, ScreenDestinationPoint.X - ScreenStartPoint.X));
local AlignmentCenter = ScreenStartPoint:Lerp(ScreenDestinationPoint, 0.5);
AlignmentLine.Position = UDim2.new(0, AlignmentCenter.X, 0, AlignmentCenter.Y);
AlignmentLine.Rotation = AlignmentAngle;
AlignmentLine.Size = UDim2.new(0, (ScreenDestinationPoint - ScreenStartPoint).magnitude, 0, 1);
AlignmentLine.PointMarkerA.Rotation = -AlignmentAngle;
AlignmentLine.Visible = true;
end;
-- Make sure we're not entering any unauthorized private areas
if Core.Mode == 'Tool' and Security.ArePartsViolatingAreas(Selection.Items, Core.Player, false, AreaPermissions) then
for Part, State in pairs(SnappingStartSelectionState) do
Part.Size = State.Size;
Part.CFrame = State.CFrame;
end;
end;
end;
end);
end);
end;
|
--//Controller//-- |
repeat
task.wait()
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = CameraPart.CFrame
until
Camera.CameraType == Enum.CameraType.Scriptable
task.wait(5)
TweenService:Create(
CutsceneFrame,
TweenInfo.new(
1
),
{
Transparency = 0
}
):Play()
task.wait(2)
repeat
task.wait()
Camera.CameraType = Enum.CameraType.Custom
CutsceneGui.CinematicFrame1.Transparency = 1
CutsceneGui.CinematicFrame2.Transparency = 1
until
Camera.CameraType == Enum.CameraType.Custom
TweenService:Create(
CutsceneFrame,
TweenInfo.new(
1
),
{
Transparency = 1
}
):Play()
Debris:AddItem(CutsceneGui, 1)
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 350 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
-- << SET UP PLAYER DATA >> |
local getLimitPerMin = 6
local getRefreshInterval = 10
local getLimit = getLimitPerMin*(getRefreshInterval/60)
local getRequests = {}
spawn(function()
while true do
wait(getRefreshInterval)
getRequests = {}
end
end)
function module:GetData(caller, retries, userId)
if not getRequests[caller] then
getRequests[caller] = 0
end
getRequests[caller] = getRequests[caller] + 1
if getRequests[caller] <= getLimit then
local success, data = main:GetModule("DataStores"):GetData(playerDataStore, retries, userId)
return success, data
else
--warn(caller.Name,"exeeded getLimit!")
end
end
function module:SetupPlayerData(player)
local dataTemplate = getDataTemplate()
local success, pdata = self:GetData(player, datastoreRetries, player.UserId)
--Can't access DataStore
if not success and not main.isStudio then
return nil
--New player
elseif not pdata then
pdata = dataTemplate
savePlayerData(player)
local welcomeBadgeId = tonumber(main.settings.WelcomeBadgeId)
if welcomeBadgeId and welcomeBadgeId > 0 then
main.badgeService:AwardBadge(player.UserId, welcomeBadgeId)
end
--Existing player
else
for statName, statValue in pairs(dataTemplate) do
if pdata[statName] == nil then
pdata[statName] = statValue
end
if statName == "DefaultSettings" then
for i, settingName in pairs(defaultSettingsToAdd) do
if pdata[statName][settingName] == nil then
pdata[statName][settingName] = settings[settingName]
end
end
end
end
end
main.pd[player] = pdata
return pdata
end
|
--[[
Constructor for a new CameraModule.
Parameters:
- camera (Camera): current camera of the LocalPlayer
]] |
function CameraModule.new(camera, tweenService)
local self = {
initialCFrame = nil,
camera = camera,
surfaceGui = nil,
tweenService = tweenService or TweenService,
}
setmetatable(self, CameraModule)
return self
end
|
--[=[
@class Component
Bind components to Roblox instances using the Component class and CollectionService tags.
To avoid confusion of terms:
- `Component` refers to this module.
- `Component Class` (e.g. `MyComponent` through this documentation) refers to a class created via `Component.new`
- `Component Instance` refers to an instance of a component class.
- `Roblox Instance` refers to the Roblox instance to which the component instance is bound.
Methods and properties are tagged with the above terms to help clarify the level at which they are used.
]=] |
local Component = {}
Component.__index = Component
|
--// F key, HornOn |
mouse.KeyDown:connect(function(key)
if key=="h" then
veh.Lightbar.middle.Airhorn:Play()
veh.Lightbar.middle.Wail.Volume = 0
veh.Lightbar.middle.Yelp.Volume = 0
veh.Lightbar.middle.Priority.Volume = 0
end
end)
|
--WeldRec(P.Parent.Lights) |
for _,v in pairs(weldedParts) do
if v:IsA("BasePart") then
v.Anchored = false
end
end
script:Destroy()
|
-- Effect Stop |
Model.Configuration.Ballywho.Value = 0
Model.Configuration.ColorRand.Value = 0 |
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = {};
for v2, v3 in ipairs((game.ReplicatedStorage.Game.Abilities:GetChildren())) do
if not v2 then
break;
end;
local v5 = v3:FindFirstChildOfClass("ModuleScript");
if v5 then
v1[v3.Name] = require(v5);
end;
end;
return v1;
|
--[[ The Module ]] | --
local TransparencyController = {}
TransparencyController.__index = TransparencyController
function TransparencyController.new()
local self = setmetatable({}, TransparencyController)
self.lastUpdate = tick()
self.transparencyDirty = false
self.enabled = false
self.lastTransparency = nil
self.descendantAddedConn, self.descendantRemovingConn = nil, nil
self.toolDescendantAddedConns = {}
self.toolDescendantRemovingConns = {}
self.cachedParts = {}
return self
end
function TransparencyController:HasToolAncestor(object)
if object.Parent == nil then return false end
return object.Parent:IsA('Tool') or self:HasToolAncestor(object.Parent)
end
function TransparencyController:IsValidPartToModify(part)
if part:IsA('BasePart') or part:IsA('Decal') then
return not self:HasToolAncestor(part)
end
return false
end
function TransparencyController:CachePartsRecursive(object)
if object then
if self:IsValidPartToModify(object) then
self.cachedParts[object] = true
self.transparencyDirty = true
end
for _, child in pairs(object:GetChildren()) do
self:CachePartsRecursive(child)
end
end
end
function TransparencyController:TeardownTransparency()
for child, _ in pairs(self.cachedParts) do
child.LocalTransparencyModifier = 0
end
self.cachedParts = {}
self.transparencyDirty = true
self.lastTransparency = nil
if self.descendantAddedConn then
self.descendantAddedConn:disconnect()
self.descendantAddedConn = nil
end
if self.descendantRemovingConn then
self.descendantRemovingConn:disconnect()
self.descendantRemovingConn = nil
end
for object, conn in pairs(self.toolDescendantAddedConns) do
conn:Disconnect()
self.toolDescendantAddedConns[object] = nil
end
for object, conn in pairs(self.toolDescendantRemovingConns) do
conn:Disconnect()
self.toolDescendantRemovingConns[object] = nil
end
end
function TransparencyController:SetupTransparency(character)
self:TeardownTransparency()
if self.descendantAddedConn then self.descendantAddedConn:disconnect() end
self.descendantAddedConn = character.DescendantAdded:Connect(function(object)
-- This is a part we want to invisify
if self:IsValidPartToModify(object) then
self.cachedParts[object] = true
self.transparencyDirty = true
-- There is now a tool under the character
elseif object:IsA('Tool') then
if self.toolDescendantAddedConns[object] then self.toolDescendantAddedConns[object]:Disconnect() end
self.toolDescendantAddedConns[object] = object.DescendantAdded:Connect(function(toolChild)
self.cachedParts[toolChild] = nil
if toolChild:IsA('BasePart') or toolChild:IsA('Decal') then
-- Reset the transparency
toolChild.LocalTransparencyModifier = 0
end
end)
if self.toolDescendantRemovingConns[object] then self.toolDescendantRemovingConns[object]:disconnect() end
self.toolDescendantRemovingConns[object] = object.DescendantRemoving:Connect(function(formerToolChild)
wait() -- wait for new parent
if character and formerToolChild and formerToolChild:IsDescendantOf(character) then
if self:IsValidPartToModify(formerToolChild) then
self.cachedParts[formerToolChild] = true
self.transparencyDirty = true
end
end
end)
end
end)
if self.descendantRemovingConn then self.descendantRemovingConn:disconnect() end
self.descendantRemovingConn = character.DescendantRemoving:connect(function(object)
if self.cachedParts[object] then
self.cachedParts[object] = nil
-- Reset the transparency
object.LocalTransparencyModifier = 0
end
end)
self:CachePartsRecursive(character)
end
function TransparencyController:Enable(enable)
if self.enabled ~= enable then
self.enabled = enable
self:Update()
end
end
function TransparencyController:SetSubject(subject)
local character = nil
if subject and subject:IsA("Humanoid") then
character = subject.Parent
end
if subject and subject:IsA("VehicleSeat") and subject.Occupant then
character = subject.Occupant.Parent
end
if character then
self:SetupTransparency(character)
else
self:TeardownTransparency()
end
end
function TransparencyController:Update()
local instant = false
local now = tick()
local currentCamera = workspace.CurrentCamera
if currentCamera then
local transparency = 0
if not self.enabled then
instant = true
else
local distance = (currentCamera.Focus.p - currentCamera.CoordinateFrame.p).magnitude
transparency = (distance<2) and (1.0-(distance-0.5)/1.5) or 0 --(7 - distance) / 5
if transparency < 0.5 then
transparency = 0
end
if self.lastTransparency then
local deltaTransparency = transparency - self.lastTransparency
-- Don't tween transparency if it is instant or your character was fully invisible last frame
if not instant and transparency < 1 and self.lastTransparency < 0.95 then
local maxDelta = MAX_TWEEN_RATE * (now - self.lastUpdate)
deltaTransparency = Util.Clamp(-maxDelta, maxDelta, deltaTransparency)
end
transparency = self.lastTransparency + deltaTransparency
else
self.transparencyDirty = true
end
transparency = Util.Clamp(0, 1, Util.Round(transparency, 2))
end
if self.transparencyDirty or self.lastTransparency ~= transparency then
for child, _ in pairs(self.cachedParts) do
child.LocalTransparencyModifier = transparency
end
self.transparencyDirty = false
self.lastTransparency = transparency
end
end
self.lastUpdate = now
end
return TransparencyController
|
--LIGHTS BUTTONS |
for _,i in pairs(lights:GetChildren()) do
if i:IsA("ImageButton") and i.Name ~= "header" then
if string.match(i.Name,"%l+") == "td" then
i.MouseButton1Click:connect(function()
script.Parent.lighty.Value = tonumber(string.match(i.Name,"%d"))
if script.Parent.lighty.Value == 0 then
lights.td0.Image = imgassets.offon
lights.td1.Image = imgassets.hazardoff
lights.td2.Image = imgassets.leftyoff
lights.td3.Image = imgassets.rightyoff
lights.td4.Image = imgassets.outoff
elseif script.Parent.lighty.Value == 1 then
lights.td0.Image = imgassets.offoff
lights.td1.Image = imgassets.hazardon
lights.td2.Image = imgassets.leftyoff
lights.td3.Image = imgassets.rightyoff
lights.td4.Image = imgassets.outoff
elseif script.Parent.lighty.Value == 2 then
lights.td0.Image = imgassets.offoff
lights.td1.Image = imgassets.hazardoff
lights.td2.Image = imgassets.leftyon
lights.td3.Image = imgassets.rightyoff
lights.td4.Image = imgassets.outoff
elseif script.Parent.lighty.Value == 3 then
lights.td0.Image = imgassets.offoff
lights.td1.Image = imgassets.hazardoff
lights.td2.Image = imgassets.leftyoff
lights.td3.Image = imgassets.rightyon
lights.td4.Image = imgassets.outoff
elseif script.Parent.lighty.Value == 4 then
lights.td0.Image = imgassets.offoff
lights.td1.Image = imgassets.hazardoff
lights.td2.Image = imgassets.leftyoff
lights.td3.Image = imgassets.rightyoff
lights.td4.Image = imgassets.outon
end
end)
elseif string.match(i.Name,"%l+") == "fl" then
i.MouseButton1Click:connect(function()
script.Parent.flasher.Value = tonumber(string.match(i.Name,"%d"))
if script.Parent.flasher.Value == 0 then
lights.fl0.Image = imgassets.offon
lights.fl1.Image = imgassets.slowoff
lights.fl2.Image = imgassets.fastoff
lights.fl3.Image = imgassets.x2off
lights.fl4.Image = imgassets.x4off
elseif script.Parent.flasher.Value == 1 then
lights.fl0.Image = imgassets.offoff
lights.fl1.Image = imgassets.slowon
lights.fl2.Image = imgassets.fastoff
lights.fl3.Image = imgassets.x2off
lights.fl4.Image = imgassets.x4off
elseif script.Parent.flasher.Value == 2 then
lights.fl0.Image = imgassets.offoff
lights.fl1.Image = imgassets.slowoff
lights.fl2.Image = imgassets.faston
lights.fl3.Image = imgassets.x2off
lights.fl4.Image = imgassets.x4off
elseif script.Parent.flasher.Value == 3 then
lights.fl0.Image = imgassets.offoff
lights.fl1.Image = imgassets.slowoff
lights.fl2.Image = imgassets.fastoff
lights.fl3.Image = imgassets.x2on
lights.fl4.Image = imgassets.x4off
elseif script.Parent.flasher.Value == 4 then
lights.fl0.Image = imgassets.offoff
lights.fl1.Image = imgassets.slowoff
lights.fl2.Image = imgassets.fastoff
lights.fl3.Image = imgassets.x2off
lights.fl4.Image = imgassets.x4on
end
end)
end
end
end
for _,i in pairs (siren:GetChildren()) do
if i:IsA("ImageButton") and i.Name ~= "header" then
if string.match(i.Name,"%l+") == "sr" then
i.MouseButton1Click:connect(function()
script.Parent.siren.Value = tonumber(string.match(i.Name,"%d"))
if script.Parent.siren.Value == 0 then
siren.sr0.Image = imgassets.offon
siren.sr1.Image = imgassets.onoff
elseif script.Parent.siren.Value == 1 then
siren.sr0.Image = imgassets.offoff
siren.sr1.Image = imgassets.onon
end
end)
end
end
end
for _,i in pairs (seats:GetChildren()) do
if i:IsA("ImageButton") and i.Name ~= "header" then
if string.match(i.Name,"%u%l+") == "Seat" then
local a = seat:findFirstChild("Seat"..tonumber(string.match(i.Name,"%d")))
if a.Value then
i.Image = imgassets.lockon
else
i.Image = imgassets.lockoff
end
i.MouseButton1Click:connect(function()
a.Value = not a.Value
if a.Value then
i.Image = imgassets.lockon
else
i.Image = imgassets.lockoff
end
end)
end
end
end
while true do
wait(0.1)
script.Parent.Speed.Text = ("Speed: "..math.floor(seat.Velocity.Magnitude/2))
end
|
--print("Finished:",l)
--print("AmFinished:",Finished) |
end)
end
repeat wait() until Finished >= AF
local Time = 0
repeat Time = Time+0.03 wait(0.03) until Time >= WaitTime or Close |
--[[Wheel Alignment]] |
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
Tune.FCamber = -2
Tune.RCamber = -2
Tune.FToe = 0
Tune.RToe = 0
|
--[=[
Returns the current value for the given player. This value
will depend on if `SetFor` or `SetFilter` has affected the
custom value for the player. If so, that custom value will
be returned. Otherwise, the top-level value will be used
(e.g. value from `Set`).
```lua
-- Set top level data:
remoteProperty:Set("Data")
print(remoteProperty:GetFor(somePlayer)) --> "Data"
-- Set custom data:
remoteProperty:SetFor(somePlayer, "CustomData")
print(remoteProperty:GetFor(somePlayer)) --> "CustomData"
-- Set top level again, overriding custom data:
remoteProperty:Set("NewData")
print(remoteProperty:GetFor(somePlayer)) --> "NewData"
-- Set custom data again, and set top level without overriding:
remoteProperty:SetFor(somePlayer, "CustomData")
remoteProperty:SetTop("Data")
print(remoteProperty:GetFor(somePlayer)) --> "CustomData"
-- Clear custom data to use top level data:
remoteProperty:ClearFor(somePlayer)
print(remoteProperty:GetFor(somePlayer)) --> "Data"
```
]=] |
function RemoteProperty:GetFor(player: Player): any
local playerValue = self._perPlayer[player]
local value = if playerValue == nil then self._value elseif playerValue == None then nil else playerValue
return value
end
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 200 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
--[[
This rotated region3 module is a bit different than the one I previously wrote. This uses GJK to do the collision calculations and
as such does not calculate the minimum translation vector. In addition it does not calculate the intersection points anymore either.
I don't think that had much place in a rotated region3 module.
As far as new features the module now supports a vast array of shapes and point clouds meaning more accurate collision!
API:
Constructors:
region.new(cframe, size)
> Creates a region from a cframe which acts as the center of the region and size which extends to
> the corners like a block part.
region.block(cframe, size)
> This is the exact same as the region.new constructor, but has a different name.
region.wedge(cframe, size)
> Creates a region from a cframe which acts as the center of the region and size which extends to
> the corners like a wedge part.
region.cornerWedge(cframe, size)
> Creates a region from a cframe which acts as the center of the region and size which extends to
> the corners like a cornerWedge part.
region.cylinder(cframe, size)
> Creates a region from a cframe which acts as the center of the region and size which extends to
> the corners like a cylinder part.
region.ellipsoid(cframe, size)
> Creates a region from a cframe which acts as the center of the region and size which extends to
> the corners like a ball part.
region.pointCloud(cloud)
> Creates a region from a table of points. The region is treated as a convex 3D shape when doing the collision detections.
region.fromPart(part)
> Creates a region from a part in the game. It can be used on any base part, but the region
> will treat unknown shapes (meshes, unions, etc) as block shapes.
Methods:
region:cast(ignore instance or table (descendants as well), int maxParts)
> returns a table full of parts that are inside the region
region:castPart(basePart)
> returns a boolean as to whether or not a given part is within a region or not
region:castPoint(vector3)
> returns a boolean as to whether or not a given point is within a region or not
Properties:
region.CFrame
> cframe that represents the center of the region
region.Size
> vector3 that represents the size of the region
--]] |
local gjk = require(script:WaitForChild("gjk"));
local support = require(script:WaitForChild("supports"));
local vertices = require(script:WaitForChild("vertices"));
local draw = require(script:WaitForChild("draw"));
local region3 = {};
local region3_mt = {__index = region3};
|
-- This is responsible for positioning the topbar icons |
local requestedTopbarUpdate = false
function IconController.updateTopbar()
local function getIncrement(otherIcon, alignment)
--local container = otherIcon.instances.iconContainer
--local sizeX = container.Size.X.Offset
local iconSize = otherIcon:get("iconSize", otherIcon:getIconState()) or UDim2.new(0, 32, 0, 32)
local sizeX = iconSize.X.Offset
local alignmentGap = IconController[alignment.."Gap"]
local iconWidthAndGap = (sizeX + alignmentGap)
local increment = iconWidthAndGap
local preOffset = 0
if otherIcon._parentIcon == nil then
local extendLeft, extendRight, additionalRight = IconController.getMenuOffset(otherIcon)
preOffset += extendLeft
increment += extendRight + additionalRight
end
return increment, preOffset
end
if topbarUpdating then -- This prevents the topbar updating and shifting icons more than it needs to
requestedTopbarUpdate = true
return false
end
task.defer(function()
topbarUpdating = true
runService.Heartbeat:Wait()
topbarUpdating = false
for alignment, alignmentInfo in pairs(alignmentDetails) do
alignmentInfo.records = {}
end
for otherIcon, _ in pairs(topbarIcons) do
if IconController.canShowIconOnTopbar(otherIcon) then
local alignment = otherIcon:get("alignment")
table.insert(alignmentDetails[alignment].records, otherIcon)
end
end
local viewportSize = workspace.CurrentCamera.ViewportSize
for alignment, alignmentInfo in pairs(alignmentDetails) do
local records = alignmentInfo.records
if #records > 1 then
if alignmentInfo.reverseSort then
table.sort(records, function(a,b) return a:get("order") > b:get("order") end)
else
table.sort(records, function(a,b) return a:get("order") < b:get("order") end)
end
end
local totalIconX = 0
for i, otherIcon in pairs(records) do
local increment = getIncrement(otherIcon, alignment)
totalIconX = totalIconX + increment
end
local offsetX = alignmentInfo.getStartOffset(totalIconX, alignment)
local preOffsetX = offsetX
local containerX = TopbarPlusGui.TopbarContainer.AbsoluteSize.X
for i, otherIcon in pairs(records) do
local increment, preOffset = getIncrement(otherIcon, alignment)
local newAbsoluteX = alignmentInfo.startScale*containerX + preOffsetX+preOffset
preOffsetX = preOffsetX + increment
end
for i, otherIcon in pairs(records) do
local container = otherIcon.instances.iconContainer
local increment, preOffset = getIncrement(otherIcon, alignment)
local topPadding = otherIcon.topPadding
local newPositon = UDim2.new(alignmentInfo.startScale, offsetX+preOffset, topPadding.Scale, topPadding.Offset)
local isAnOverflowIcon = string.match(otherIcon.name, "_overflowIcon-")
local repositionInfo = otherIcon:get("repositionInfo")
if repositionInfo then
tweenService:Create(container, repositionInfo, {Position = newPositon}):Play()
else
container.Position = newPositon
end
offsetX = offsetX + increment
otherIcon.targetPosition = UDim2.new(0, (newPositon.X.Scale*viewportSize.X) + newPositon.X.Offset, 0, (newPositon.Y.Scale*viewportSize.Y) + newPositon.Y.Offset)
end
end
-- OVERFLOW HANDLER
--------
local START_LEEWAY = 10 -- The additional offset where the end icon will be converted to ... without an apparant change in position
local function getBoundaryX(iconToCheck, side, gap)
local additionalGap = gap or 0
local currentSize = iconToCheck:get("iconSize", iconToCheck:getIconState())
local sizeX = currentSize.X.Offset
local extendLeft, extendRight = IconController.getMenuOffset(iconToCheck)
local boundaryXOffset = (side == "left" and (-additionalGap-extendLeft)) or (side == "right" and sizeX+additionalGap+extendRight)
local boundaryX = iconToCheck.targetPosition.X.Offset + boundaryXOffset
return boundaryX
end
local function getSizeX(iconToCheck, usePrevious)
local currentSize, previousSize = iconToCheck:get("iconSize", iconToCheck:getIconState(), "beforeDropdown")
local hoveringSize = iconToCheck:get("iconSize", "hovering")
if iconToCheck.wasHoveringBeforeOverflow and previousSize and hoveringSize and hoveringSize.X.Offset > previousSize.X.Offset then
-- This prevents hovering icons flicking back and forth, demonstrated at thread/1017485/191.
previousSize = hoveringSize
end
local newSize = (usePrevious and previousSize) or currentSize
local extendLeft, extendRight = IconController.getMenuOffset(iconToCheck)
local sizeX = newSize.X.Offset + extendLeft + extendRight
return sizeX
end
for alignment, alignmentInfo in pairs(alignmentDetails) do
local overflowIcon = alignmentInfo.overflowIcon
if overflowIcon then
local alignmentGap = IconController[alignment.."Gap"]
local oppositeAlignment = (alignment == "left" and "right") or "left"
local oppositeAlignmentInfo = alignmentDetails[oppositeAlignment]
local oppositeOverflowIcon = IconController.getIcon("_overflowIcon-"..oppositeAlignment)
-- This determines whether any icons (from opposite or mid alignment) are overlapping with this alignment
local overflowBoundaryX = getBoundaryX(overflowIcon, alignment)
if overflowIcon.enabled then
overflowBoundaryX = getBoundaryX(overflowIcon, oppositeAlignment, alignmentGap)
end
local function doesExceed(givenBoundaryX)
local exceeds = (alignment == "left" and givenBoundaryX < overflowBoundaryX) or (alignment == "right" and givenBoundaryX > overflowBoundaryX)
return exceeds
end
local alignmentOffset = oppositeAlignmentInfo.getOffset()
if not overflowIcon.enabled then
alignmentOffset += START_LEEWAY
end
local alignmentBorderX = (alignment == "left" and viewportSize.X - alignmentOffset) or (alignment == "right" and alignmentOffset)
local closestBoundaryX = alignmentBorderX
local exceededCriticalBoundary = doesExceed(closestBoundaryX)
local function checkBoundaryExceeded(recordToCheck)
local totalIcons = #recordToCheck
for i = 1, totalIcons do
local endIcon = recordToCheck[totalIcons+1 - i]
if IconController.canShowIconOnTopbar(endIcon) then
local isAnOverflowIcon = string.match(endIcon.name, "_overflowIcon-")
if isAnOverflowIcon and totalIcons ~= 1 then
break
elseif isAnOverflowIcon and not endIcon.enabled then
continue
end
local additionalMyX = 0
if not overflowIcon.enabled then
additionalMyX = START_LEEWAY
end
local myBoundaryX = getBoundaryX(endIcon, alignment, additionalMyX)
local isNowClosest = (alignment == "left" and myBoundaryX < closestBoundaryX) or (alignment == "right" and myBoundaryX > closestBoundaryX)
if isNowClosest then
closestBoundaryX = myBoundaryX
if doesExceed(myBoundaryX) then
exceededCriticalBoundary = true
end
end
end
end
end
checkBoundaryExceeded(alignmentDetails[oppositeAlignment].records)
checkBoundaryExceeded(alignmentDetails.mid.records)
-- This determines which icons to give to the overflow if an overlap is present
if exceededCriticalBoundary then
local recordToCheck = alignmentInfo.records
local totalIcons = #recordToCheck
for i = 1, totalIcons do
local endIcon = (alignment == "left" and recordToCheck[totalIcons+1 - i]) or (alignment == "right" and recordToCheck[i])
if endIcon ~= overflowIcon and IconController.canShowIconOnTopbar(endIcon) then
local additionalGap = alignmentGap
local overflowIconSizeX = overflowIcon:get("iconSize", overflowIcon:getIconState()).X.Offset
if overflowIcon.enabled then
additionalGap += alignmentGap + overflowIconSizeX
end
local myBoundaryXPlusGap = getBoundaryX(endIcon, oppositeAlignment, additionalGap)
local exceeds = (alignment == "left" and myBoundaryXPlusGap >= closestBoundaryX) or (alignment == "right" and myBoundaryXPlusGap <= closestBoundaryX)
if exceeds then
if not overflowIcon.enabled then
local overflowContainer = overflowIcon.instances.iconContainer
local yPos = overflowContainer.Position.Y
local appearXAdditional = (alignment == "left" and -overflowContainer.Size.X.Offset) or 0
local appearX = getBoundaryX(endIcon, oppositeAlignment, appearXAdditional)
overflowContainer.Position = UDim2.new(0, appearX, yPos.Scale, yPos.Offset)
overflowIcon:setEnabled(true)
end
if #endIcon.dropdownIcons > 0 then
endIcon._overflowConvertedToMenu = true
local wasSelected = endIcon.isSelected
endIcon:deselect()
local iconsToConvert = {}
for _, dIcon in pairs(endIcon.dropdownIcons) do
table.insert(iconsToConvert, dIcon)
end
for _, dIcon in pairs(endIcon.dropdownIcons) do
dIcon:leave()
end
endIcon:setMenu(iconsToConvert)
if wasSelected and overflowIcon.isSelected then
endIcon:select()
end
end
if endIcon.hovering then
endIcon.wasHoveringBeforeOverflow = true
end
endIcon:join(overflowIcon, "dropdown")
if #endIcon.menuIcons > 0 and endIcon.menuOpen then
endIcon:deselect()
endIcon:select()
overflowIcon:select()
end
end
break
end
end
else
-- This checks to see if the lowest/highest (depending on left/right) ordered overlapping icon is no longer overlapping, removes from the dropdown, and repeats if valid
local winningOrder, winningOverlappedIcon
local totalOverlappingIcons = #overflowIcon.dropdownIcons
if not (oppositeOverflowIcon and oppositeOverflowIcon.enabled and #alignmentInfo.records == 1 and #oppositeAlignmentInfo.records ~= 1) then
for _, overlappedIcon in pairs(overflowIcon.dropdownIcons) do
local iconOrder = overlappedIcon:get("order")
if winningOverlappedIcon == nil or (alignment == "left" and iconOrder < winningOrder) or (alignment == "right" and iconOrder > winningOrder) then
winningOrder = iconOrder
winningOverlappedIcon = overlappedIcon
end
end
end
if winningOverlappedIcon then
local sizeX = getSizeX(winningOverlappedIcon, true)
local myForesightBoundaryX = getBoundaryX(overflowIcon, oppositeAlignment)
if totalOverlappingIcons == 1 then
myForesightBoundaryX = getBoundaryX(overflowIcon, alignment, alignmentGap-START_LEEWAY)
end
local availableGap = math.abs(closestBoundaryX - myForesightBoundaryX) - (alignmentGap*2)
local noLongerExeeds = (sizeX < availableGap)
if noLongerExeeds then
if #overflowIcon.dropdownIcons == 1 then
overflowIcon:setEnabled(false)
end
local overflowContainer = overflowIcon.instances.iconContainer
local yPos = overflowContainer.Position.Y
overflowContainer.Position = UDim2.new(0, myForesightBoundaryX, yPos.Scale, yPos.Offset)
winningOverlappedIcon:leave()
winningOverlappedIcon.wasHoveringBeforeOverflow = nil
--
if winningOverlappedIcon._overflowConvertedToMenu then
winningOverlappedIcon._overflowConvertedToMenu = nil
local iconsToConvert = {}
for _, dIcon in pairs(winningOverlappedIcon.menuIcons) do
table.insert(iconsToConvert, dIcon)
end
for _, dIcon in pairs(winningOverlappedIcon.menuIcons) do
dIcon:leave()
end
winningOverlappedIcon:setDropdown(iconsToConvert)
end
--
end
end
end
end
end
--------
if requestedTopbarUpdate then
requestedTopbarUpdate = false
IconController.updateTopbar()
end
return true
end)
end
function IconController.setTopbarEnabled(bool, forceBool)
if forceBool == nil then
forceBool = true
end
local indicator = TopbarPlusGui.Indicator
if forceBool and not bool then
forceTopbarDisabled = true
elseif forceBool and bool then
forceTopbarDisabled = false
end
local topbarEnabledAccountingForMimic = checkTopbarEnabledAccountingForMimic()
if IconController.controllerModeEnabled then
if bool then
if TopbarPlusGui.TopbarContainer.Visible or forceTopbarDisabled or menuOpen or not topbarEnabledAccountingForMimic then return end
if forceBool then
indicator.Visible = topbarEnabledAccountingForMimic
else
indicator.Active = false
if controllerMenuOverride and controllerMenuOverride.Connected then
controllerMenuOverride:Disconnect()
end
if hapticService:IsVibrationSupported(Enum.UserInputType.Gamepad1) and hapticService:IsMotorSupported(Enum.UserInputType.Gamepad1,Enum.VibrationMotor.Small) then
hapticService:SetMotor(Enum.UserInputType.Gamepad1,Enum.VibrationMotor.Small,1)
delay(0.2,function()
pcall(function()
hapticService:SetMotor(Enum.UserInputType.Gamepad1,Enum.VibrationMotor.Small,0)
end)
end)
end
TopbarPlusGui.TopbarContainer.Visible = true
TopbarPlusGui.TopbarContainer:TweenPosition(
UDim2.new(0,0,0,5 + STUPID_CONTROLLER_OFFSET),
Enum.EasingDirection.Out,
Enum.EasingStyle.Quad,
0.1,
true
)
local selectIcon
local targetOffset = 0
IconController:_updateSelectionGroup()
runService.Heartbeat:Wait()
local indicatorSizeTrip = 50 --indicator.AbsoluteSize.Y * 2
for otherIcon, _ in pairs(topbarIcons) do
if IconController.canShowIconOnTopbar(otherIcon) and (selectIcon == nil or otherIcon:get("order") < selectIcon:get("order")) and otherIcon.enabled then
selectIcon = otherIcon
end
local container = otherIcon.instances.iconContainer
local newTargetOffset = -27 + container.AbsoluteSize.Y + indicatorSizeTrip
if newTargetOffset > targetOffset then
targetOffset = newTargetOffset
end
end
if guiService:GetEmotesMenuOpen() then
guiService:SetEmotesMenuOpen(false)
end
if guiService:GetInspectMenuEnabled() then
guiService:CloseInspectMenu()
end
local newSelectedObject = IconController._previousSelectedObject or selectIcon.instances.iconButton
IconController._setControllerSelectedObject(newSelectedObject)
indicator.Image = "rbxassetid://5278151071"
indicator:TweenPosition(
UDim2.new(0.5,0,0,targetOffset + STUPID_CONTROLLER_OFFSET),
Enum.EasingDirection.Out,
Enum.EasingStyle.Quad,
0.1,
true
)
end
else
if forceBool then
indicator.Visible = false
elseif topbarEnabledAccountingForMimic then
indicator.Visible = true
indicator.Active = true
controllerMenuOverride = indicator.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
IconController.setTopbarEnabled(true,false)
end
end)
else
indicator.Visible = false
end
if not TopbarPlusGui.TopbarContainer.Visible then return end
guiService.AutoSelectGuiEnabled = true
IconController:_updateSelectionGroup(true)
TopbarPlusGui.TopbarContainer:TweenPosition(
UDim2.new(0,0,0,-TopbarPlusGui.TopbarContainer.Size.Y.Offset + STUPID_CONTROLLER_OFFSET),
Enum.EasingDirection.Out,
Enum.EasingStyle.Quad,
0.1,
true,
function()
TopbarPlusGui.TopbarContainer.Visible = false
end
)
indicator.Image = "rbxassetid://5278151556"
indicator:TweenPosition(
UDim2.new(0.5,0,0,5),
Enum.EasingDirection.Out,
Enum.EasingStyle.Quad,
0.1,
true
)
end
else
local topbarContainer = TopbarPlusGui.TopbarContainer
if topbarEnabledAccountingForMimic then
topbarContainer.Visible = bool
else
topbarContainer.Visible = false
end
end
end
function IconController.setGap(value, alignment)
local newValue = tonumber(value) or 12
local newAlignment = tostring(alignment):lower()
if newAlignment == "left" or newAlignment == "mid" or newAlignment == "right" then
IconController[newAlignment.."Gap"] = newValue
IconController.updateTopbar()
return
end
IconController.leftGap = newValue
IconController.midGap = newValue
IconController.rightGap = newValue
IconController.updateTopbar()
end
function IconController.setLeftOffset(value)
IconController.leftOffset = tonumber(value) or 0
IconController.updateTopbar()
end
function IconController.setRightOffset(value)
IconController.rightOffset = tonumber(value) or 0
IconController.updateTopbar()
end
local localPlayer = players.LocalPlayer
local iconsToClearOnSpawn = {}
localPlayer.CharacterAdded:Connect(function()
for _, icon in pairs(iconsToClearOnSpawn) do
icon:destroy()
end
iconsToClearOnSpawn = {}
end)
function IconController.clearIconOnSpawn(icon)
coroutine.wrap(function()
local char = localPlayer.Character or localPlayer.CharacterAdded:Wait()
table.insert(iconsToClearOnSpawn, icon)
end)()
end
|
----- Service Table ----- |
local ProfileService = {
ServiceLocked = false, -- Set to true once the server is shutting down
IssueSignal = Madwork.NewScriptSignal(), -- (error_message, profile_store_name, profile_key) -- Fired when a DataStore API call throws an error
CorruptionSignal = Madwork.NewScriptSignal(), -- (profile_store_name, profile_key) -- Fired when DataStore key returns a value that has
-- all or some of it's profile components set to invalid data types. E.g., accidentally setting Profile.Data to a noon table value
CriticalState = false, -- Set to true while DataStore service is throwing too many errors
CriticalStateSignal = Madwork.NewScriptSignal(), -- (is_critical_state) -- Fired when CriticalState is set to true
-- (You may alert players with this, or set up analytics)
ServiceIssueCount = 0,
_active_profile_stores = {}, -- {profile_store, ...}
_auto_save_list = {}, -- {profile, ...} -- loaded profile table which will be circularly auto-saved
_issue_queue = {}, -- [table] {issue_time, ...}
_critical_state_start = 0, -- [number] 0 = no critical state / os.clock() = critical state start
-- Debug:
_mock_data_store = {},
_user_mock_data_store = {},
_use_mock_data_store = false,
}
|
--Allows users to do /w displayName along with /w userName, only works if PlayerDisplayNamesEnabled is 'true' |
module.WhisperByDisplayName = true
local ChangedEvent = Instance.new("BindableEvent")
local proxyTable = setmetatable({},
{
__index = function(tbl, index)
return module[index]
end,
__newindex = function(tbl, index, value)
module[index] = value
ChangedEvent:Fire(index, value)
end,
})
rawset(proxyTable, "SettingsChanged", ChangedEvent.Event)
return proxyTable
|
--[[**
Alias for t.intersection
**--]] |
t.every = t.intersection
end
do
local checkInterface = t.map(t.any, t.callback) |
--[[
Button created by Truenus. I will help you how to make a startup script. Or simply, you can just copy-paste into another car.
Touching some of the scripts can break the car. I advise you not touch these scripts.
--]] |
wait(0.2) -- Removing this wait could break the script. Please do not touch this. |
--Tune |
local WheelieButton = "T"
local DeadZone = 30
|
-- Captions |
DEFAULT_FORCED_GROUP_VALUES["caption"] = 1
function Icon:setCaption(text)
assert(typeof(text) == "string" or text == nil, "Expected string, got "..typeof(text))
local realText = text or ""
local isVisible = realText ~= ""
self.captionText = text
self.instances.captionLabel.Text = realText
self.instances.captionContainer.Parent = (isVisible and activeItems) or self.instances.iconContainer
self:_updateIconSize(nil, self:getIconState())
local captionMaid = Maid.new()
self._maid.captionMaid = captionMaid
if isVisible then
captionMaid:give(self.hoverStarted:Connect(function()
if not self.isSelected then
self:displayCaption(true)
end
end))
captionMaid:give(self.hoverEnded:Connect(function()
self:displayCaption(false)
end))
captionMaid:give(self.selected:Connect(function()
if self.hovering then
self:displayCaption(false)
end
end))
local iconContainer = self.instances.iconContainer
captionMaid:give(iconContainer:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
if self.hovering then
self:displayCaption()
end
end))
captionMaid:give(iconContainer:GetPropertyChangedSignal("AbsolutePosition"):Connect(function()
if self.hovering then
self:displayCaption()
end
end))
end
-- This adapts the caption size
local CAPTION_X_MARGIN = 6
local CAPTION_CONTAINER_Y_SIZE_SCALE = 0.8
local CAPTION_LABEL_Y_SCALE = 0.58
local iconSize = self:get("iconSize")
local labelFont = self:get("captionFont")
if iconSize and labelFont then
local cellSizeYOffset = iconSize.Y.Offset
local cellSizeYScale = iconSize.Y.Scale
local iconContainer = self.instances.iconContainer
local captionContainer = self.instances.captionContainer
if isVisible then
local cellHeight = cellSizeYOffset + (cellSizeYScale * iconContainer.Parent.AbsoluteSize.Y)
local captionLabel = self.instances.captionLabel
local captionContainerHeight = cellHeight * CAPTION_CONTAINER_Y_SIZE_SCALE
local captionLabelHeight = captionContainerHeight * CAPTION_LABEL_Y_SCALE
local textWidth = textService:GetTextSize(self.captionText, captionLabelHeight, labelFont, Vector2.new(10000, captionLabelHeight)).X
captionLabel.TextSize = captionLabelHeight
captionLabel.Size = UDim2.new(0, textWidth, CAPTION_LABEL_Y_SCALE, 0)
captionContainer.Size = UDim2.new(0, textWidth + CAPTION_X_MARGIN*2, 0, cellHeight*CAPTION_CONTAINER_Y_SIZE_SCALE)
else
captionContainer.Size = UDim2.new(0, 0, 0, 0)
end
end
self:displayCaption(self.hovering and isVisible)
return self
end
function Icon:displayCaption(bool)
if userInputService.TouchEnabled and not self._draggingFinger then return end
local yOffset = 8
-- Determine caption position
if self._draggingFinger then
yOffset = yOffset + THUMB_OFFSET
end
local iconContainer = self.instances.iconContainer
local captionContainer = self.instances.captionContainer
local newPos = UDim2.new(0, iconContainer.AbsolutePosition.X+iconContainer.AbsoluteSize.X/2-captionContainer.AbsoluteSize.X/2, 0, iconContainer.AbsolutePosition.Y+(iconContainer.AbsoluteSize.Y*2)+yOffset)
captionContainer.Position = newPos
-- Determine caption visibility
local isVisible = self.captionVisible or false
if typeof(bool) == "boolean" then
isVisible = bool
end
self.captionVisible = isVisible
-- Change transparency of relavent caption instances
local captionFadeInfo = self:get("captionFadeInfo")
for _, settingName in pairs(self._groupSettings.caption) do
local settingDetail = self._settingsDictionary[settingName]
settingDetail.useForcedGroupValue = not isVisible
self:_update(settingName)
end
end
|
--- Equip/UnEquip |
local Tool = script.Parent
Tool.Equipped:Connect(function()
Tool.Equip.Value = true
end)
Tool.Unequipped:Connect(function()
Tool.Equip.Value = false
end)
|
-- Create component |
local ItemRow = Roact.PureComponent:extend 'ItemRow'
function ItemRow:init()
-- Item button callback
self.OnActivated = function ()
self:HandleSelection()
end
-- Expand arrow callback
self.OnArrowActivated = function ()
self:ToggleExpand()
end
-- Lock button callback
self.OnLockActivated = function ()
self:ToggleLock()
end
-- Name button callback
self.OnNameActivated = function (rbx)
local CurrentTime = tick()
if self.LastNameClick and (CurrentTime - self.LastNameClick) <= 0.25 then
self:setState { EditingName = true }
else
self.LastNameClick = CurrentTime
self:HandleSelection()
end
end
-- Name input callback
self.OnNameInputBlur = function (rbx, EnterPressed)
if #rbx.Text > 0 then
self:SetName(rbx.Text)
end
self:setState { EditingName = Roact.None }
end
end
function ItemRow:GetParts()
local Object = self.props.Instance
-- Return part for parts
if Object:IsA 'BasePart' then
return { Object }
-- Return descendant parts for other items
else
local Parts = {}
for _, Part in pairs(Object:GetDescendants()) do
if Part:IsA 'BasePart' then
Parts[#Parts + 1] = Part
end
end
return Parts
end
end
function ItemRow:ToggleLock()
local props = self.props
-- Create history record
local Parts = self:GetParts()
local HistoryRecord = {
Parts = Parts,
BeforeLocked = Support.GetListMembers(Parts, 'Locked'),
AfterLocked = not props.IsLocked
}
function HistoryRecord:Unapply()
props.Core.SyncAPI:Invoke('SetLocked', self.Parts, self.BeforeLocked)
end
function HistoryRecord:Apply()
props.Core.SyncAPI:Invoke('SetLocked', self.Parts, self.AfterLocked)
end
-- Send lock toggling request to gameserver
HistoryRecord:Apply()
-- Register history record
props.Core.History.Add(HistoryRecord)
end
function ItemRow:SetName(Name)
local props = self.props
-- Create history record
local HistoryRecord = {
Items = { props.Instance },
BeforeName = props.Instance.Name,
AfterName = Name
}
function HistoryRecord:Unapply()
props.Core.SyncAPI:Invoke('SetName', self.Items, self.BeforeName)
end
function HistoryRecord:Apply()
props.Core.SyncAPI:Invoke('SetName', self.Items, self.AfterName)
end
-- Send renaming request to gameserver
HistoryRecord:Apply()
-- Register history record
props.Core.History.Add(HistoryRecord)
end
function ItemRow:HandleSelection()
local props = self.props
local Selection = props.Core.Selection
local Targeting = props.Core.Targeting
-- Check if scoping
local Scoping = UserInputService:IsKeyDown 'LeftAlt' or
UserInputService:IsKeyDown 'RightAlt'
-- Enter scope if requested
if Scoping then
Targeting:SetScope(props.Instance)
return
end
-- Check if multiselecting
local Multiselecting = UserInputService:IsKeyDown 'LeftControl' or
UserInputService:IsKeyDown 'RightControl'
-- Perform selection
if Multiselecting then
if not Selection.IsSelected(props.Instance) then
Selection.Add({ props.Instance }, true)
else
Selection.Remove({ props.Instance }, true)
end
else
Selection.Replace({ props.Instance }, true)
end
end
function ItemRow:ToggleExpand()
self.props.ToggleExpand(self.props.Id)
end
function ItemRow:didMount()
self.Maid = Maid.new()
local Targeting = self.props.Core.Targeting
local Item = self.props.Instance
-- Listen for targeting
self.Maid.TargetListener = Targeting.ScopeTargetChanged:Connect(function (ScopeTarget)
local IsTarget = self.state.Targeted
if (not IsTarget) and (ScopeTarget == Item) then
self:setState { Targeted = true }
elseif IsTarget and (ScopeTarget ~= Item) then
self:setState { Targeted = Roact.None }
end
end)
end
function ItemRow:willUnmount()
self.Maid = self.Maid:Destroy()
end
ItemRow.ClassIcons = {
Part = Vector2.new(2, 1),
MeshPart = Vector2.new(4, 8),
UnionOperation = Vector2.new(4, 8),
NegateOperation = Vector2.new(3, 8),
VehicleSeat = Vector2.new(6, 4),
Seat = Vector2.new(6, 4),
TrussPart = Vector2.new(2, 1),
CornerWedgePart = Vector2.new(2, 1),
WedgePart = Vector2.new(2, 1),
SpawnLocation = Vector2.new(6, 3),
Model = Vector2.new(3, 1),
Folder = Vector2.new(8, 8),
Tool = Vector2.new(8, 2),
Workspace = Vector2.new(10, 2),
Accessory = Vector2.new(3, 4),
Accoutrement = Vector2.new(3, 4)
}
function ItemRow:render()
local props = self.props
local state = self.state
-- Determine icon for class
local IconPosition = ItemRow.ClassIcons[props.Class] or Vector2.new(1, 1)
-- Item information
local Metadata = new(Frame, {
Layout = 'List',
LayoutDirection = 'Horizontal',
VerticalAlignment = 'Center'
},
{
StartSpacer = new(Frame, {
AspectRatio = (5 + 10 * props.Depth) / 18,
LayoutOrder = 0
}),
-- Class icon
Icon = new(ImageLabel, {
AspectRatio = 1,
Image = 'rbxassetid://2245672825',
ImageRectOffset = (IconPosition - Vector2.new(1, 1)) * Vector2.new(16, 16),
ImageRectSize = Vector2.new(16, 16),
Size = UDim2.new(1, 0, 12/18, 0),
LayoutOrder = 1
}),
IconSpacer = new(Frame, {
AspectRatio = 5/18,
LayoutOrder = 2
}),
-- Item name
NameContainer = new(ImageButton, {
Layout = 'List',
Width = 'WRAP_CONTENT',
LayoutOrder = 3,
[Roact.Event.Activated] = self.OnNameActivated
},
{
Name = (not state.EditingName) and new(TextLabel, {
TextSize = 13,
TextColor = 'FFFFFF',
Text = props.Name,
Width = 'WRAP_CONTENT'
}),
NameInput = state.EditingName and new(TextBox, {
TextSize = 13,
TextColor = 'FFFFFF',
Text = props.Name,
Width = 'WRAP_CONTENT',
[Roact.Event.FocusLost] = self.OnNameInputBlur
})
})
})
-- Item buttons
local Buttons = new(Frame, {
Layout = 'List',
LayoutDirection = 'Horizontal',
HorizontalAlignment = 'Right',
VerticalAlignment = 'Center',
Width = 'WRAP_CONTENT',
AnchorPoint = Vector2.new(1, 0.5),
Position = UDim2.new(1, 0, 0.5, 0)
},
{
-- Locking button
Lock = new(ImageButton, {
AspectRatio = 1,
DominantAxis = 'Height',
Image = 'rbxassetid://2244452978',
ImageRectOffset = Vector2.new(14 * (props.IsLocked and 2 or 1), 0) * 2,
ImageRectSize = Vector2.new(14, 14) * 2,
Size = UDim2.new(1, 0, 12/18, 0),
ImageTransparency = 1 - (props.IsLocked and 0.75 or 0.15),
LayoutOrder = 0,
[Roact.Event.Activated] = self.OnLockActivated
}),
Spacer = new(Frame, {
LayoutOrder = 1,
AspectRatio = 1/10
}),
-- Item expansion arrow
ArrowWrapper = next(props.Children) and new(Frame, {
AspectRatio = 1,
Size = UDim2.new(1, 0, 14/18, 0),
LayoutOrder = 2
},
{
Arrow = new(ImageButton, {
Image = 'rbxassetid://2244452978',
ImageRectOffset = Vector2.new(14 * 3, 0) * 2,
ImageRectSize = Vector2.new(14, 14) * 2,
Rotation = props.Expanded and 180 or 90,
ImageTransparency = 1 - 0.15,
[Roact.Event.Activated] = self.OnArrowActivated
})
}),
EndSpacer = new(Frame, {
LayoutOrder = 3,
AspectRatio = 1/20
})
})
-- Determine transparency from selection and targeting state
local Transparency = 1
if props.Selected then
Transparency = 1 - 0.15
elseif state.Targeted then
Transparency = 1 - 0.05
end
-- Return button with contents
return new(ImageButton, {
LayoutOrder = props.Order,
Size = UDim2.new(1, 0, 0, props.Height),
AutoButtonColor = false,
BackgroundColor3 = Color3.new(1, 1, 1),
BackgroundTransparency = Transparency,
[Roact.Event.Activated] = self.OnActivated
},
{
Metadata = Metadata,
Buttons = Buttons
})
end
return ItemRow
|
-- goro7 |
local plr = game.Players.LocalPlayer
function update()
-- Calculate scale
local scale = (plr.PlayerGui.MainGui.AbsoluteSize.Y) / script.Parent.Parent.Size.Y.Offset
if scale > 1.5 then
scale = 1.5
end
if scale > 0 then
script.Parent.Scale = scale
end
end
plr.PlayerGui:WaitForChild("MainGui"):GetPropertyChangedSignal("AbsoluteSize"):connect(update)
update()
|
-- If you want to after how many seconds can you get another hat on your head, change the line that says "wait(5)"
-- Changing this will change after how many seconds can someone touch the giver, and get a hat. It's best to leave it as it is,
-- Changing it really doesnt matter. | |
--BasedWeld2.0 |
local JS = game:GetService("JointsService")
function MakeWeld(x,y,type,s)
if type==nil then type="Weld" end
local W=Instance.new(type,JS)
W.Part0=x W.Part1=y
W.C0=x.CFrame:inverse()*x.CFrame
W.C1=y.CFrame:inverse()*x.CFrame
if type=="Motor" and s~=nil then
W.MaxVelocity=s
end
return W
end
function ModelWeld(a,b)
if a:IsA("BasePart") then
MakeWeld(b,a,"Weld")
elseif a:IsA("Model") then
for i,v in pairs(a:GetChildren()) do
ModelWeld(v,b)
end
end
end
function UnAnchor(a)
if a:IsA("BasePart") then a.Anchored=false end for i,v in pairs(a:GetChildren()) do UnAnchor(v) end
end |
--[[
berezaa's method of saving data (from the dev forum):
What I do and this might seem a little over-the-top but it's fine as long as you're not using datastores excessively elsewhere is have a datastore and an ordereddatastore for each player. When you perform a save, add a key (can be anything) with the value of os.time() to the ordereddatastore and save a key with the os.time() and the value of the player's data to the regular datastore. Then, when loading data, get the highest number from the ordered data store (most recent save) and load the data with that as a key.
Ever since I implemented this, pretty much no one has ever lost data. There's no caches to worry about either because you're never overriding any keys. Plus, it has the added benefit of allowing you to restore lost data, since every save doubles as a backup which can be easily found with the ordereddatastore
edit: while there's no official comment on this, many developers including myself have noticed really bad cache times and issues with using the same datastore keys to save data across multiple places in the same game. With this method, data is almost always instantly accessible immediately after a player teleports, making it useful for multi-place games.
--]] | |
--[[Dependencies]] |
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
local UserInputService = game:GetService("UserInputService")
local car = script.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
local _Tune2 = car["A-Chassis Tune"].Upgrades
|
--------END LIGHTED RECTANGLES--------
--------SIDE DOOR-------- |
game.Workspace.rightsidedoor.l1.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightsidedoor.l2.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightsidedoor.l3.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightsidedoor.l4.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightsidedoor.l5.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
|
--script.Parent.MouseClick:Connect(function()
-- script.Parent.MaxActivationDistance = 0
-- TweenA:Play()
-- wait(7)
-- TweenB:Play()
-- wait(3)
-- script.Parent.MaxActivationDistance = 20
--end) |
function onClick(click)
if click.TeamColor == BrickColor.new("White")then
TweenA:Play()
wait(7)
TweenB:Play()
end
end
script.Parent.MouseClick:Connect(onClick)
|
-- This is a FireFly swarm that spawns illuminating fireflies and let them glow and fly around
-- New flies spawn if a fly flies too far from center
-- The center part will be invisible when the game run. It's only shown in edit mode so you can work with this model easier. | |
--------LEFT DOOR -------- |
game.Workspace.doorleft.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l41.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l51.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l61.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l73.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
|
--[=[
`Construct` is called before the component is started, and should be used
to construct the component instance.
```lua
local MyComponent = Component.new({Tag = "MyComponent"})
function MyComponent:Construct()
self.SomeData = 32
self.OtherStuff = "HelloWorld"
end
```
]=] |
function Component:Construct()
end
|
-------------------------here |
weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
mouse.Move:connect(function ()
--local Direction = Tool.Direction.Value
local Direction = mouse.Hit.p
local b = head.Position.Y-Direction.Y
local dist = (head.Position-Direction).magnitude
local answer = math.asin(b/dist)
neck.C0=orginalC0*CFrame.fromEulerAnglesXYZ(answer,0,0)
wait(0.1)
end)end
else
print("sh")
end
else
print("arms")
end
end
function Unequip(mouse)
if arms ~= nil and torso ~= nil then
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
if sh ~= nil then
local yes = true
if yes then
yes = false
neck.C0 = orginalC0
sh[1].Part1 = arms[1]
sh[2].Part1 = arms[2]
welds[1].Parent = nil
welds[2].Parent = nil
end
else
print("sh")
end
else
print("arms")
end
end
Tool.Equipped:connect(Equip)
Tool.Unequipped:connect(Unequip)
function Animate()
arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
if Tool.AnimateValue.Value == "Shoot" then
local weld1 = welds[1]
local weld2 = welds[2]
weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
wait(0.00001)
weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.05, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
wait(0.00001)
weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.1, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-95), math.rad(-15), 0)
wait(0.00001)
weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.3, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-110), math.rad(-15), 0)
wait(0.00001)
weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.35, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-115), math.rad(-15), 0)
wait(0.00001)
weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
wait(0.00001)
weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
Tool.AnimateValue.Value = "None"
end
if Tool.AnimateValue.Value == "Reload" then
local weld1 = welds[1]
local weld2 = welds[2]
weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
wait(0.0001)
weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
wait(0.0001)
weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-95), math.rad(-15), 0)
wait(0.0001)
weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-100), math.rad(-15), 0)
wait(0.0001)
weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-105), math.rad(-15), 0)
wait(0.0001)
weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-110), math.rad(-15), 0)
wait(0.0001)
weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-115), math.rad(-15), 0)
wait(0.0001)
weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.45, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
wait(0.0001)
weld1.C1 = CFrame.new(-0.5+1.5, 0.9, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.5, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
wait(0.0001)
weld1.C1 = CFrame.new(-0.5+1.5, 1, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.55, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
wait(0.0001)
weld1.C1 = CFrame.new(-0.5+1.5, 1.1, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.57, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
wait(0.0001)
weld1.C1 = CFrame.new(-0.5+1.5, 1.2, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.6, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
wait(0.0001)
weld1.C1 = CFrame.new(-0.5+1.5, 1.3, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.6, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
wait(0.0001)
weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
Tool.AnimateValue.Value = "None"
end
end
Tool.AnimateValue.Changed:connect(Animate)
|
-- CastBehavior.CosmeticBulletTemplate = CosmeticBullet -- Uncomment if you just want a simple template part and aren't using PartCache |
CastBehavior.CosmeticBulletProvider = CosmeticPartProvider -- Comment out if you aren't using PartCache.
CastBehavior.CosmeticBulletContainer = CosmeticBulletsFolder |
--------------------[ FIRING FUNCTIONS ]---------------------------------------------- |
function lowerSpread()
if (not loweringSpread) then
loweringSpread = true
local Connection = nil
Connection = RS.Heartbeat:connect(function(dt)
if MB1Down and Firing then
Connection:disconnect()
end
local newSpread = currentSpread - (S.spreadSettings.Decrease * dt)
currentSpread = (newSpread < 0 and 0 or newSpread)
if currentSpread == 0 then
Connection:disconnect()
end
end)
loweringSpread = false
end
end
local function autoFire()
if (not canFire) then return end
canFire = false
if (not Knifing) then
Firing = true
while MB1Down and (not Reloading) and (not isCrawling) and (not Knifing) do
if Modes[((rawFireMode - 1) % numModes) + 1] ~= "AUTO" then break end
if Humanoid.Health == 0 then break end
if Ammo.Value > 0 then
Ammo.Value = Ammo.Value - 1
if Aimed and steadyKeyPressed and S.scopeSettings.unSteadyOnFire then
steadyKeyPressed = false
currentSteadyTime = 0
end
newMag = false
fireGun()
end
if S.reloadSettings.magIsBullet then
for _, Mag in pairs(Gun:GetChildren()) do
if Mag.Name:sub(1, 3) == "Mag" then
Mag.Transparency = 1
end
end
end
if Ammo.Value == 0 and S.reloadSettings.autoReload then
wait(0.2)
Reload()
end
wait(60 / S.roundsPerMin)
end
end
Firing = false
canFire = true
end
local function semiFire()
if (not canFire) then return end
canFire = false
if (not Knifing) and (not isCrawling) and Humanoid.Health ~= 0 then
Firing = true
if Ammo.Value > 0 then
Ammo.Value = Ammo.Value - 1
if Aimed and steadyKeyPressed and S.scopeSettings.unSteadyOnFire then
steadyKeyPressed = false
currentSteadyTime = 0
end
newMag = false
fireGun()
end
if S.reloadSettings.magIsBullet then
for _, Mag in pairs(Gun:GetChildren()) do
if Mag.Name:sub(1, 3) == "Mag" then
Mag.Transparency = 1
end
end
end
if Ammo.Value == 0 and S.reloadSettings.autoReload then
wait(0.2)
Reload()
end
wait(60 / S.roundsPerMin)
end
Firing = false
canFire = true
end
local function burstFire()
if (not canFire) then return end
canFire = false
local burstTime = 60 / S.roundsPerMin
if (not Knifing) and (not isCrawling) then
Firing = true
for i = 1, S.burstSettings.Amount do
if Ammo.Value > 0 then
Ammo.Value = Ammo.Value - 1
if Humanoid.Health ~= 0 then
if Aimed and steadyKeyPressed and S.scopeSettings.unSteadyOnFire then
steadyKeyPressed = false
currentSteadyTime = 0
end
newMag = false
fireGun()
end
end
if Ammo.Value == 0 and S.reloadSettings.autoReload then
wait(0.2)
Reload()
break
end
wait(S.burstSettings.fireRateBurst and burstTime or S.burstSettings.Time / S.burstSettings.Amount)
end
end
if S.reloadSettings.magIsBullet then
for _, Mag in pairs(Gun:GetChildren()) do
if Mag.Name:sub(1, 3) == "Mag" then
Mag.Transparency = 1
end
end
end
Firing = false
wait(S.burstSettings.fireRateBurst and burstTime or S.burstSettings.Wait)
canFire = true
end
function fireGun()
local fireSound = Handle:FindFirstChild("FireSound")
Gun.Bolt.Transparency = 1
Gun.BoltBack.Transparency = 0
if fireSound then fireSound:Play() end
----------------------------------------------------------------------------------
for _ = 1, (S.gunType.Shot and S.ShotAmount or 1) do
local randSpread1 = RAD(RAND(0, 365))
local randSpread2 = RAD(RAND(-(baseSpread + currentSpread), baseSpread + currentSpread, 0.01))
local spreadDir = CFrame.fromAxisAngle(V3(0, 0, 1), randSpread1) * CFANG(randSpread2, 0, 0)
local originCF = ((Aimed and S.guiScope) and Head.CFrame or Handle.CFrame) * spreadDir
local bulletDirection = CF(originCF.p, originCF.p + originCF.lookVector).lookVector
if S.bulletSettings.instantHit then
local newRay = Ray.new(Main.CFrame.p, bulletDirection * S.bulletSettings.Range)
local H, P, N = workspace:FindPartOnRayWithIgnoreList(newRay, Ignore)
local finalP = P
if H then
if S.gunType.Explosive then
if S.explosionSettings.soundId ~= "" then
local soundPart = Instance.new("Part")
soundPart.Transparency = 1
soundPart.Anchored = true
soundPart.CanCollide = false
soundPart.Size = V3(1, 1, 1)
soundPart.CFrame = CFrame.new(P)
soundPart.Parent = gunIgnore
local Sound = Instance.new("Sound")
Sound.Pitch = S.explosionSettings.Pitch
Sound.SoundId = S.explosionSettings.soundId
Sound.Volume = S.explosionSettings.Volume
Sound.Parent = soundPart
Sound:Play()
DS:AddItem(soundPart, Sound.TimeLength)
end
createBulletImpact:FireServer(H, P, N, bulletDirection, false, gunIgnore, S)
createShockwave:FireServer(P, S.explosionSettings.Radius, gunIgnore, S)
local E = Instance.new("Explosion")
E.BlastPressure = S.explosionSettings.Pressure
E.BlastRadius = S.explosionSettings.Radius
E.DestroyJointRadiusPercent = (S.explosionSettings.rangeBasedDamage and 0 or 1)
E.ExplosionType = S.explosionSettings.Type
E.Position = P
E.Hit:connect(function(Obj, Dist)
if Obj.Name == "Torso" and (not Obj:IsDescendantOf(Char)) then
if S.explosionSettings.rangeBasedDamage then
local Dir = (Obj.Position - P).unit
local expH, _ = workspace:FindPartOnRayWithIgnoreList(
Ray.new(P - Dir * 0.1, Dir * 999),
Ignore
)
local rayHitHuman = expH:IsDescendantOf(Obj.Parent)
if (S.explosionSettings.rayCastExplosions and rayHitHuman) or (not S.explosionSettings.rayCastExplosions) then
local hitHumanoid = findFirstClass(Obj.Parent, "Humanoid")
if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) then
local distFactor = Dist / S.explosionSettings.Radius
local distInvert = math.max(1 - distFactor,0)
local newDamage = distInvert * getBaseDamage((P - Main.CFrame.p).magnitude)
local Tag = Instance.new("ObjectValue")
Tag.Value = Player
Tag.Name = "creator"
Tag.Parent = hitHumanoid
DS:AddItem(Tag, 0.3)
hitHumanoid:TakeDamage(newDamage)
markHit()
end
end
else
local hitHumanoid = findFirstClass(Obj.Parent, "Humanoid")
if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) then
local Tag = Instance.new("ObjectValue")
Tag.Value = Player
Tag.Name = "creator"
Tag.Parent = hitHumanoid
DS:AddItem(Tag, 0.3)
markHit()
end
end
end
end)
E.Parent = game.Workspace
else
_, finalP = penetrateWall(H, P, bulletDirection, N, {Char, ignoreModel}, 0, (P - Main.CFrame.p).magnitude, nil)
end
end
if S.bulletTrail and S.trailSettings.Transparency ~= 1 then
createTrail:FireServer(Main.CFrame.p, finalP, gunIgnore, S)
end
else
local shell = Instance.new("Part")
shell.CFrame = Gun.Chamber.CFrame * CFrame.fromEulerAnglesXYZ(-1.5,0,0)
shell.Size = Vector3.new(1,1,1)
shell.BrickColor = BrickColor.new(24)
shell.Reflectance = .5
shell.CanCollide = false
shell.BottomSurface = 0
shell.TopSurface = 0
shell.Name = "Shell"
shell.Velocity = Gun.Chamber.CFrame.lookVector * 30 + Vector3.new(math.random(-10,10),20,math.random(-10,10))
shell.RotVelocity = Vector3.new(0,200,0)
local shellmesh = Instance.new("CylinderMesh")
shellmesh.Scale = Vector3.new(0.1, 0.8, 0.1)
shellmesh.Parent = shell
shell.Parent = game.Workspace
game:GetService("Debris"):addItem(shell,2)
local shellmesh = Instance.new("SpecialMesh")
shellmesh.Scale = Vector3.new(0.9,0.9,3)
shellmesh.MeshId = "http://www.roblox.com/asset/?id=95387759"
shellmesh.TextureId = "http://www.roblox.com/asset/?id=95387789"
shellmesh.MeshType = "FileMesh"
shellmesh.Parent = shell
end
end
function MarkHit()
spawn(function()
if Gui_Clone:IsDescendantOf(game) then
Gui_Clone.HitMarker.Visible = true
local StartMark = tick()
LastMark = StartMark
wait(0.5)
if LastMark <= StartMark then
Gui_Clone.HitMarker.Visible = false
end
end
end)
end
----------------------------------------------------------------------------------
currentSpread = currentSpread + S.spreadSettings.Increase
for _, Plugin in pairs(Plugins.Firing) do
spawn(function()
Plugin()
end)
end
local backRecoil = RAND(S.recoilSettings.Recoil.Back.Min, S.recoilSettings.Recoil.Back.Max, 0.01) --Get the kickback recoil
local upRecoil = RAND(S.recoilSettings.Recoil.Up.Min, S.recoilSettings.Recoil.Up.Max, 0.01) --Get the up recoil
local sideRecoilAlpha = 0
if lastSideRecoil[1] < 0 and lastSideRecoil[2] < 0 then --This conditional basically makes sure the gun tilt isn't in the same direction for more than 2 shots
sideRecoilAlpha = RAND(0, 1, 0.1)
elseif lastSideRecoil[1] > 0 and lastSideRecoil[2] > 0 then
sideRecoilAlpha = RAND(-1, 0, 0.1)
else
sideRecoilAlpha = RAND(-1, 1, 0.1)
end
local sideRecoil = numLerp(S.recoilSettings.Recoil.Side.Left, S.recoilSettings.Recoil.Side.Right, sideRecoilAlpha / 2 + 0.5) --Get the side recoil
local tiltRecoil = numLerp(S.recoilSettings.Recoil.Tilt.Left, S.recoilSettings.Recoil.Tilt.Right, sideRecoilAlpha / 2 + 0.5) --Get the tilt recoil
local recoilPos = V3(
0,---sideRecoil,
0,
-backRecoil
) * (Aimed and S.recoilSettings.aimedMultiplier or 1)
local recoilRot = V3(
(Aimed and 0 or (-RAD(upRecoil * 10) * (firstShot and S.recoilSettings.firstShotMultiplier or 1))),
RAD(sideRecoil * 10),
RAD(tiltRecoil * 10)
) * (Aimed and S.recoilSettings.aimedMultiplier or 1)
local camRecoilRot = V3(
-RAD(sideRecoil * 10),
RAD(upRecoil * 10) * (firstShot and S.recoilSettings.firstShotMultiplier or 1) * S.recoilSettings.camMultiplier,
0
) * (Aimed and S.recoilSettings.aimedMultiplier or 1) * stanceSway
tweenRecoil(recoilPos, recoilRot, Sine, 0.2)
tweenCam("Recoil", camRecoilRot, Sine, 0.15 * (firstShot and S.recoilSettings.firstShotMultiplier or 1))
for _, v in pairs(Main:GetChildren()) do
if v.Name:sub(1, 7) == "FlashFX" then
Gun.Bolt.Transparency = 1
Gun.BoltBack.Transparency = 0
v.Enabled = true
end
end
delay(1 / 20, function()
tweenRecoil(V3(), V3(), Sine, 0.2)
tweenCam("Recoil", V3(), Sine, 0.2)
for _, v in pairs(Main:GetChildren()) do
if v.Name:sub(1, 7) == "FlashFX" then
Gun.Bolt.Transparency = 0
Gun.BoltBack.Transparency = 1
v.Enabled = false
end
end
end)
updateClipAmmo()
firstShot = false
shotCount = shotCount + 1
lastSideRecoil[(shotCount % 2) + 1] = sideRecoilAlpha
end
function markHit()
spawn(function()
if mainGUI:IsDescendantOf(game) then
hitMarker.Visible = true
local startMark = tick()
hitMarker.lastMark.Value = startMark
wait(0.5)
if hitMarker.lastMark.Value <= startMark then
hitMarker.Visible = false
end
end
end)
end
|
--[[
Notes:
- The commission will take up to 30 days of pending before the game owner is able to use it.
- Also note that UGC creators have the option to disable in-game commissions, so you will not be able to earn commissions on some UGC items.
- Only the game creator will earn the commission.
--]] | |
--[[
CameraShaker.CameraShakeInstance
cameraShaker = CameraShaker.new(renderPriority, callbackFunction)
CameraShaker:Start()
CameraShaker:Stop()
CameraShaker:StopSustained([fadeOutTime])
CameraShaker:Shake(shakeInstance)
CameraShaker:ShakeSustain(shakeInstance)
CameraShaker:ShakeOnce(magnitude, roughness [, fadeInTime, fadeOutTime, posInfluence, rotInfluence])
CameraShaker:StartShake(magnitude, roughness [, fadeInTime, posInfluence, rotInfluence])
EXAMPLE:
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCFrame)
camera.CFrame = playerCFrame * shakeCFrame
end)
camShake:Start()
-- Explosion shake:
camShake:Shake(CameraShaker.Presets.Explosion)
wait(1)
-- Custom shake:
camShake:ShakeOnce(3, 1, 0.2, 1.5)
-- Sustained shake:
camShake:ShakeSustain(CameraShaker.Presets.Earthquake)
-- Stop all sustained shakes:
camShake:StopSustained(1) -- Argument is the fadeout time (defaults to the same as fadein time if not supplied)
-- Stop only one sustained shake:
shakeInstance = camShake:ShakeSustain(CameraShaker.Presets.Earthquake)
wait(2)
shakeInstance:StartFadeOut(1) -- Argument is the fadeout time
NOTE:
This was based entirely on the EZ Camera Shake asset for Unity3D. I was given written
permission by the developer, Road Turtle Games, to port this to Roblox.
Original asset link: https://assetstore.unity.com/packages/tools/camera/ez-camera-shake-33148
GitHub repository: https://github.com/Sleitnick/RbxCameraShaker
--]] |
local CameraShaker = {}
CameraShaker.__index = CameraShaker
local profileBegin = debug.profilebegin
local profileEnd = debug.profileend
local profileTag = "CameraShakerUpdate"
local V3 = Vector3.new
local CF = CFrame.new
local ANG = CFrame.Angles
local RAD = math.rad
local v3Zero = V3()
local CameraShakeInstance = require(script.CameraShakeInstance)
local CameraShakeState = CameraShakeInstance.CameraShakeState
local defaultPosInfluence = V3(0.15, 0.15, 0.15)
local defaultRotInfluence = V3(1, 1, 1)
CameraShaker.CameraShakeInstance = CameraShakeInstance
CameraShaker.Presets = require(script.CameraShakePresets)
function CameraShaker.new(renderPriority: number, callback: (camCFrame: CFrame) -> ())
assert(type(renderPriority) == "number", "RenderPriority must be a number (e.g.: Enum.RenderPriority.Camera.Value)")
assert(type(callback) == "function", "Callback must be a function")
local self = setmetatable({
_running = false;
_renderName = "CameraShaker";
_renderPriority = renderPriority;
_posAddShake = v3Zero;
_rotAddShake = v3Zero;
_camShakeInstances = {};
_removeInstances = {};
_callback = callback;
}, CameraShaker)
return self
end
function CameraShaker:Start()
if (self._running) then return end
self._running = true
local callback = self._callback
game:GetService("RunService"):BindToRenderStep(self._renderName, self._renderPriority, function(dt)
profileBegin(profileTag)
local cf = self:Update(dt)
profileEnd()
callback(cf)
end)
end
function CameraShaker:Stop()
if (not self._running) then return end
game:GetService("RunService"):UnbindFromRenderStep(self._renderName)
self._running = false
end
function CameraShaker:StopSustained(duration: number)
for _,c in pairs(self._camShakeInstances) do
if (c.fadeOutDuration == 0) then
c:StartFadeOut(duration or c.fadeInDuration)
end
end
end
function CameraShaker:Update(dt: number)
local posAddShake = v3Zero
local rotAddShake = v3Zero
local instances = self._camShakeInstances
-- Update all instances:
for i = 1,#instances do
local c = instances[i]
local state = c:GetState()
if (state == CameraShakeState.Inactive and c.DeleteOnInactive) then
self._removeInstances[#self._removeInstances + 1] = i
elseif (state ~= CameraShakeState.Inactive) then
local shake = c:UpdateShake(dt)
posAddShake = posAddShake + (shake * c.PositionInfluence)
rotAddShake = rotAddShake + (shake * c.RotationInfluence)
end
end
-- Remove dead instances:
for i = #self._removeInstances,1,-1 do
local instIndex = self._removeInstances[i]
table.remove(instances, instIndex)
self._removeInstances[i] = nil
end
return CF(posAddShake) *
ANG(0, RAD(rotAddShake.Y), 0) *
ANG(RAD(rotAddShake.X), 0, RAD(rotAddShake.Z))
end
function CameraShaker:Shake(shakeInstance)
assert(type(shakeInstance) == "table" and shakeInstance._camShakeInstance, "ShakeInstance must be of type CameraShakeInstance")
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
function CameraShaker:ShakeSustain(shakeInstance)
assert(type(shakeInstance) == "table" and shakeInstance._camShakeInstance, "ShakeInstance must be of type CameraShakeInstance")
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
shakeInstance:StartFadeIn(shakeInstance.fadeInDuration)
return shakeInstance
end
function CameraShaker:ShakeOnce(magnitude: number, roughness: number, fadeInTime: number, fadeOutTime: number, posInfluence: Vector3, rotInfluence: Vector3)
local shakeInstance = CameraShakeInstance.new(magnitude, roughness, fadeInTime, fadeOutTime)
shakeInstance.PositionInfluence = (typeof(posInfluence) == "Vector3" and posInfluence or defaultPosInfluence)
shakeInstance.RotationInfluence = (typeof(rotInfluence) == "Vector3" and rotInfluence or defaultRotInfluence)
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
function CameraShaker:StartShake(magnitude: number, roughness: number, fadeInTime: number, posInfluence: Vector3, rotInfluence: Vector3)
local shakeInstance = CameraShakeInstance.new(magnitude, roughness, fadeInTime)
shakeInstance.PositionInfluence = (typeof(posInfluence) == "Vector3" and posInfluence or defaultPosInfluence)
shakeInstance.RotationInfluence = (typeof(rotInfluence) == "Vector3" and rotInfluence or defaultRotInfluence)
shakeInstance:StartFadeIn(fadeInTime)
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
return CameraShaker
|
-- Listeners |
SpawnSegway.OnServerEvent:connect(function(Player,Character,MaxSpeed,TurnSpeed,Tool,SpawnedSegway,Color)
Functions.SpawnSegway(Player,Character,MaxSpeed,TurnSpeed,Tool,SpawnedSegway,Color)
end)
ConfigTool.OnServerEvent:connect(function(Player,Transparency,Tool,ShouldColor,Color)
Functions.ConfigTool(Transparency,Tool,ShouldColor,Color)
end)
DestroySegway.OnServerEvent:connect(function(Player,Character,SpawnedSegway)
Functions.DestroySegway(Character,SpawnedSegway)
end)
PlaySound.OnServerEvent:connect(function(Player,Sound,Pitch,Volume)
Functions.PlaySound(Sound,Pitch,Volume)
end)
StopSound.OnServerEvent:connect(function(Player,Sound,Volume)
Functions.StopSound(Sound,Volume)
end)
AnchorSegway.OnServerEvent:connect(function(Player,PrimaryPart,Anchored)
Functions.AnchorPart(PrimaryPart,Anchored)
end)
UndoTags.OnServerEvent:connect(function(Player,SegwayObject,WeldObject,Thruster,TiltMotor)
Functions.UndoTags(SegwayObject,WeldObject,Thruster,TiltMotor)
end)
UndoHasWelded.OnServerEvent:connect(function(Player,SeaterObject)
Functions.UndoHasWelded(SeaterObject)
end)
function DeleteWelds.OnServerInvoke(Player,Part)
Functions.DeleteWelds(Part)
return true
end
ConfigHumanoid.OnServerEvent:connect(function(Player,Humanoid,PlatformStand,Jump,AutoRotate)
Functions.ConfigHumanoid(Player.Character,Humanoid,PlatformStand,Jump,AutoRotate)
end)
ConfigLights.OnServerEvent:connect(function(Player,Transparency,Color,Bool,Material,Lights,Notifiers)
Functions.ConfigLights(Transparency,Color,Bool,Material,Lights,Notifiers)
end)
|
--[[ Module functions ]] | --
function Invisicam:LimbBehavior(castPoints)
for limb, _ in pairs(self.trackedLimbs) do
castPoints[#castPoints + 1] = limb.Position
end
end
function Invisicam:MoveBehavior(castPoints)
for i = 1, MOVE_CASTS do
local position: Vector3, velocity: Vector3 = self.humanoidRootPart.Position, self.humanoidRootPart.Velocity
local horizontalSpeed: number = Vector3.new(velocity.X, 0, velocity.Z).Magnitude / 2
local offsetVector: Vector3 = (i - 1) * self.humanoidRootPart.CFrame.lookVector :: Vector3 * horizontalSpeed
castPoints[#castPoints + 1] = position + offsetVector
end
end
function Invisicam:CornerBehavior(castPoints)
local cframe: CFrame = self.humanoidRootPart.CFrame
local centerPoint: Vector3 = cframe.p
local rotation = cframe - centerPoint
local halfSize = self.char:GetExtentsSize() / 2 --NOTE: Doesn't update w/ limb animations
castPoints[#castPoints + 1] = centerPoint
for i = 1, #CORNER_FACTORS do
castPoints[#castPoints + 1] = centerPoint + (rotation * (halfSize * CORNER_FACTORS[i]))
end
end
function Invisicam:CircleBehavior(castPoints)
local cframe: CFrame
if self.mode == MODE.CIRCLE1 then
cframe = self.humanoidRootPart.CFrame
else
local camCFrame: CFrame = self.camera.CoordinateFrame
cframe = camCFrame - camCFrame.p + self.humanoidRootPart.Position
end
castPoints[#castPoints + 1] = cframe.p
for i = 0, CIRCLE_CASTS - 1 do
local angle = (2 * math.pi / CIRCLE_CASTS) * i
local offset = 3 * Vector3.new(math.cos(angle), math.sin(angle), 0)
castPoints[#castPoints + 1] = cframe * offset
end
end
function Invisicam:LimbMoveBehavior(castPoints)
self:LimbBehavior(castPoints)
self:MoveBehavior(castPoints)
end
function Invisicam:CharacterOutlineBehavior(castPoints)
local torsoUp = self.torsoPart.CFrame.upVector.unit
local torsoRight = self.torsoPart.CFrame.rightVector.unit
-- Torso cross of points for interior coverage
castPoints[#castPoints + 1] = self.torsoPart.CFrame.p
castPoints[#castPoints + 1] = self.torsoPart.CFrame.p + torsoUp
castPoints[#castPoints + 1] = self.torsoPart.CFrame.p - torsoUp
castPoints[#castPoints + 1] = self.torsoPart.CFrame.p + torsoRight
castPoints[#castPoints + 1] = self.torsoPart.CFrame.p - torsoRight
if self.headPart then
castPoints[#castPoints + 1] = self.headPart.CFrame.p
end
local cframe = CFrame.new(ZERO_VECTOR3,Vector3.new(self.camera.CoordinateFrame.lookVector.X,0,self.camera.CoordinateFrame.lookVector.Z))
local centerPoint = (self.torsoPart and self.torsoPart.Position or self.humanoidRootPart.Position)
local partsWhitelist = {self.torsoPart}
if self.headPart then
partsWhitelist[#partsWhitelist + 1] = self.headPart
end
for i = 1, CHAR_OUTLINE_CASTS do
local angle = (2 * math.pi * i / CHAR_OUTLINE_CASTS)
local offset = cframe * (3 * Vector3.new(math.cos(angle), math.sin(angle), 0))
offset = Vector3.new(offset.X, math.max(offset.Y, -2.25), offset.Z)
local ray = Ray.new(centerPoint + offset, -3 * offset)
local hit, hitPoint = game.Workspace:FindPartOnRayWithWhitelist(ray, partsWhitelist, false, false)
if hit then
-- Use hit point as the cast point, but nudge it slightly inside the character so that bumping up against
-- walls is less likely to cause a transparency glitch
castPoints[#castPoints + 1] = hitPoint + 0.2 * (centerPoint - hitPoint).unit
end
end
end
function Invisicam:SmartCircleBehavior(castPoints)
local torsoUp = self.torsoPart.CFrame.upVector.unit
local torsoRight = self.torsoPart.CFrame.rightVector.unit
-- SMART_CIRCLE mode includes rays to head and 5 to the torso.
-- Hands, arms, legs and feet are not included since they
-- are not canCollide and can therefore go inside of parts
castPoints[#castPoints + 1] = self.torsoPart.CFrame.p
castPoints[#castPoints + 1] = self.torsoPart.CFrame.p + torsoUp
castPoints[#castPoints + 1] = self.torsoPart.CFrame.p - torsoUp
castPoints[#castPoints + 1] = self.torsoPart.CFrame.p + torsoRight
castPoints[#castPoints + 1] = self.torsoPart.CFrame.p - torsoRight
if self.headPart then
castPoints[#castPoints + 1] = self.headPart.CFrame.p
end
local cameraOrientation = self.camera.CFrame - self.camera.CFrame.p
local torsoPoint = Vector3.new(0,0.5,0) + (self.torsoPart and self.torsoPart.Position or self.humanoidRootPart.Position)
local radius = 2.5
-- This loop first calculates points in a circle of radius 2.5 around the torso of the character, in the
-- plane orthogonal to the camera's lookVector. Each point is then raycast to, to determine if it is within
-- the free space surrounding the player (not inside anything). Two iterations are done to adjust points that
-- are inside parts, to try to move them to valid locations that are still on their camera ray, so that the
-- circle remains circular from the camera's perspective, but does not cast rays into walls or parts that are
-- behind, below or beside the character and not really obstructing view of the character. This minimizes
-- the undesirable situation where the character walks up to an exterior wall and it is made invisible even
-- though it is behind the character.
for i = 1, SMART_CIRCLE_CASTS do
local angle = SMART_CIRCLE_INCREMENT * i - 0.5 * math.pi
local offset = radius * Vector3.new(math.cos(angle), math.sin(angle), 0)
local circlePoint = torsoPoint + cameraOrientation * offset
-- Vector from camera to point on the circle being tested
local vp = circlePoint - self.camera.CFrame.p
local ray = Ray.new(torsoPoint, circlePoint - torsoPoint)
local hit, hp, hitNormal = game.Workspace:FindPartOnRayWithIgnoreList(ray, {self.char}, false, false )
local castPoint = circlePoint
if hit then
local hprime = hp + 0.1 * hitNormal.unit -- Slightly offset hit point from the hit surface
local v0 = hprime - torsoPoint -- Vector from torso to offset hit point
local perp = (v0:Cross(vp)).unit
-- Vector from the offset hit point, along the hit surface
local v1 = (perp:Cross(hitNormal)).unit
-- Vector from camera to offset hit
local vprime = (hprime - self.camera.CFrame.p).unit
-- This dot product checks to see if the vector along the hit surface would hit the correct
-- side of the invisicam cone, or if it would cross the camera look vector and hit the wrong side
if ( v0.unit:Dot(-v1) < v0.unit:Dot(vprime)) then
castPoint = RayIntersection(hprime, v1, circlePoint, vp)
if castPoint.Magnitude > 0 then
local ray = Ray.new(hprime, castPoint - hprime)
local hit, hitPoint, hitNormal = game.Workspace:FindPartOnRayWithIgnoreList(ray, {self.char}, false, false )
if hit then
local hprime2 = hitPoint + 0.1 * hitNormal.unit
castPoint = hprime2
end
else
castPoint = hprime
end
else
castPoint = hprime
end
local ray = Ray.new(torsoPoint, (castPoint - torsoPoint))
local hit, hitPoint, hitNormal = game.Workspace:FindPartOnRayWithIgnoreList(ray, {self.char}, false, false )
if hit then
local castPoint2 = hitPoint - 0.1 * (castPoint - torsoPoint).unit
castPoint = castPoint2
end
end
castPoints[#castPoints + 1] = castPoint
end
end
function Invisicam:CheckTorsoReference()
if self.char then
self.torsoPart = self.char:FindFirstChild("Torso")
if not self.torsoPart then
self.torsoPart = self.char:FindFirstChild("UpperTorso")
if not self.torsoPart then
self.torsoPart = self.char:FindFirstChild("HumanoidRootPart")
end
end
self.headPart = self.char:FindFirstChild("Head")
end
end
function Invisicam:CharacterAdded(char: Model, player: Player)
-- We only want the LocalPlayer's character
if player~=PlayersService.LocalPlayer then return end
if self.childAddedConn then
self.childAddedConn:Disconnect()
self.childAddedConn = nil
end
if self.childRemovedConn then
self.childRemovedConn:Disconnect()
self.childRemovedConn = nil
end
self.char = char
self.trackedLimbs = {}
local function childAdded(child)
if child:IsA("BasePart") then
if LIMB_TRACKING_SET[child.Name] then
self.trackedLimbs[child] = true
end
if child.Name == "Torso" or child.Name == "UpperTorso" then
self.torsoPart = child
end
if child.Name == "Head" then
self.headPart = child
end
end
end
local function childRemoved(child)
self.trackedLimbs[child] = nil
-- If removed/replaced part is 'Torso' or 'UpperTorso' double check that we still have a TorsoPart to use
self:CheckTorsoReference()
end
self.childAddedConn = char.ChildAdded:Connect(childAdded)
self.childRemovedConn = char.ChildRemoved:Connect(childRemoved)
for _, child in pairs(self.char:GetChildren()) do
childAdded(child)
end
end
function Invisicam:SetMode(newMode: number)
AssertTypes(newMode, 'number')
for _, modeNum in pairs(MODE) do
if modeNum == newMode then
self.mode = newMode
self.behaviorFunction = self.behaviors[self.mode]
return
end
end
error("Invalid mode number")
end
function Invisicam:GetObscuredParts()
return self.savedHits
end
|
--[=[
Utility functions to observe the state of Roblox. This is a very powerful way to query
Roblox's state.
:::tip
Use RxInstanceUtils to program streaming enabled games, and make it easy to debug. This API surface
lets you use Roblox as a source-of-truth which is very valuable.
:::
@class RxInstanceUtils
]=] |
local require = require(script.Parent.loader).load(script)
local Brio = require("Brio")
local Maid = require("Maid")
local Observable = require("Observable")
local Rx = require("Rx")
local Symbol = require("Symbol")
local UNSET_VALUE = Symbol.named("unsetValue")
local RxInstanceUtils = {}
|
--------END RIGHT DOOR -------- |
game.Workspace.doorleft.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l32.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l41.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l53.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l62.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l71.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l42.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l51.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l63.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l72.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l22.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l43.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l52.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l61.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l73.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
-- Listen to level changes |
upgrades.Changed:Connect(function()
Level.Text = upgrades.Value
end)
points.Changed:Connect(updateUpgrades)
GameplayUi:GetPropertyChangedSignal("Enabled"):Connect(toggleEnabled)
LobbyButton.Activated:Connect(toggleLobby)
humanoid.Died:Connect(function() ChangeController:FireServer(true) toggleLobby() end)
|
----------------------------------
-----------CONNECTIONS------------
---------------------------------- |
PianoKeysConnections = {};
ExitButtonConnection = nil;
SheetsButtonConnection = nil;
CapsButtonConnection = nil;
TransDnConnection = nil;
TransUpConnection = nil;
VolumeUpConnection = nil;
VolumeDownConnection = nil;
function MakeGuiConnections()
for i, v in pairs(PianoGui.Keys:GetChildren()) do
PianoKeysConnections[i] = v.InputBegan:connect(function(Object) PianoKeyPressed(Object, tonumber(v.Name)) end)
end
ExitButtonConnection = PianoGui.ExitButton.InputBegan:connect(ExitButtonPressed)
SheetsButtonConnection = PianoGui.SheetsButton.InputBegan:connect(SheetsButtonPressed)
CapsButtonConnection = PianoGui.CapsButton.InputBegan:connect(CapsButtonPressed)
TransDnConnection = PianoGui.TransDnButton.MouseButton1Click:connect(function()
Transpose(-1)
end)
TransUpConnection = PianoGui.TransUpButton.MouseButton1Click:connect(function()
Transpose(1)
end)
VolumeUpConnection = PianoGui.VolumeUpButton.MouseButton1Click:connect(function()
VolumeChange(.1)
end)
VolumeDownConnection = PianoGui.VolumeDownButton.MouseButton1Click:connect(function()
VolumeChange(-.1)
end)
end
function BreakGuiConnections()
for i, v in pairs(PianoKeysConnections) do
v:disconnect()
end
ExitButtonConnection:disconnect()
SheetsButtonConnection:disconnect()
CapsButtonConnection:disconnect()
end
|
----- NO EDITING BELOW ----- |
local weldedParts = {}
table.insert(weldedParts,mainPart)
function Weld(x, y)
weld = Instance.new("Weld")
weld.Part0 = x
weld.Part1 = y
local CJ = CFrame.new(x.Position)
weld.C0 = x.CFrame:inverse() * CJ
weld.C1 = y.CFrame:inverse() * CJ
weld.Parent = x
table.insert(weldedParts,y)
end
function WeldRec(instance)
local childs = instance:GetChildren()
for _,v in pairs(childs) do
if v:IsA("BasePart") then
Weld(mainPart, v)
end
WeldRec(v)
end
end
WeldRec(P) |
--------| Variables |-------- |
local cachedProperties = {}
local particleFolder
|
-- Place in main folder |
aud = script.Parent.AudibleCircuit
wait(1)
while true do
aud.Value = 1
wait(0.5)
aud.Value = 0
wait(2.5)
end
|
-- Provide an interface into the module |
return {
-- Provide access to internal options
Options = Options;
-- Provide client actions API
PerformAction = function (Client, ActionName, ...)
-- Make sure the action exists
local Action = Actions[ActionName];
if not Action then
return;
end;
-- Ensure client is current player in tool mode
if ToolMode == 'Tool' then
--assert(Player and (Client == Player), 'Permission denied for client');
end;
-- Execute valid actions
local rs = game:GetService("RunService")
return Action(...);
end;
};
|
--SKP_10:Create(SKP_23,TweenInfo.new(2.5 * Hurt,Enum.EasingStyle.Sine,Enum.EasingDirection.In,0,false,0),{TintColor = Color3.new(1,1,1)}):Play() |
SKP_11:AddItem(SKP_22, 3 * Hurt)
SKP_11:AddItem(SKP_23, 2.5 * Hurt)
end
SKP_20 = SKP_7.Health
end)
local SKP_24 = false
SKP_15.Variaveis.Dor.Changed:Connect(function(Valor)
end)
SKP_17.Changed:Connect(function(Valor)
if Valor >= SKP_17.MaxValue/2 then
SKP_12.Saturation = ((Valor*2)/SKP_17.MaxValue) - 2
elseif Valor < SKP_17.MaxValue/2 then
SKP_12.Saturation = -1
elseif Valor <= 0 then
SKP_12.Saturation = -1
end
end)
SKP_15.Variaveis.HitCount.Changed:Connect(function(Valor)
if Valor >= 3 then
SKP_4.Render:FireServer(true,"N/A")
end
end)
SKP_16.Changed:Connect(function(Valor)
if Valor == true then
SKP_13.Brightness = -10
else
SKP_13.Brightness = 0
end
end)
SKP_7.Died:Connect(function()
Morto = true
SKP_7.AutoRotate = false
SKP_13.TintColor = Color3.new(1,1,1)
|
--[[ Chassis Variables ]] | --
local VehicleParameters = { -- These are default values in the case the package structure is broken
MaxSpeed = 75/mphConversion,
ReverseSpeed = 45/mphConversion,
DrivingTorque = 30000,
BrakingTorque = 70000,
StrutSpringStiffnessFront = 28000,
StrutSpringDampingFront = 1430,
StrutSpringStiffnessRear = 27000,
StrutSpringDampingRear = 1400,
TorsionSpringStiffness = 20000,
TorsionSpringDamping = 150,
MaxSteer = 0.55,
WheelFriction = 2
}
local Chassis = nil
local LimitSteerAtHighVel = true |
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 290 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 4.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
--// All global vars will be wiped/replaced except script
--// All guis are autonamed codeName..gui.Name |
return function(data, env)
if env then
setfenv(1, env)
end
local player = service.Players.LocalPlayer
local playergui = player.PlayerGui
local gui = script.Parent.Parent
local frame = gui.Frame
local text = gui.Frame.TextBox
local scroll = gui.Frame.ScrollingFrame
local players = gui.Frame.PlayerList
local entry = gui.Entry
local BindEvent = gTable.BindEvent
local opened = false
local scrolling = false
local scrollOpen = false
local debounce = false
local settings = client.Remote.Get("Setting",{"SplitKey","ConsoleKeyCode","BatchKey","Prefix"})
local splitKey = settings.SplitKey
local consoleKey = settings.ConsoleKeyCode
local batchKey = settings.BatchKey
local prefix = settings.Prefix
local commands = client.Remote.Get('FormattedCommands') or {}
local tweenInfo = TweenInfo.new(0.15)----service.SafeTweenSize(frame,UDim2.new(1,0,0,40),nil,nil,0.3,nil,function() if scrollOpen then frame.Size = UDim2.new(1,0,0,140) end end)
local scrollOpenTween = service.TweenService:Create(frame, tweenInfo, {
Size = UDim2.new(1, 0, 0, 140);
})
local scrollCloseTween = service.TweenService:Create(frame, tweenInfo, {
Size = UDim2.new(1, 0, 0, 40);
})
local consoleOpenTween = service.TweenService:Create(frame, tweenInfo, {
Position = UDim2.new(0, 0, 0, 0);
})
local consoleCloseTween = service.TweenService:Create(frame, tweenInfo, {
Position = UDim2.new(0, 0, 0, -200);
})
frame.Position = UDim2.new(0,0,0,-200)
frame.Visible = false
frame.Size = UDim2.new(1,0,0,40)
scroll.Visible = false
if client.Variables.ConsoleOpen then
if client.Variables.ChatEnabled then
service.StarterGui:SetCoreGuiEnabled("Chat",true)
end
if client.Variables.PlayerListEnabled then
service.StarterGui:SetCoreGuiEnabled('PlayerList',true)
end
if client.UI.Get("Notif") then
client.UI.Get("Notif",nil,true).Object.LABEL.Visible = true
end
local scr = client.UI.Get("Chat",nil,true)
if scr then scr.Object.Drag.Visible = true end
local scr = client.UI.Get("PlayerList",nil,true)
if scr then scr.Object.Drag.Visible = true end
local scr = client.UI.Get("HintHolder",nil,true)
if scr then scr.Object.Frame.Visible = true end
end
client.Variables.ChatEnabled = service.StarterGui:GetCoreGuiEnabled("Chat")
client.Variables.PlayerListEnabled = service.StarterGui:GetCoreGuiEnabled('PlayerList')
local function close()
if gui:IsDescendantOf(game) and not debounce then
debounce = true
scroll:ClearAllChildren()
scroll.CanvasSize = UDim2.new(0,0,0,0)
scroll.ScrollingEnabled = false
frame.Size = UDim2.new(1,0,0,40)
scroll.Visible = false
players.Visible = false
scrollOpen = false
if client.Variables.ChatEnabled then
service.StarterGui:SetCoreGuiEnabled("Chat",true)
end
if client.Variables.PlayerListEnabled then
service.StarterGui:SetCoreGuiEnabled('PlayerList',true)
end
if client.UI.Get("Notif") then
client.UI.Get("Notif",nil,true).Object.LABEL.Visible = true
end
local scr = client.UI.Get("Chat",nil,true)
if scr then scr.Object.Drag.Visible = true end
local scr = client.UI.Get("PlayerList",nil,true)
if scr then scr.Object.Drag.Visible = true end
local scr = client.UI.Get("HintHolder",nil,true)
if scr then scr.Object.Frame.Visible = true end
consoleCloseTween:Play();
--service.SafeTweenPos(frame,UDim2.new(0,0,0,-200),'Out','Linear',0.2,true)
--frame:TweenPosition(UDim2.new(0,0,0,-200),'Out','Linear',0.2,true)
debounce = false
opened = false
end
end
local function open()
if gui:IsDescendantOf(game) and not debounce then
debounce = true
client.Variables.ChatEnabled = service.StarterGui:GetCoreGuiEnabled("Chat")
client.Variables.PlayerListEnabled = service.StarterGui:GetCoreGuiEnabled('PlayerList')
service.StarterGui:SetCoreGuiEnabled("Chat",false)
service.StarterGui:SetCoreGuiEnabled('PlayerList',false)
scroll.ScrollingEnabled = true
players.ScrollingEnabled = true
if client.UI.Get("Notif") then
client.UI.Get("Notif",nil,true).Object.LABEL.Visible = false
end
local scr = client.UI.Get("Chat",nil,true)
if scr then scr.Object.Drag.Visible = false end
local scr = client.UI.Get("PlayerList",nil,true)
if scr then scr.Object.Drag.Visible = false end
local scr = client.UI.Get("HintHolder",nil,true)
if scr then scr.Object.Frame.Visible = false end
consoleOpenTween:Play();
frame.Size = UDim2.new(1,0,0,40)
scroll.Visible = false
players.Visible = false
scrollOpen = false
text.Text = ''
frame.Visible = true
frame.Position = UDim2.new(0,0,0,0)
text:CaptureFocus()
text.Text = ''
task.wait()
text.Text = ''
debounce = false
opened = true
end
end
text.FocusLost:Connect(function(enterPressed)
if enterPressed then
if text.Text~='' and string.len(text.Text)>1 then
task.spawn(function()
local sound = Instance.new("Sound",service.LocalContainer())
sound.SoundId = "rbxassetid://669596713"
sound.Volume = 0.2
sound:Play()
task.wait(0.5)
sound:Destroy()
end)
client.Remote.Send('ProcessCommand',text.Text)
end
end
close()
end)
text.Changed:Connect(function(c)
if c == 'Text' and text.Text ~= '' and open then
if string.sub(text.Text, string.len(text.Text)) == " " then
if players:FindFirstChild("Entry 0") then
text.Text = `{string.sub(text.Text, 1, (string.len(text.Text) - 1))}{players["Entry 0"].Text} `
elseif scroll:FindFirstChild("Entry 0") then
text.Text = string.split(scroll["Entry 0"].Text, "<")[1]
else
text.Text = text.Text..prefix
end
text.CursorPosition = string.len(text.Text) + 1
text.Text = string.gsub(text.Text, " ", "")
end
scroll:ClearAllChildren()
players:ClearAllChildren()
local nText = text.Text
if string.match(nText,`.*{batchKey}([^']+)`) then
nText = string.match(nText,`.*{batchKey}([^']+)`)
nText = string.match(nText,"^%s*(.-)%s*$")
end
local pNum = 0
local pMatch = string.match(nText,`.+{splitKey}(.*)$`)
for i,v in service.Players:GetPlayers() do
if (pMatch and string.sub(string.lower(tostring(v)),1,#pMatch) == string.lower(pMatch)) or string.match(nText,`{splitKey}$`) then
local new = entry:Clone()
new.Text = tostring(v)
new.Name = `Entry {pNum}`
new.TextXAlignment = "Right"
new.Visible = true
new.Parent = players
new.Position = UDim2.new(0,0,0,20*pNum)
new.MouseButton1Down:Connect(function()
text.Text = text.Text..tostring(v)
text:CaptureFocus()
end)
pNum = pNum+1
end
end
players.CanvasSize = UDim2.new(0,0,0,pNum*20)
local num = 0
for i,v in commands do
if string.sub(string.lower(v),1,#nText) == string.lower(nText) or string.find(string.lower(v), string.match(string.lower(nText),`^(.-){splitKey}`) or string.lower(nText), 1, true) then
if not scrollOpen then
scrollOpenTween:Play();
--frame.Size = UDim2.new(1,0,0,140)
scroll.Visible = true
players.Visible = true
scrollOpen = true
end
local b = entry:Clone()
b.Visible = true
b.Parent = scroll
b.Text = v
b.Name = `Entry {num}`
b.Position = UDim2.new(0,0,0,20*num)
b.MouseButton1Down:Connect(function()
text.Text = b.Text
text:CaptureFocus()
end)
num = num+1
end
end
frame.Size = UDim2.new(1, 0, 0, math.clamp((num*20)+40, 40, 140))
scroll.CanvasSize = UDim2.new(0,0,0,num*20)
elseif c == 'Text' and text.Text == '' and opened then
scrollCloseTween:Play();
--service.SafeTweenSize(frame,UDim2.new(1,0,0,40),nil,nil,0.3,nil,function() if scrollOpen then frame.Size = UDim2.new(1,0,0,140) end end)
scroll.Visible = false
players.Visible = false
scrollOpen = false
scroll:ClearAllChildren()
scroll.CanvasSize = UDim2.new(0,0,0,0)
end
end)
BindEvent(service.UserInputService.InputBegan, function(InputObject)
local textbox = service.UserInputService:GetFocusedTextBox()
if not (textbox) and rawequal(InputObject.UserInputType, Enum.UserInputType.Keyboard) and InputObject.KeyCode.Name == (client.Variables.CustomConsoleKey or consoleKey) then
if opened then
close()
else
open()
end
client.Variables.ConsoleOpen = opened
end
end)
gTable:Ready()
end
|
--[=[
Chains onto an existing Promise and returns a new Promise.
:::warning
Within the failure handler, you should never assume that the rejection value is a string. Some rejections within the Promise library are represented by [[Error]] objects. If you want to treat it as a string for debugging, you should call `tostring` on it first.
:::
Return a Promise from the success or failure handler and it will be chained onto.
@param successHandler (...: any) -> ...any
@param failureHandler? (...: any) -> ...any
@return Promise<...any>
]=] |
function Promise.prototype:andThen(successHandler, failureHandler)
assert(successHandler == nil or isCallable(successHandler), string.format(ERROR_NON_FUNCTION, "Promise:andThen"))
assert(failureHandler == nil or isCallable(failureHandler), string.format(ERROR_NON_FUNCTION, "Promise:andThen"))
return self:_andThen(debug.traceback(nil, 2), successHandler, failureHandler)
end
|
--// Recoil Settings |
gunrecoil = -0.3; -- How much the gun recoils backwards when not aiming
camrecoil = 0.05; -- How much the camera flicks when not aiming
AimGunRecoil = -0.1; -- How much the gun recoils backwards when aiming
AimCamRecoil = 0.02; -- How much the camera flicks when aiming
Kickback = 3; -- Upward gun rotation when not aiming
AimKickback = 0.1; -- Upward gun rotation when aiming
|
--[[Engine]] |
local fFD = _Tune.FinalDrive*_Tune.FDMult
local fFDr = fFD*30/math.pi
local cGrav = workspace.Gravity*_Tune.InclineComp/32.2
local wDRatio = wDia*math.pi/60
local cfWRot = CFrame.Angles(math.pi/2,-math.pi/2,0)
local cfYRot = CFrame.Angles(0,math.pi,0)
local rtTwo = (2^.5)/2
--Horsepower Curve
local fgc_h=_Tune.Horsepower/1000
local fgc_n=_Tune.PeakRPM/1000
local fgc_a=_Tune.PeakSharpness
local fgc_c=_Tune.CurveMult
function FGC(x)
x=x/1000
return (((-(x-fgc_n)^2)*math.min(fgc_h/(fgc_n^2),fgc_c^(fgc_n/fgc_h)))+fgc_h)*(x-((x^fgc_a)/((fgc_a*fgc_n)^(fgc_a-1))))
end
local PeakFGC = FGC(_Tune.PeakRPM)
--Plot Current Horsepower
function GetCurve(x,gear)
local hp=math.max((FGC(x)*_Tune.Horsepower)/PeakFGC,0)
return hp,hp*(_Tune.EqPoint/x)*_Tune.Ratios[gear+2]*fFD*hpScaling
end
--Output Cache
local CacheTorque = true
local HPCache = {}
local HPInc = 100
if CacheTorque then
for gear,ratio in pairs(_Tune.Ratios) do
local hpPlot = {}
for rpm = math.floor(_Tune.IdleRPM/HPInc),math.ceil((_Tune.Redline+100)/HPInc) do
local tqPlot = {}
tqPlot.Horsepower,tqPlot.Torque = GetCurve(rpm*HPInc,gear-2)
hp1,tq1 = GetCurve((rpm+1)*HPInc,gear-2)
tqPlot.HpSlope = (hp1 - tqPlot.Horsepower)/(HPInc/1000)
tqPlot.TqSlope = (tq1 - tqPlot.Torque)/(HPInc/1000)
hpPlot[rpm] = tqPlot
end
table.insert(HPCache,hpPlot)
end
end
--Powertrain
--Update RPM
function RPM()
--Neutral Gear
if _CGear==0 then _ClutchOn = false end
--Car Is Off
local revMin = _Tune.IdleRPM
if not _IsOn then
revMin = 0
_CGear = 0
_ClutchOn = false
_GThrot = _Tune.IdleThrottle/100
end
--Determine RPM
local maxSpin=0
for i,v in pairs(Drive) do
if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end
end
if _ClutchOn then
local aRPM = math.max(math.min(maxSpin*_Tune.Ratios[_CGear+2]*fFDr,_Tune.Redline+100),revMin)
local clutchP = math.min(math.abs(aRPM-_RPM)/_Tune.ClutchTol,.9)
_RPM = _RPM*clutchP + aRPM*(1-clutchP)
else
if _GThrot-(_Tune.IdleThrottle/100)>0 then
if _RPM>_Tune.Redline then
_RPM = _RPM-_Tune.RevBounce*2
else
_RPM = math.min(_RPM+_Tune.RevAccel*_GThrot,_Tune.Redline+100)
end
else
_RPM = math.max(_RPM-_Tune.RevDecay,revMin)
end
end
--Rev Limiter
_spLimit = (_Tune.Redline+100)/(fFDr*_Tune.Ratios[_CGear+2])
if _RPM>_Tune.Redline then
if _CGear<#_Tune.Ratios-2 then
_RPM = _RPM-_Tune.RevBounce
else
_RPM = _RPM-_Tune.RevBounce*.5
end
end
end
--Apply Power
function Engine()
--Get Torque
local maxSpin=0
for i,v in pairs(Drive) do
if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end
end
if _ClutchOn then
if CacheTorque then
local cTq = HPCache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(_Tune.IdleRPM,_RPM))/HPInc)]
_HP = cTq.Horsepower+(cTq.HpSlope*(_RPM-math.floor(_RPM/HPInc))/1000)
_OutTorque = cTq.Torque+(cTq.TqSlope*(_RPM-math.floor(_RPM/HPInc))/1000)
else
_HP,_OutTorque = GetCurve(_RPM,_CGear)
end
local iComp =(car.DriveSeat.CFrame.lookVector.y)*cGrav
if _CGear==-1 then iComp=-iComp end
_OutTorque = _OutTorque*math.max(1,(1+iComp))
else
_HP,_OutTorque = 0,0
end
--Automatic Transmission
if _TMode == "Auto" and _IsOn then
_ClutchOn = true
if _CGear == 0 then _CGear = 1 end
if _CGear >= 1 then
if _CGear==1 and _GBrake > 0 and car.DriveSeat.Velocity.Magnitude < 20 then
_CGear = -1
else
if _Tune.AutoShiftMode == "RPM" then
if _RPM>(_Tune.PeakRPM+_Tune.AutoUpThresh) then
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif math.max(math.min(maxSpin*_Tune.Ratios[_CGear+1]*fFDr,_Tune.Redline+100),_Tune.IdleRPM)<(_Tune.PeakRPM-_Tune.AutoDownThresh) then
_CGear=math.max(_CGear-1,1)
end
else
if car.DriveSeat.Velocity.Magnitude > math.ceil(wDRatio*(_Tune.PeakRPM+_Tune.AutoUpThresh)/_Tune.Ratios[_CGear+2]/fFD) then
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif car.DriveSeat.Velocity.Magnitude < math.ceil(wDRatio*(_Tune.PeakRPM-_Tune.AutoDownThresh)/_Tune.Ratios[_CGear+1]/fFD) then
_CGear=math.max(_CGear-1,1)
end
end
end
else
if _GThrot-(_Tune.IdleThrottle/100) > 0 and car.DriveSeat.Velocity.Magnitude < 20 then
_CGear = 1
end
end
end
--Average Rotational Speed Calculation
local fwspeed=0
local fwcount=0
local rwspeed=0
local rwcount=0
for i,v in pairs(car.Wheels:GetChildren()) do
if v.Name=="FL" or v.Name=="FR" or v.Name == "F" then
fwspeed=fwspeed+v.RotVelocity.Magnitude
fwcount=fwcount+1
elseif v.Name=="RL" or v.Name=="RR" or v.Name == "R" then
rwspeed=rwspeed+v.RotVelocity.Magnitude
rwcount=rwcount+1
end
end
fwspeed=fwspeed/fwcount
rwspeed=rwspeed/rwcount
local cwspeed=(fwspeed+rwspeed)/2
--Update Wheels
for i,v in pairs(car.Wheels:GetChildren()) do
--Reference Wheel Orientation
local Ref=(CFrame.new(v.Position-((v.Arm.CFrame*cfWRot).lookVector),v.Position)*cfYRot).lookVector
local aRef=1
local diffMult=1
if v.Name=="FL" or v.Name=="RL" then aRef=-1 end
--AWD Torque Scaling
if _Tune.Config == "AWD" then _OutTorque = _OutTorque*rtTwo end
--Differential/Torque-Vectoring
if v.Name=="FL" or v.Name=="FR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-fwspeed)/fwspeed)/(math.max(_Tune.FDiffSlipThres,1)/100))*((_Tune.FDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((fwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
elseif v.Name=="RL" or v.Name=="RR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-rwspeed)/rwspeed)/(math.max(_Tune.RDiffSlipThres,1)/100))*((_Tune.RDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((rwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
end
_TCSActive = false
_ABSActive = false
--Output
if _PBrake and ((_Tune.Config ~= "FWD" and (((v.Name=="FL" or v.Name=="FR") and car.DriveSeat.Velocity.Magnitude<20) or ((v.Name=="RR" or v.Name=="RL") and car.DriveSeat.Velocity.Magnitude>=20))) or (_Tune.Config == "FWD" and (v.Name=="RR" or v.Name=="RL"))) then
--PBrake
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*PBrakeForce
v["#AV"].angularvelocity=Vector3.new()
else
--Apply Power
if ((_TMode == "Manual" or _TMode == "Semi") and _GBrake==0) or (_TMode == "Auto" and ((_CGear>-1 and _GBrake==0 ) or (_CGear==-1 and _GThrot-(_Tune.IdleThrottle/100)==0 )))then
local driven = false
for _,a in pairs(Drive) do if a==v then driven = true end end
if driven then
local on=1
if not script.Parent.IsOn.Value then on=0 end
local throt = _GThrot
if _TMode == "Auto" and _CGear==-1 then throt = _GBrake end
--Apply TCS
local tqTCS = 1
if _TCS then
tqTCS = 1-(math.min(math.max(0,math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.TCSThreshold)/_Tune.TCSGradient,1)*(1-(_Tune.TCSLimit/100)))
end
if tqTCS < 1 then
_TCSActive = true
end
--Update Forces
local dir = 1
if _CGear==-1 then dir = -1 end
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*_OutTorque*(1+(v.RotVelocity.Magnitude/60)^1.15)*throt*tqTCS*diffMult*on
v["#AV"].angularvelocity=Ref*aRef*_spLimit*dir
else
v["#AV"].maxTorque=Vector3.new()
v["#AV"].angularvelocity=Vector3.new()
end
--Brakes
else
local brake = _GBrake
if _TMode == "Auto" and _CGear==-1 then brake = _GThrot end
--Apply ABS
local tqABS = 1
if _ABS and math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.ABSThreshold>0 then
tqABS = 0
end
if tqABS < 1 then
_ABSActive = true
end
--Update Forces
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*FBrakeForce*brake*tqABS
else
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*RBrakeForce*brake*tqABS
end
v["#AV"].angularvelocity=Vector3.new()
end
end
end
end
|
-- Remade by Truenus(1) |
wait(0.05)
local car = script.Parent.Parent.Car.Value
local GBrake = script.Parent.Parent.Values.Brake
local lighton=BrickColor.new("Institutional white")
local lightoff=BrickColor.new("Dark stone grey")
function LightOn()
for i,v in pairs(car.Body.Lights:GetChildren()) do
if v.Name=="Light" then
v.BrickColor=lighton
v.Material=Enum.Material.Neon
v.Light.Enabled = true
for i,v in pairs(car.Body.Lights:GetChildren()) do
if v.Name=="R" then
v.Material=Enum.Material.Neon
v.Light.Enabled = true
v.Transparency =.02
end
end
end
end
end
function LightOff()
for i,v in pairs(car.Body.Lights:GetChildren()) do
if v.Name=="Light" then
v.BrickColor=lightoff
v.Material=Enum.Material.SmoothPlastic
v.Light.Enabled = false
for i,v in pairs(car.Body.Lights:GetChildren()) do
if v.Name=="R" then
v.BrickColor=BrickColor.new("Maroon")
v.Material=Enum.Material.SmoothPlastic
v.Light.Enabled = false
v.Transparency =0
end
end
end
end
end
function Auto()
if (game.Lighting:GetMinutesAfterMidnight()<390 or game.Lighting:GetMinutesAfterMidnight()>1050) then
LightOn()
else
LightOff()
end
end
script.Parent.MouseButton1Click:connect(function()
if script.Parent.Text=="Lights: Auto" then
LightOn()
script.Parent.Text = "Lights: On"
elseif script.Parent.Text == "Lights: On" then
LightOff()
script.Parent.Text = "Lights: Off"
elseif script.Parent.Text == "Lights: Off" then
Auto()
script.Parent.Text = "Lights: Auto"
end
end)
script.Parent.Parent.Values.Brake.Changed:connect(function()
for i,v in pairs(car.Body.Lights:GetChildren()) do
if v.Name=="R" then
if v.Light.Enabled==true then
if GBrake.Value>0 then
v.Transparency=0
v.Light.Brightness=12
v.Light.Range=15
v.BrickColor=BrickColor.new("Really red")
else
v.BrickColor=BrickColor.new("Maroon")
v.Material=Enum.Material.Sand
v.Transparency=.02
v.Light.Brightness=8
v.Light.Range=10
end
else
v.Transparency=0
if GBrake.Value>0 then
v.Material=Enum.Material.Neon
v.BrickColor=BrickColor.new("Really red")
else
v.BrickColor=BrickColor.new("Maroon")
v.Material=Enum.Material.Sand
end
end
elseif v.Name=="RR" then
if GBrake.Value>0 then
v.Material=Enum.Material.Neon
if v.Light.Enabled then
v.Transparency=1
else
v.Transparency=0
end
else
v.Transparency=1
if v.Light.Enabled then
v.Material=Enum.Material.Neon
else
v.Material=Enum.Material.Sand
end
end
end
end
end)
game.Lighting.Changed:connect(Auto)
Auto()
|
--[[Front]] | --
Tune.FSusDamping = 10 -- Dampening
Tune.FSusStiffness = 250 -- Stiffness
Tune.FSusLength = 1.67 -- Suspension length (in studs)
Tune.FPreComp = .82 -- Vehicle height, relative to your suspension settings
Tune.FExtLimit = 0 -- Max Extension Travel (in studs)
Tune.FCompLimit = 0 -- Max Compression Travel (in studs)
Tune.FBaseOffset = { -- Suspension (steering point) base
--[[Lateral]] 0 , -- positive = outward
--[[Vertical]] 0 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
Tune.FAxleOffset = { -- Suspension (axle point) base
--[[Lateral]] 0 , -- positive = outward
--[[Vertical]] 0 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
Tune.FBricksVisible = false -- Makes the front suspension bricks visible (Debug)
Tune.FConstsVisible = false -- Makes the front suspension constraints visible (Debug)
|
-- Get sound id |
get_material = function()
local soundTable = footstepsModule:GetTableFromMaterial(humanoid.FloorMaterial)
local randomSound = footstepsModule:GetRandomSound(soundTable)
if check_repetition(randomSound) == false then
return randomSound
else
randomSound = get_material()
return randomSound
end
end
|
-- Note that VehicleController does not derive from BaseCharacterController, it is a special case |
local VehicleController = {}
VehicleController.__index = VehicleController
function VehicleController.new(CONTROL_ACTION_PRIORITY)
local self = setmetatable({}, VehicleController)
self.CONTROL_ACTION_PRIORITY = CONTROL_ACTION_PRIORITY
self.enabled = false
self.vehicleSeat = nil
self.throttle = 0
self.steer = 0
self.acceleration = 0
self.decceleration = 0
self.turningRight = 0
self.turningLeft = 0
self.vehicleMoveVector = ZERO_VECTOR3
self.autoPilot = {}
self.autoPilot.MaxSpeed = 0
self.autoPilot.MaxSteeringAngle = 0
return self
end
function VehicleController:BindContextActions()
if useTriggersForThrottle then
ContextActionService:BindActionAtPriority("throttleAccel", (function(actionName, inputState, inputObject)
self:OnThrottleAccel(actionName, inputState, inputObject)
return Enum.ContextActionResult.Pass
end), false, self.CONTROL_ACTION_PRIORITY, Enum.KeyCode.ButtonR2)
ContextActionService:BindActionAtPriority("throttleDeccel", (function(actionName, inputState, inputObject)
self:OnThrottleDeccel(actionName, inputState, inputObject)
return Enum.ContextActionResult.Pass
end), false, self.CONTROL_ACTION_PRIORITY, Enum.KeyCode.ButtonL2)
end
ContextActionService:BindActionAtPriority("arrowSteerRight", (function(actionName, inputState, inputObject)
self:OnSteerRight(actionName, inputState, inputObject)
return Enum.ContextActionResult.Pass
end), false, self.CONTROL_ACTION_PRIORITY, Enum.KeyCode.Right)
ContextActionService:BindActionAtPriority("arrowSteerLeft", (function(actionName, inputState, inputObject)
self:OnSteerLeft(actionName, inputState, inputObject)
return Enum.ContextActionResult.Pass
end), false, self.CONTROL_ACTION_PRIORITY, Enum.KeyCode.Left)
end
function VehicleController:Enable(enable, vehicleSeat)
if enable == self.enabled and vehicleSeat == self.vehicleSeat then
return
end
self.enabled = enable
self.vehicleMoveVector = ZERO_VECTOR3
if enable then
if vehicleSeat then
self.vehicleSeat = vehicleSeat
self:SetupAutoPilot()
self:BindContextActions()
end
else
if useTriggersForThrottle then
ContextActionService:UnbindAction("throttleAccel")
ContextActionService:UnbindAction("throttleDeccel")
end
ContextActionService:UnbindAction("arrowSteerRight")
ContextActionService:UnbindAction("arrowSteerLeft")
self.vehicleSeat = nil
end
end
function VehicleController:OnThrottleAccel(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.End or inputState == Enum.UserInputState.Cancel then
self.acceleration = 0
else
self.acceleration = -1
end
self.throttle = self.acceleration + self.decceleration
end
function VehicleController:OnThrottleDeccel(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.End or inputState == Enum.UserInputState.Cancel then
self.decceleration = 0
else
self.decceleration = 1
end
self.throttle = self.acceleration + self.decceleration
end
function VehicleController:OnSteerRight(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.End or inputState == Enum.UserInputState.Cancel then
self.turningRight = 0
else
self.turningRight = 1
end
self.steer = self.turningRight + self.turningLeft
end
function VehicleController:OnSteerLeft(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.End or inputState == Enum.UserInputState.Cancel then
self.turningLeft = 0
else
self.turningLeft = -1
end
self.steer = self.turningRight + self.turningLeft
end
|
-- Load Roblox Occlusion Modules |
local Invisicam = require(script:WaitForChild("Invisicam"))
local Poppercam = require(script:WaitForChild("Poppercam"))
|
--// Renders |
local L_164_
L_106_:connect(function()
if L_15_ then
L_159_, L_160_ = L_159_ or 0, L_160_ or 0
if L_162_ == nil or L_161_ == nil then
L_162_ = L_45_.C0
L_161_ = L_45_.C1
end
local L_274_ = (math.sin(L_153_ * L_155_ / 2) * L_154_)
local L_275_ = (math.sin(L_153_ * L_155_) * L_154_)
local L_276_ = CFrame.new(L_274_, L_275_, 0.02)
local L_277_ = (math.sin(L_153_ * L_155_ / 2) * L_154_)
local L_278_ = (math.sin(L_153_ * L_155_) * L_154_)
local L_279_ = CFrame.new(L_274_, L_275_, 0.02) * CFrame.Angles((math.cos(L_153_ * L_155_) * L_154_), (math.cos(L_153_ * L_155_ / 2) * L_154_), 0)
local L_280_ = (math.sin(L_149_ * L_152_ / 2) * L_151_)
local L_281_ = (math.cos(L_149_ * L_152_) * L_151_)
local L_282_ = CFrame.new(L_280_, L_281_, 0.02)
if L_146_ then
L_153_ = L_153_ + .017
if L_24_.WalkAnimEnabled == true then
if L_24_.TacticalModeEnabled then
L_147_ = L_279_
else
L_147_ = L_276_
end
else
L_147_ = CFrame.new()
end
else
L_153_ = 0
L_147_ = CFrame.new()
end
L_145_.t = Vector3.new(L_140_, L_141_, 0)
local L_283_ = L_145_.p
local L_284_ = L_283_.X / L_142_ * (L_64_ and L_144_ or L_143_)
local L_285_ = L_283_.Y / L_142_ * (L_64_ and L_144_ or L_143_)
L_5_.CFrame = L_5_.CFrame:lerp(L_5_.CFrame * L_148_, 0.2)
if L_64_ then
L_136_ = CFrame.Angles(math.rad(-L_284_), math.rad(L_284_), math.rad(L_285_)) * CFrame.fromAxisAngle(Vector3.new(5, 0, -1), math.rad(L_284_))
L_149_ = 0
L_150_ = CFrame.new()
elseif not L_64_ then
L_136_ = CFrame.Angles(math.rad(-L_285_), math.rad(-L_284_), math.rad(-L_284_)) * CFrame.fromAxisAngle(L_44_.Position, math.rad(-L_285_))
L_149_ = L_149_ + 0.017
L_150_ = L_282_
end
if L_24_.SwayEnabled == true then
L_45_.C0 = L_45_.C0:lerp(L_162_ * L_136_ * L_147_ * L_150_, 0.1)
else
L_45_.C0 = L_45_.C0:lerp(L_162_ * L_147_, 0.1)
end
if L_67_ and not L_70_ and L_72_ and not L_64_ and not L_66_ and not Shooting then
L_45_.C1 = L_45_.C1:lerp(L_45_.C0 * L_24_.SprintPos, 0.1)
elseif not L_67_ and not L_70_ and not L_72_ and not L_64_ and not L_66_ and not Shooting and not L_79_ then
L_45_.C1 = L_45_.C1:lerp(CFrame.new() * L_134_, 0.05)
end
if L_64_ and not L_67_ then
if not L_65_ then
L_90_ = L_24_.AimCamRecoil
L_89_ = L_24_.AimGunRecoil
L_91_ = L_24_.AimKickback
elseif L_65_ then
if L_93_ == 1 then
L_90_ = L_24_.AimCamRecoil / 1.5
L_89_ = L_24_.AimGunRecoil / 1.5
L_91_ = L_24_.AimKickback / 1.5
end
if L_93_ == 2 then
L_90_ = L_24_.AimCamRecoil / 2
L_89_ = L_24_.AimGunRecoil / 2
L_91_ = L_24_.AimKickback / 2
end
end
if (L_3_.Head.Position - L_5_.CoordinateFrame.p).magnitude < 2 then
L_45_.C1 = L_45_.C1:lerp(L_45_.C0 * L_56_.CFrame:toObjectSpace(L_44_.CFrame), L_24_.AimSpeed)
L_42_:WaitForChild('Sense'):WaitForChild('Sensitivity').Visible = true
L_42_:WaitForChild('Sense'):WaitForChild('Sensitivity').Text = L_51_
L_107_.MouseDeltaSensitivity = L_51_
end
elseif not L_64_ and not L_67_ and L_15_ and not L_79_ then
if (L_3_.Head.Position - L_5_.CoordinateFrame.p).magnitude < 2 then
L_45_.C1 = L_45_.C1:lerp(CFrame.new() * L_134_, L_24_.UnaimSpeed)
L_42_:WaitForChild('Sense'):WaitForChild('Sensitivity').Visible = false
L_42_:WaitForChild('Sense'):WaitForChild('Sensitivity').Text = L_51_
L_107_.MouseDeltaSensitivity = L_52_
end
if not L_65_ then
L_90_ = L_24_.camrecoil
L_89_ = L_24_.gunrecoil
L_91_ = L_24_.Kickback
elseif L_65_ then
if L_93_ == 1 then
L_90_ = L_24_.camrecoil / 1.5
L_89_ = L_24_.gunrecoil / 1.5
L_91_ = L_24_.Kickback / 1.5
end
if L_93_ == 2 then
L_90_ = L_24_.camrecoil / 2
L_89_ = L_24_.gunrecoil / 2
L_91_ = L_24_.Kickback / 2
end
end
end
if Recoiling then
if not L_64_ then
L_148_ = CFrame.fromEulerAnglesXYZ(math.rad(L_90_ * math.random(0, L_24_.CamShake)), math.rad(L_90_ * math.random(-L_24_.CamShake, L_24_.CamShake)), math.rad(L_90_ * math.random(-L_24_.CamShake, L_24_.CamShake)))--CFrame.Angles(camrecoil,0,0)
else
L_148_ = CFrame.fromEulerAnglesXYZ(math.rad(L_90_ * math.random(0, L_24_.AimCamShake)), math.rad(L_90_ * math.random(-L_24_.AimCamShake, L_24_.AimCamShake)), math.rad(L_90_ * math.random(-L_24_.AimCamShake, L_24_.AimCamShake)))
end
--cam.CoordinateFrame = cam.CoordinateFrame * CFrame.fromEulerAnglesXYZ(math.rad(camrecoil*math.random(0,3)), math.rad(camrecoil*math.random(-1,1)), math.rad(camrecoil*math.random(-1,1)))
L_45_.C0 = L_45_.C0:lerp(L_45_.C0 * CFrame.new(0, 0, L_89_) * CFrame.Angles(-math.rad(L_91_), 0, 0), 0.3)
elseif not Recoiling then
L_148_ = CFrame.Angles(0, 0, 0)
L_45_.C0 = L_45_.C0:lerp(CFrame.new(), 0.2)
end
if L_65_ then
L_3_:WaitForChild('Humanoid').Jump = false
end
if L_15_ then
L_5_.FieldOfView = L_5_.FieldOfView * (1 - L_24_.ZoomSpeed) + (L_97_ * L_24_.ZoomSpeed)
if (L_3_.Head.Position - L_5_.CoordinateFrame.p).magnitude >= 2 then
L_90_ = L_24_.AimCamRecoil
L_89_ = L_24_.AimGunRecoil
L_91_ = L_24_.AimKickback
L_42_:WaitForChild('Sense'):WaitForChild('Sensitivity').Visible = true
L_42_:WaitForChild('Sense'):WaitForChild('Sensitivity').Text = L_51_
L_107_.MouseDeltaSensitivity = L_51_
elseif (L_3_.Head.Position - L_5_.CoordinateFrame.p).magnitude < 2 and not L_64_ and not L_65_ then
L_90_ = L_24_.camrecoil
L_89_ = L_24_.gunrecoil
L_91_ = L_24_.Kickback
L_42_:WaitForChild('Sense'):WaitForChild('Sensitivity').Visible = false
L_42_:WaitForChild('Sense'):WaitForChild('Sensitivity').Text = L_51_
L_107_.MouseDeltaSensitivity = L_52_
end
end
if L_15_ and L_24_.CameraGo then --and (char.Head.Position - cam.CoordinateFrame.p).magnitude < 2 then
L_4_.TargetFilter = game.Workspace
local L_286_ = L_3_:WaitForChild("HumanoidRootPart").CFrame * CFrame.new(0, 1.5, 0) * CFrame.new(L_3_:WaitForChild("Humanoid").CameraOffset)
L_48_.C0 = L_8_.CFrame:toObjectSpace(L_286_)
L_48_.C1 = CFrame.Angles(-math.asin((L_4_.Hit.p - L_4_.Origin.p).unit.y), 0, 0)
L_107_.MouseIconEnabled = false
end
if L_15_ and (L_3_.Head.Position - L_5_.CoordinateFrame.p).magnitude >= 2 then
if L_4_.Icon ~= "http://www.roblox.com/asset?id=" .. L_24_.TPSMouseIcon then
L_4_.Icon = "http://www.roblox.com/asset?id=" .. L_24_.TPSMouseIcon
end
L_107_.MouseIconEnabled = true
if L_3_:FindFirstChild('Right Arm') and L_3_:FindFirstChild('Left Arm') then
L_3_['Right Arm'].LocalTransparencyModifier = 1
L_3_['Left Arm'].LocalTransparencyModifier = 1
end
end;
end
end)
|
--[[
ROBLOX TODO: add default generic param when possible
original code:
export type Expect<State extends MatcherState = MatcherState> = {
]] |
export type Expect<State> = {
-- ROBLOX deviation: no way to express __call metamethod typing
-- <T = unknown>(actual: T) -> Matchers<void, T>;
-- TODO: this is added by test runners, not `expect` itself
addSnapshotSerializer: (any) -> (),
assertions: (number) -> (),
-- TODO: remove this `T extends` - should get from some interface merging
extend: <T>(MatchersObject<T>) -> (),
extractExpectedAssertionsErrors: () -> ExpectedAssertionsErrors,
getState: () -> State,
hasAssertions: () -> (),
setState: (Partial<MatcherState>) -> (),
} & AsymmetricMatchers & {
never: AsymmetricMatchersOmitAnyAndAnything,
} |
-- If you do not know how to use this or the GUI, check out my YouTube video tutorial on this.
-- Replace the 0's with your ID's
-- Delete what you dont use, besides the first part of the function |
game.StarterGui.ResetPlayerGuiOnSpawn = false
old_fog = game.Lighting.FogStart
local MarketplaceService = game:GetService("MarketplaceService")
function getPlayerFromId(id)
for i,v in pairs(game.Players:GetChildren()) do
if v.userId == id then
return v
end
end
return nil
end
MarketplaceService.ProcessReceipt = function(receiptInfo)
local productId = receiptInfo.ProductId
local playerId = receiptInfo.PlayerId
local player = getPlayerFromId(playerId)
local productName
-- Down below is an example of a Cash boost
-------------------------------------------------------------------
if productId == 0 then
local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if cashmoney then
cashmoney.Value = cashmoney.Value + 5000
end
-------------------------------------------------------------------
-- Down below is an example of a Health boost
-------------------------------------------------------------------
elseif productId == 0 then
local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name)
local char = player.Character
char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 15
wait()
char.Humanoid.Health = char.Humanoid.MaxHealth
-------------------------------------------------------------------
-- Down below is an example of a WalkSpeed boost
-------------------------------------------------------------------
elseif productId == 0 then
local char = player.Character
if char then
local human = char:FindFirstChild("Humanoid")
if human then
human.WalkSpeed = human.WalkSpeed + 15
end
end
-------------------------------------------------------------------
-- Down below is an example of a gear giver
-------------------------------------------------------------------
elseif productId == 0 then
game.ServerStorage.Sword:Clone().Parent=player.Backpack
elseif productId == 0 then
game.ServerStorage.Sword2:Clone().Parent=player.Backpack -- Example if you want to make another gear giver, delete the 2 lines if you dont need it
-------------------------------------------------------------------
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
|
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- |
input.InputChanged:connect(function(inputObject)
if inputObject.UserInputType == Enum.UserInputType.MouseMovement then
local delta = Vector2.new(inputObject.Delta.x/Sensitivity,inputObject.Delta.y/Sensitivity) * Smoothness
local X = TargetAngleX - delta.y
TargetAngleX = (X >= 80 and 80) or (X <= -80 and -80) or X
TargetAngleY = (TargetAngleY - delta.x) %360
end
end)
input.InputBegan:connect(function(inputObject)
if inputObject.UserInputType == Enum.UserInputType.Keyboard then
if inputObject.KeyCode == CanToggleMouse.activationkey then
if CanToggleMouse.allowed and freemouse == false then
freemouse = true
else
freemouse = false
end
end
end
end)
|
--[[Weight and CG]] |
Tune.Weight = 3000 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 8 ,
--[[Height]] 7.8 ,
--[[Length]] 23 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = more stable/carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
-- Create the path object |
local path = PathfindingService:CreatePath()
|
--[=[
Deep copies a table including metatables
@param target table -- Table to deep copy
@param _context table? -- Cntext to deepCopy the value in
@return table -- Result
]=] |
function Table.deepCopy(target, _context)
_context = _context or {}
if _context[target] then
return _context[target]
end
if type(target) == "table" then
local new = {}
_context[target] = new
for index, value in pairs(target) do
new[Table.deepCopy(index, _context)] = Table.deepCopy(value, _context)
end
return setmetatable(new, Table.deepCopy(getmetatable(target), _context))
else
return target
end
end
|
-- Function to bind to touch moved if player is on mobile |
local function mobileFrame(touch, processed)
-- Check to see if the touch was on a UI element. If so, we don't want to update anything
if not processed then
-- Calculate touch position in world space. Uses Stravant's ScreenSpace Module script
-- to create a ray from the camera.
local test = screenSpace.ScreenToWorld(touch.Position.X, touch.Position.Y, 1)
local nearPos = game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(screenSpace.ScreenToWorld(touch.Position.X, touch.Position.Y, 1))
nearPos = game.Workspace.CurrentCamera.CoordinateFrame.p - nearPos
local farPos = screenSpace.ScreenToWorld(touch.Position.X, touch.Position.Y,50)
farPos = game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(farPos) * -1
if farPos.magnitude > 900 then
farPos = farPos.unit * 900
end
local ray = Ray.new(nearPos, farPos)
local part, pos = game.Workspace:FindPartOnRay(ray, player.Character)
-- if a position was found on the ray then update the character's rotation
if pos then
frame(pos)
end
end
end
local function OnActivated()
local myModel = player.Character
if Tool.Enabled and myModel and myModel:FindFirstChild('Humanoid') and myModel.Humanoid.Health > 0 then
Tool.Enabled = false
game.ReplicatedStorage.ROBLOX_RocketFireEvent:FireServer(mouse.Hit.p)
wait(2)
Tool.Enabled = true
end
end
local oldIcon = nil |
-- Get translators |
local playerTranslator, fallbackTranslator
local foundPlayerTranslator = pcall(function()
playerTranslator = LocalizationService:GetTranslatorForPlayerAsync(player)
end)
local foundFallbackTranslator = pcall(function()
fallbackTranslator = LocalizationService:GetTranslatorForLocaleAsync(sourceLanguageCode)
end)
|
------------------------------------------------------------------------
-- Translates binary operator tokens if found, otherwise returns
-- OPR_NOBINOPR. Code generation uses OPR_* style tokens.
-- * used in subexpr()
------------------------------------------------------------------------ |
luaY.getbinopr_table = {
["+"] = "OPR_ADD",
["-"] = "OPR_SUB",
["*"] = "OPR_MUL",
["/"] = "OPR_DIV",
["%"] = "OPR_MOD",
["^"] = "OPR_POW",
["TK_CONCAT"] = "OPR_CONCAT",
["TK_NE"] = "OPR_NE",
["TK_EQ"] = "OPR_EQ",
["<"] = "OPR_LT",
["TK_LE"] = "OPR_LE",
[">"] = "OPR_GT",
["TK_GE"] = "OPR_GE",
["TK_AND"] = "OPR_AND",
["TK_OR"] = "OPR_OR",
}
function luaY:getbinopr(op)
local opr = self.getbinopr_table[op]
if opr then return opr else return "OPR_NOBINOPR" end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.