prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- When a player with the game pass joins, give them the admin tools |
local function OnPlayerAdded(player)
if GamePassService:PlayerHasPass(player, GamePassIdObject.Value) then
local starterGear = WaitForChild(player, 'StarterGear')
CloneAdminTools(starterGear)
if player.Character then -- They've already loaded and won't get their StarterGear until next spawn
local backpack = WaitForChild(player, 'Backpack')
CloneAdminTools(backpack)
end
end
end
|
--hit:SetPrimaryPartCFrame(box.PrimaryPart.CFrame*CFrame.new(r(vary.X),1+math.random(0,vary.Y*100)/100,r(vary.Z))) |
hit:SetPrimaryPartCFrame(box.PrimaryPart.CFrame*CFrame.new(math.random(-100,100)/100,math.random(100,200)/100,math.random(-100,100)/100))
end -- end of if hit is a basepart or model
hit.Parent = contents
end
end)
|
--[=[
Observes all children
@param parent Instance
@param predicate ((value: Instance) -> boolean)? -- Optional filter
@return Observable<Brio<Instance>>
]=] |
function RxInstanceUtils.observeChildrenBrio(parent, predicate)
assert(typeof(parent) == "Instance", "Bad parent")
assert(type(predicate) == "function" or predicate == nil, "Bad predicate")
return Observable.new(function(sub)
local maid = Maid.new()
local function handleChild(child)
if not predicate or predicate(child) then
local value = Brio.new(child)
maid[child] = value
sub:Fire(value)
end
end
maid:GiveTask(parent.ChildAdded:Connect(handleChild))
maid:GiveTask(parent.ChildRemoved:Connect(function(child)
maid[child] = nil
end))
for _, child in pairs(parent:GetChildren()) do
handleChild(child)
end
return maid
end)
end
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 500 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 900 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 8500 -- Use sliders to manipulate values
Tune.Redline = 9000 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 6500
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)
|
--debris |
script.debris.ChildAdded:Connect(function(v)
game.TweenService:Create(v,TweenInfo.new(3),{Transparency = 1}):Play()
wait(debrislife)
v:Destroy()
end) |
--use this to determine if you want this human to be harmed or not, returns boolean |
local function boom()
wait(2)
Used = true
Object.Anchored = false
Object.Transparency = 1
Object.CanCollide = true
Object.Sparks.Enabled = false
Object.Orientation = Vector3.new(0,0,0)
Object.Fuse:Stop()
Object.Explode:Play()
Object.Dist:Play()
Object.Explosion:Emit(100)
Object.Smoke1:Emit(70)
Object.Smoke2:Emit(70)
Object.Sparks5:Emit(150)
Object.Sparks2:Emit(1950)
Object.Sparks3:Emit(1950)
Object.Sparks4:Emit(1950)
Explode()
end
boom()
|
----------------------------------------------------------------
--\\DOORS & BREACHING SYSTEM
---------------------------------------------------------------- |
local DoorsFolder = ACS_Workspace:FindFirstChild("Doors")
local DoorsFolderClone = DoorsFolder:Clone()
local BreachClone = ACS_Workspace.Breach:Clone()
BreachClone.Parent = ServerStorage
DoorsFolderClone.Parent = ServerStorage
function ToggleDoor(Door)
local Hinge = Door.Door:FindFirstChild("Hinge")
if not Hinge then return end
local HingeConstraint = Hinge.HingeConstraint
if HingeConstraint.TargetAngle == 0 then
HingeConstraint.TargetAngle = -90
elseif HingeConstraint.TargetAngle == -90 then
HingeConstraint.TargetAngle = 0
end
end
Evt.DoorEvent.OnServerEvent:Connect(function(Player,Door,Mode,Key)
if Door ~= nil then
if Mode == 1 then
if Door:FindFirstChild("Locked") ~= nil and Door.Locked.Value == true then
if Door:FindFirstChild("RequiresKey") then
local Character = Player.Character
if Character:FindFirstChild(Key) ~= nil or Player.Backpack:FindFirstChild(Key) ~= nil then
if Door.Locked.Value == true then
Door.Locked.Value = false
end
ToggleDoor(Door)
end
end
else
ToggleDoor(Door)
end
elseif Mode == 2 then
if Door:FindFirstChild("Locked") == nil or (Door:FindFirstChild("Locked") ~= nil and Door.Locked.Value == false) then
ToggleDoor(Door)
end
elseif Mode == 3 then
if Door:FindFirstChild("RequiresKey") then
local Character = Player.Character
Key = Door.RequiresKey.Value
if Character:FindFirstChild(Key) ~= nil or Player.Backpack:FindFirstChild(Key) ~= nil then
if Door:FindFirstChild("Locked") ~= nil and Door.Locked.Value == true then
Door.Locked.Value = false
else
Door.Locked.Value = true
end
end
end
elseif Mode == 4 then
if Door:FindFirstChild("Locked") ~= nil and Door.Locked.Value == true then
Door.Locked.Value = false
end
end
end
end)
Evt.MedSys.Collapse.OnServerEvent:Connect(function(Player)
if not Player or not Player.Character then return; end;
local Human = Player.Character:FindFirstChild("Humanoid")
local PClient = Player.Character:FindFirstChild("ACS_Client")
if not Human or not PClient then return; end;
local Dor = PClient.Variaveis.Dor
local Sangue = PClient.Variaveis.Sangue
if (Sangue.Value <= 3500) or (Dor.Value >= 200) or PClient:GetAttribute("Collapsed") then -- Man this Guy's Really wounded,
Human.PlatformStand = true
Human.AutoRotate = false
PClient:SetAttribute("Collapsed",true)
elseif (Sangue.Value > 3500) and (Dor.Value < 200) and not PClient:GetAttribute("Collapsed") then -- YAY A MEDIC ARRIVED! =D
Human.PlatformStand = false
Human.AutoRotate = true
PClient:SetAttribute("Collapsed",false)
end
end)
Evt.MedSys.MedHandler.OnServerEvent:Connect(function(Player, Victim, Mode)
if not Player or not Player.Character then return; end;
if not Player.Character:FindFirstChild("Humanoid") or Player.Character.Humanoid.Health <= 0 then return; end;
local P1_Client = Player.Character:FindFirstChild("ACS_Client")
if not P1_Client then warn(Player.Name.."'s Action Failed: Missing ACS_Client"); return; end;
if P1_Client:GetAttribute("Collapsed") then return; end;
if Victim then --Multiplayer functions
if not Victim.Character or not Victim.Character:FindFirstChild("HumanoidRootPart") or not Player.Character:FindFirstChild("HumanoidRootPart") then return; end;
if (Player.Character.HumanoidRootPart.Position - Victim.Character.HumanoidRootPart.Position).Magnitude > 15 then warn(Player.Name.." is too far to treat "..Victim.Name); return; end;
local P2_Client = Victim.Character:FindFirstChild("ACS_Client")
if not P2_Client then warn(Player.Name.."'s Action Failed: Missing "..Victim.Name.."'s ACS_Client"); return; end;
if Mode == 1 and P1_Client.Kit.Bandage.Value > 0 and P2_Client:GetAttribute("Bleeding") then
P1_Client.Kit.Bandage.Value = P1_Client.Kit.Bandage.Value - 1
P2_Client:SetAttribute("Bleeding",false)
return;
elseif Mode == 2 and P1_Client.Kit.Splint.Value > 0 and P2_Client:GetAttribute("Injured") then
P1_Client.Kit.Splint.Value = P1_Client.Kit.Splint.Value - 1
P2_Client:SetAttribute("Injured",false)
return;
elseif Mode == 3 and (P2_Client:GetAttribute("Bleeding") == true or P2_Client:GetAttribute("Tourniquet")) then --Tourniquet works a little different :T
if P2_Client:GetAttribute("Tourniquet")then
P1_Client.Kit.Tourniquet.Value = P1_Client.Kit.Tourniquet.Value + 1
P2_Client:SetAttribute("Tourniquet",false)
return;
end
if P1_Client.Kit.Tourniquet.Value <= 0 then return; end;
P1_Client.Kit.Tourniquet.Value = P1_Client.Kit.Tourniquet.Value - 1
P2_Client:SetAttribute("Tourniquet",true)
return;
elseif Mode == 4 and P1_Client.Kit.PainRelief.Value > 0 and P2_Client.Variaveis.Dor.Value > 0 then
P1_Client.Kit.PainRelief.Value = P1_Client.Kit.PainRelief.Value - 1
P2_Client.Variaveis.Dor.Value = math.clamp(P2_Client.Variaveis.Dor.Value - math.random(35,65),0,300)
Evt.MedSys.MedHandler:FireClient(Victim,4)
return;
elseif Mode == 5 and P1_Client.Kit.EnergyShot.Value > 0 and Victim.Character.Humanoid.Health < Victim.Character.Humanoid.MaxHealth then
P1_Client.Kit.EnergyShot.Value = P1_Client.Kit.EnergyShot.Value - 1
local HealValue = math.random(15,25)
if Victim.Character.Humanoid.Health + HealValue < Victim.Character.Humanoid.MaxHealth then
Victim.Character.Humanoid:TakeDamage(-HealValue)
else
Victim.Character.Humanoid.Health = Victim.Character.Humanoid.MaxHealth
end
Evt.MedSys.MedHandler:FireClient(Victim,5)
return;
elseif Mode == 6 and P1_Client.Kit.Suppressant.Value > 0 and P2_Client.Variaveis.Dor.Value > 0 then
P1_Client.Kit.Suppressant.Value = P1_Client.Kit.Suppressant.Value - 1
P2_Client.Variaveis.Dor.Value = 0
Evt.MedSys.MedHandler:FireClient(Victim,6)
return;
elseif Mode == 7 and P1_Client.Kit.EnergyShot.Value > 0 and P2_Client:GetAttribute("Collapsed")then
P1_Client.Kit.EnergyShot.Value = P1_Client.Kit.EnergyShot.Value - 1
local HealValue = math.random(45,55)
if Victim.Character.Humanoid.Health + HealValue < Victim.Character.Humanoid.MaxHealth then
Victim.Character.Humanoid:TakeDamage(-HealValue)
else
Victim.Character.Humanoid.Health = Victim.Character.Humanoid.MaxHealth
end
P2_Client:SetAttribute("Collapsed",false)
Evt.MedSys.MedHandler:FireClient(Victim,7)
return;
elseif Mode == 8 and P1_Client.Kit.BloodBag.Value > 0 and P2_Client.Variaveis.Sangue.Value < P2_Client.Variaveis.Sangue.MaxValue then
P1_Client.Kit.BloodBag.Value = P1_Client.Kit.BloodBag.Value - 1
P2_Client.Variaveis.Sangue.Value = P2_Client.Variaveis.Sangue.Value + 2000
return;
else
warn(Player.Name.."'s Action Failed: Unknow Method")
end
return;
end
--Self treat
if Mode == 1 and P1_Client.Kit.Bandage.Value > 0 and P1_Client:GetAttribute("Bleeding") then
P1_Client.Kit.Bandage.Value = P1_Client.Kit.Bandage.Value - 1
P1_Client:SetAttribute("Bleeding",false)
return;
elseif Mode == 2 and P1_Client.Kit.Splint.Value > 0 and P1_Client:GetAttribute("Injured") then
P1_Client.Kit.Splint.Value = P1_Client.Kit.Splint.Value - 1
P1_Client:SetAttribute("Injured",false)
return;
elseif Mode == 3 and (P1_Client:GetAttribute("Bleeding") or P1_Client:GetAttribute("Tourniquet")) then --Tourniquet works a little diferent :T
if P1_Client:GetAttribute("Tourniquet") then
P1_Client.Kit.Tourniquet.Value = P1_Client.Kit.Tourniquet.Value + 1
P1_Client:SetAttribute("Tourniquet",false)
return;
end
if P1_Client.Kit.Tourniquet.Value <= 0 then return; end;
P1_Client.Kit.Tourniquet.Value = P1_Client.Kit.Tourniquet.Value - 1
P1_Client:SetAttribute("Tourniquet",true)
return;
elseif Mode == 4 and P1_Client.Kit.PainRelief.Value > 0 and P1_Client.Variaveis.Dor.Value > 0 then
P1_Client.Kit.PainRelief.Value = P1_Client.Kit.PainRelief.Value - 1
P1_Client.Variaveis.Dor.Value = math.clamp(P1_Client.Variaveis.Dor.Value - math.random(35,65),0,300)
Evt.MedSys.MedHandler:FireClient(Player,4)
return;
elseif Mode == 5 and P1_Client.Kit.EnergyShot.Value > 0 and Player.Character.Humanoid.Health < Player.Character.Humanoid.MaxHealth then
P1_Client.Kit.EnergyShot.Value = P1_Client.Kit.EnergyShot.Value - 1
local HealValue = math.random(15,25)
if Player.Character.Humanoid.Health + HealValue < Player.Character.Humanoid.MaxHealth then
Player.Character.Humanoid:TakeDamage(-HealValue)
else
Player.Character.Humanoid.Health = Player.Character.Humanoid.MaxHealth
end
Evt.MedSys.MedHandler:FireClient(Player,5)
return;
elseif Mode == 6 and P1_Client.Kit.Suppressant.Value > 0 and P1_Client.Variaveis.Dor.Value > 0 then
P1_Client.Kit.Suppressant.Value = P1_Client.Kit.Suppressant.Value - 1
P1_Client.Variaveis.Dor.Value = math.clamp(P1_Client.Variaveis.Dor.Value - math.random(125,175),0,300)
Evt.MedSys.MedHandler:FireClient(Player,6)
return;
elseif Mode == 7 and P1_Client.Kit.EnergyShot.Value > 0 and Player.Character.Humanoid.Health < Player.Character.Humanoid.MaxHealth then
P1_Client.Kit.EnergyShot.Value = P1_Client.Kit.EnergyShot.Value - 1
local HealValue = math.random(45,55)
if Player.Character.Humanoid.Health + HealValue < Player.Character.Humanoid.MaxHealth then
Player.Character.Humanoid:TakeDamage(-HealValue)
else
Player.Character.Humanoid.Health = Player.Character.Humanoid.MaxHealth
end
Evt.MedSys.MedHandler:FireClient(Player,7)
return;
elseif Mode == 8 and P1_Client.Kit.BloodBag.Value > 0 and P1_Client.Variaveis.Sangue.Value < P1_Client.Variaveis.Sangue.MaxValue then
P1_Client.Kit.BloodBag.Value = P1_Client.Kit.BloodBag.Value - 1
P1_Client.Variaveis.Sangue.Value = P1_Client.Variaveis.Sangue.Value + 2000
return;
else
warn(Player.Name.."'s Action Failed: Unknow Method")
end
return;
end)
Evt.Drag.OnServerEvent:Connect(function(player,Victim)
if not player or not player.Character then return; end;
local P1_Client = player.Character:FindFirstChild("ACS_Client")
local Human = player.Character:FindFirstChild("Humanoid")
if not P1_Client then return; end;
if Victim then
P1_Client:SetAttribute("DragPlayer",Victim.Name)
else
P1_Client:SetAttribute("DragPlayer","")
P1_Client:SetAttribute("Dragging",false)
end
local target = P1_Client:GetAttribute("DragPlayer")
if P1_Client:GetAttribute("Collapsed") or target == "" then return; end;
local player2 = game.Players:FindFirstChild(target)
if not player2 or not player2.Character then return; end;
local PlHuman = player2.Character:FindFirstChild("Humanoid")
local P2_Client = player2.Character:FindFirstChild("ACS_Client")
if not PlHuman or not P2_Client then return; end;
if P1_Client:GetAttribute("Dragging") then return; end;
if not P2_Client:GetAttribute("Collapsed") then return; end;
P1_Client:SetAttribute("Dragging",true)
while P1_Client:GetAttribute("Dragging") and target ~= "" and P2_Client:GetAttribute("Collapsed") and PlHuman.Health > 0 and Human.Health > 0 and not P1_Client:GetAttribute("Collapsed") do wait()
player2.Character.Torso.Anchored = true
player2.Character.Torso.CFrame = Human.Parent.Torso.CFrame*CFrame.new(0,0.75,1.5)*CFrame.Angles(math.rad(0), math.rad(0), math.rad(90))
end
player2.Character.Torso.Anchored = false
end)
function BreachFunction(Player,Mode,BreachPlace,Pos,Norm,Hit)
if Mode == 1 then
if Player.Character.ACS_Client.Kit.BreachCharges.Value > 0 then
Player.Character.ACS_Client.Kit.BreachCharges.Value = Player.Character.ACS_Client.Kit.BreachCharges.Value - 1
BreachPlace.Destroyed.Value = true
local C4 = Engine.FX.BreachCharge:Clone()
C4.Parent = BreachPlace.Destroyable
C4.Center.CFrame = CFrame.new(Pos, Pos + Norm) * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(0))
C4.Center.Place:play()
local weld = Instance.new("WeldConstraint")
weld.Parent = C4
weld.Part0 = BreachPlace.Destroyable.Charge
weld.Part1 = C4.Center
wait(1)
C4.Center.Beep:play()
wait(4)
if C4 and C4:FindFirstChild("Center") then
local att = Instance.new("Attachment")
att.CFrame = C4.Center.CFrame
att.Parent = workspace.Terrain
local aw = Engine.FX.ExpEffect:Clone()
aw.Parent = att
aw.Enabled = false
aw:Emit(35)
Debris:AddItem(aw,aw.Lifetime.Max)
local Exp = Instance.new("Explosion")
Exp.BlastPressure = 0
Exp.BlastRadius = 0
Exp.DestroyJointRadiusPercent = 0
Exp.Position = C4.Center.Position
Exp.Parent = workspace
local S = Instance.new("Sound")
S.EmitterSize = 10
S.MaxDistance = 1000
S.SoundId = "rbxassetid://"..Explosion[math.random(1, 7)]
S.PlaybackSpeed = math.random(30,55)/40
S.Volume = 2
S.Parent = att
S.PlayOnRemove = true
S:Destroy()
for SKP_001, SKP_002 in pairs(game.Players:GetChildren()) do
if SKP_002:IsA('Player') and SKP_002.Character and SKP_002.Character:FindFirstChild('Head') and (SKP_002.Character.Head.Position - C4.Center.Position).magnitude <= 15 then
local DistanceMultiplier = (((SKP_002.Character.Head.Position - C4.Center.Position).magnitude/35) - 1) * -1
local intensidade = DistanceMultiplier
local Tempo = 15 * DistanceMultiplier
Evt.Suppression:FireClient(SKP_002,2,intensidade,Tempo)
end
end
Debris:AddItem(BreachPlace.Destroyable,0)
end
end
elseif Mode == 2 then
local aw = Engine.FX.DoorBreachFX:Clone()
aw.Parent = BreachPlace.Door.Door
aw.RollOffMaxDistance = 100
aw.RollOffMinDistance = 5
aw:Play()
BreachPlace.Destroyed.Value = true
if BreachPlace.Door:FindFirstChild("Hinge") ~= nil then
BreachPlace.Door.Hinge:Destroy()
end
if BreachPlace.Door:FindFirstChild("Knob") ~= nil then
BreachPlace.Door.Knob:Destroy()
end
local forca = Instance.new("BodyForce")
forca.Force = -Norm * BreachPlace.Door.Door:GetMass() * Vector3.new(50,0,50)
forca.Parent = BreachPlace.Door.Door
Debris:AddItem(BreachPlace,3)
elseif Mode == 3 then
if Player.Character.ACS_Client.Kit.Fortifications.Value > 0 then
Player.Character.ACS_Client.Kit.Fortifications.Value = Player.Character.ACS_Client.Kit.Fortifications.Value - 1
BreachPlace.Fortified.Value = true
local C4 = Instance.new('Part')
C4.Parent = BreachPlace.Destroyable
C4.Size = Vector3.new(Hit.Size.X + .05,Hit.Size.Y + .05,Hit.Size.Z + 0.5)
C4.Material = Enum.Material.DiamondPlate
C4.Anchored = true
C4.CFrame = Hit.CFrame
local S = Engine.FX.FortFX:Clone()
S.PlaybackSpeed = math.random(30,55)/40
S.Volume = 1
S.Parent = C4
S.PlayOnRemove = true
S:Destroy()
end
end
end
Evt.Breach.OnServerInvoke = BreachFunction
function UpdateLog(Player,humanoid)
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
local hours = os.date("*t")["hour"]
local mins = os.date("*t")["min"]
local sec = os.date("*t")["sec"]
local TagType = tag:findFirstChild("type")
if tag.Value.Name == Player.Name then
local String = Player.Name.." Died | "..hours..":"..mins..":"..sec
table.insert(CombatLog,String)
else
local String = tag.Value.Name.." Killed "..Player.Name.." | "..hours..":"..mins..":"..sec
table.insert(CombatLog,String)
end
if #CombatLog > 50 then
Backup = Backup + 1
warn("ACS: Cleaning Combat Log | Backup: "..Backup)
warn(CombatLog)
CombatLog = {}
end
end
end
|
--[[
Implementation
]] |
local function isAlive()
return maid.humanoid.Health > 0 and maid.humanoid:GetState() ~= Enum.HumanoidStateType.Dead
end
local function destroy()
maid:destroy()
end
local function patrol()
while isAlive() do
if not attacking then
local position = getRandomPointInCircle(startPosition, PATROL_RADIUS)
maid.humanoid.WalkSpeed = PATROL_WALKSPEED
maid.humanoid:MoveTo(position)
end
wait(random:NextInteger(MIN_REPOSITION_TIME, MAX_REPOSITION_TIME))
end
end
local function isInstaceAttackable(targetInstance)
local isAttackable = false
local targetHumanoid = targetInstance and targetInstance.Parent and targetInstance.Parent:FindFirstChild("Humanoid")
if not targetHumanoid then
return false
end
-- Determine if they are attackable, depening on the attack mode
local isEnemy = false
if ATTACK_MODE == 1 then
-- Attack characters with the SoldierEnemy tag
if
CollectionService:HasTag(targetInstance.Parent, "SoldierEnemy") and
not CollectionService:HasTag(targetInstance.Parent, "SoldierFriend") then
isEnemy = true
end
elseif ATTACK_MODE == 2 then
-- Attack all humanoids without the SoldierFriend tag
if not CollectionService:HasTag(targetInstance.Parent, "SoldierFriend") then
isEnemy = true
end
elseif ATTACK_MODE == 3 then
-- Attack all humanoids
isEnemy = true
end
if isEnemy then
local distance = (maid.humanoidRootPart.Position - targetInstance.Position).Magnitude
if distance <= ATTACK_RADIUS then
local ray = Ray.new(
maid.humanoidRootPart.Position,
(targetInstance.Parent.HumanoidRootPart.Position - maid.humanoidRootPart.Position).Unit * distance
)
local part = Workspace:FindPartOnRayWithIgnoreList(ray, {
targetInstance.Parent, maid.instance,
}, false, true)
if
targetInstance ~= maid.instance and
targetInstance:IsDescendantOf(Workspace) and
targetHumanoid.Health > 0 and
targetHumanoid:GetState() ~= Enum.HumanoidStateType.Dead and
not part
then
isAttackable = true
end
end
end
return isAttackable
end
local function fireGun()
-- Do damage to the target
local targetHunanoid = target.Parent:FindFirstChild("Humanoid")
targetHunanoid:TakeDamage(ATTACK_DAMAGE)
-- Play the firing animation
maid.attackAnimation:Play()
-- Play the firing sound effect
maid.gunFireSound:Play()
-- Muzzle flash
local firingPositionAttachment = maid.instance.Weapon.Handle.FiringPositionAttachment
firingPositionAttachment.FireEffect:Emit(10)
firingPositionAttachment.PointLight.Enabled = true
wait(0.1)
firingPositionAttachment.PointLight.Enabled = false
end
local function findTargets()
-- Do a new search region if we are not already searching through an existing search region
if not searchingForTargets and tick() - timeSearchEnded >= SEARCH_DELAY then
searchingForTargets = true
-- Create a new region
local centerPosition = maid.humanoidRootPart.Position
local topCornerPosition = centerPosition + Vector3.new(ATTACK_RADIUS, ATTACK_RADIUS, ATTACK_RADIUS)
local bottomCornerPosition = centerPosition + Vector3.new(-ATTACK_RADIUS, -ATTACK_RADIUS, -ATTACK_RADIUS)
searchRegion = Region3.new(bottomCornerPosition, topCornerPosition)
searchParts = Workspace:FindPartsInRegion3(searchRegion, maid.instance, math.huge)
newTarget = nil
newTargetDistance = nil
-- Reset to defaults
searchIndex = 1
end
if searchingForTargets then
-- Search through our list of parts and find attackable humanoids
local checkedParts = 0
while searchingForTargets and searchIndex <= #searchParts and checkedParts < MAX_PARTS_PER_HEARTBEAT do
local currentPart = searchParts[searchIndex]
if currentPart and isInstaceAttackable(currentPart) then
local character = currentPart.Parent
local distance = (character.HumanoidRootPart.Position - maid.humanoidRootPart.Position).magnitude
-- Determine if the charater is the closest
if not newTargetDistance or distance < newTargetDistance then
newTarget = character.HumanoidRootPart
newTargetDistance = distance
end
end
searchIndex = searchIndex + 1
checkedParts = checkedParts + 1
end
if searchIndex >= #searchParts then
target = newTarget
searchingForTargets = false
timeSearchEnded = tick()
end
end
end
local function attack()
attacking = true
local originalWalkSpeed = maid.humanoid.WalkSpeed
maid.humanoid.WalkSpeed = 0
maid.attackIdleAnimation:Play()
local shotsFired = 0
while attacking and isInstaceAttackable(target) and isAlive() do
fireGun()
shotsFired = (shotsFired + 1) % CLIP_CAPACITY
if shotsFired == CLIP_CAPACITY - 1 then
wait(RELOAD_DELAY)
else
wait(ATTACK_DELAY)
end
end
maid.humanoid.WalkSpeed = originalWalkSpeed
maid.attackIdleAnimation:Stop()
attacking = false
end
|
--Connect functions to seat exit |
function module.OnSeatExitEvent(func)
table.insert(module.OnExitFunctions, func)
end
function module.DisconnectFromSeatExitEvent(func)
local newExitFunctions = {}
for _, v in ipairs(module.OnExitFunctions) do
if v ~= func then
table.insert(newExitFunctions, v)
end
end
module.OnExitFunctions = newExitFunctions
end
|
--[=[
Trims the string of the given pattern
@param str string
@param pattern string? -- Defaults to whitespace
@return string
]=] |
function String.trim(str: string, pattern: string?): string
if not pattern then
return str:match("^%s*(.-)%s*$")
else
-- When we find the first non space character defined by ^%s
-- we yank out anything in between that and the end of the string
-- Everything else is replaced with %1 which is essentially nothing
return str:match("^"..pattern.."*(.-)"..pattern.."*$")
end
end
|
--[[Sword Part Class]] | --
local SwordPart =
{
Damage = 50,
AttackTime = 0.5,
CoolDown = 0,
LastSwing = 0,
LastHit = 0,
Part= nil,
Owner = nil,--player object that owns this sword
OnHit = nil,
OnHitHumanoid = nil,
OnAttackReady = nil,
OnAttack = nil,
SwingSound = nil,
HitSound = nil,
SwingAnimation = nil, --animation track!
ActiveConnections = {},
}
do
UTIL.MakeClass(SwordPart)
function SwordPart.New(npart,nowner)
local init= UTIL.DeepCopy(SwordPart)
init.Part= npart
init.Owner = nowner
table.insert(init.ActiveConnections,init.Part.Touched:connect(function(hit) init:SwordTouch(hit) end))
init.OnHit = InternalEvent.New()
init.OnHitHumanoid = InternalEvent.New()
init.OnAttackReady = InternalEvent.New()
init.OnAttack = InternalEvent.New()
return init
end
function SwordPart:SwordTouch(hit)
if tick()-self.LastSwing >self.AttackTime or tick()-self.LastHit<self.AttackTime then return end
self.OnHit:Fire(hit)
local character,humanoid = UTIL.FindCharacterAncestor(hit)
if character and character ~= self.Owner.Character then
--humanoid:TakeDamage(self.Damage)
remoteEvent:FireServer(humanoid, self.Damage);
self.OnHitHumanoid:Fire(humanoid,hit)
self.LastHit = tick()
if self.HitSound then
self.HitSound:Play()
end
end
end
function SwordPart:DoSwing()
if tick()-self.LastSwing<self.AttackTime+self.CoolDown then
return
end
if self.SwingAnimation then
self.SwingAnimation:Play()
end
if self.SwingSound then
self.SwingSound:Play()
end
self.LastSwing = tick()
self.OnAttack:Fire()
end
function SwordPart:Destroy()
for _,i in pairs(self.ActiveConnections) do
i:disconnect()
end
end
end
do
local Handle = script.Parent
local Tool = Handle.Parent
local Player = game.Players.LocalPlayer
local Character = UTIL.WaitForValidCharacter(Player)
local SwingAni = UTIL.Instantiate"Animation"
{AnimationId = "http://www.roblox.com/Asset?ID=89289879"}
local HitSound = Handle:WaitForChild('Hit')
local SwingSound = Handle:WaitForChild('Swing')
local SwingAniTrack
local Sword
Tool.Equipped:connect(function(mouse)
Sword = SwordPart.New(Handle,Player)
Sword.Damage = 40
Sword.HitSound = HitSound
Sword.SwingSound = SwingSound
Character = UTIL.WaitForValidCharacter(Player)
local Humanoid = Character:FindFirstChild('Humanoid')
SwingAniTrack = Humanoid:LoadAnimation(SwingAni)
Sword.SwingAnimation = SwingAniTrack
mouse.Button1Down:connect(function()
Sword:DoSwing()
end)
end)
Tool.Unequipped:connect(function()
Sword:Destroy()
end)
end
|
--[[**
<returns>
Whether or not the data store is a backup data store and thus won't save during :Save() or call :AfterSave().
</returns>
**--]] |
function DataStore:IsBackup()
return self.backup ~= nil --some people haven't learned if x then yet, and will do if x == false then.
end
|
--[[ The Module ]] | --
local BaseCharacterController = require(script.Parent:WaitForChild("BaseCharacterController"))
local DynamicThumbstick = setmetatable({}, BaseCharacterController)
DynamicThumbstick.__index = DynamicThumbstick
function DynamicThumbstick.new()
local self = setmetatable(BaseCharacterController.new(), DynamicThumbstick)
self.moveTouchObject = nil
self.moveTouchLockedIn = false
self.moveTouchFirstChanged = false
self.moveTouchStartPosition = nil
self.startImage = nil
self.endImage = nil
self.middleImages = {}
self.startImageFadeTween = nil
self.endImageFadeTween = nil
self.middleImageFadeTweens = {}
self.isFirstTouch = true
self.thumbstickFrame = nil
self.onRenderSteppedConn = nil
self.fadeInAndOutBalance = FADE_IN_OUT_BALANCE_DEFAULT
self.fadeInAndOutHalfDuration = FADE_IN_OUT_HALF_DURATION_DEFAULT
self.hasFadedBackgroundInPortrait = false
self.hasFadedBackgroundInLandscape = false
self.tweenInAlphaStart = nil
self.tweenOutAlphaStart = nil
return self
end
|
--s.Pitch = 0.7
--s.Pitch = 0.7 |
while true do
while s.Pitch<1 do
s.Pitch=s.Pitch+0.010
s:Play()
if s.Pitch>1 then
s.Pitch=1
end
wait(0.001)
end
|
-- Roblox User Input Control Modules - each returns a new() constructor function used to create controllers as needed |
local Keyboard = require(script:WaitForChild("Keyboard"))
local Gamepad = require(script:WaitForChild("Gamepad"))
local DynamicThumbstick = require(script:WaitForChild("DynamicThumbstick"))
local FFlagUserHideControlsWhenMenuOpen do
local success, result = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserHideControlsWhenMenuOpen")
end)
FFlagUserHideControlsWhenMenuOpen = success and result
end
local FFlagUserDynamicThumbstickSafeAreaUpdate do
local success, result = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserDynamicThumbstickSafeAreaUpdate")
end)
FFlagUserDynamicThumbstickSafeAreaUpdate = success and result
end
local TouchThumbstick = require(script:WaitForChild("TouchThumbstick"))
|
-- at max range |
script.Parent.Explosion.PlayOnRemove = false
swoosh:stop()
shaft:remove()
|
--[=[
@param value any
Set the top-level value of the property, but does not override
any per-player data (e.g. set with `SetFor` or `SetFilter`).
Any player without custom-set data will receive this new data.
This is useful if certain players have specific values that
should not be changed, but all other players should receive
the same new value.
```lua
-- Using just 'Set' overrides per-player data:
remoteProperty:SetFor(somePlayer, "CustomData")
remoteProperty:Set("Data")
print(remoteProperty:GetFor(somePlayer)) --> "Data"
-- Using 'SetTop' does not override:
remoteProperty:SetFor(somePlayer, "CustomData")
remoteProperty:SetTop("Data")
print(remoteProperty:GetFor(somePlayer)) --> "CustomData"
```
]=] |
function RemoteProperty:SetTop(value: any)
self._value = value
for _,player in ipairs(Players:GetPlayers()) do
if self._perPlayer[player] == nil then
self._rs:Fire(player, value)
end
end
end
|
--[[
Adds to the velocity of the internal springs, on top of the existing
velocity of this Spring. This doesn't affect position.
If the type doesn't match the current type of the spring, an error will be
thrown.
]] |
function class:addVelocity(deltaValue)
local deltaType = typeof(deltaValue)
if deltaType ~= self._currentType then
parseError("springTypeMismatch", nil, deltaType, self._currentType)
end
local springDeltas = unpackType(deltaValue, deltaType)
for index, delta in ipairs(springDeltas) do
self._springVelocities[index] += delta
end
SpringScheduler.add(self)
end
|
-- Connect change events |
for _, i in pairs(script.Parent.Parent:GetChildren()) do
if i:FindFirstChild("Close") then
i:GetPropertyChangedSignal("Visible"):connect(update)
end
end
|
--[ LOCALS ]-- |
local AFKStatus = {}
local AFKEvent = game.ReplicatedStorage:FindFirstChild("AFK")
|
-- Debris |
local debris = ReplicatedStorage.Debris
local debrisParts = debris:GetChildren()
local destroyedModels = {}
|
--Tell if a seat is flipped |
local function isFlipped(Seat)
local UpVector = Seat.CFrame.upVector
local Angle = math.deg(math.acos(UpVector:Dot(Vector3.new(0, 1, 0))))
return Angle >= MIN_FLIP_ANGLE
end
|
--Similar to assert but warns instead of errors. |
local function assertwarn(requirement: boolean, messageIfNotMet: string)
if requirement == false then
warn(messageIfNotMet)
end
end
|
--//Set Body Position
--Body_Position.Position = head.CFrame.p | |
--[[ The Module ]] | --
local BaseCamera = require(script.Parent:WaitForChild("BaseCamera"))
local ClassicCamera = setmetatable({}, BaseCamera)
ClassicCamera.__index = ClassicCamera
function ClassicCamera.new()
local self = setmetatable(BaseCamera.new(), ClassicCamera)
self.isFollowCamera = false
self.isCameraToggle = false
self.lastUpdate = tick()
self.cameraToggleSpring = Util.Spring.new(5, 0)
return self
end
function ClassicCamera:GetCameraToggleOffset(dt: number)
if self.isCameraToggle then
local zoom = self.currentSubjectDistance
if CameraInput.getTogglePan() then
self.cameraToggleSpring.goal = math.clamp(Util.map(zoom, 0.5, self.FIRST_PERSON_DISTANCE_THRESHOLD, 0, 1), 0, 1)
else
self.cameraToggleSpring.goal = 0
end
local distanceOffset: number = math.clamp(Util.map(zoom, 0.5, 64, 0, 1), 0, 1) + 1
return Vector3.new(0, self.cameraToggleSpring:step(dt)*distanceOffset, 0)
end
return Vector3.new()
end
|
-- DefaultValue for spare ammo |
local SpareAmmo = 600 |
------------------------------------------------------------------------------- |
function tagHumanoid(humanoid)
local plr=game.Players:playerFromCharacter(sp.Parent)
if plr~=nil then
local tag=Instance.new("ObjectValue")
tag.Value=plr
tag.Name="creator"
tag.Parent=humanoid
delay(2,function()
if tag~=nil then
tag.Parent=nil
end
end)
end
end
function reload(mouse)
reloading=true
mouse.Icon=ReloadCursor
while sp.Ammo.Value<ClipSize and reloading and enabled do
wait(ReloadTime/ClipSize)
if reloading then
sp.Ammo.Value=sp.Ammo.Value+1
check()
else
break
end
end
check()
mouse.Icon=Cursors[1]
reloading=false
end
function onKeyDown(key,mouse)
key=key:lower()
if key=="r" and not reloading then
reload(mouse)
end
end
function movecframe(p,pos)
p.Parent=game.Lighting
p.Position=pos
p.Parent=game.Workspace
end
function fire(aim)
sp.Handle.Fire:Play()
t=r.Stepped:wait()
last6=last5
last5=last4
last4=last3
last3=last2
last2=last
last=t
local bullet=Bullet:clone()
local totalDist=0
Lengthdist=-RayLength/.5
local startpoint=sp.Handle.CFrame*BarrlePos
local dir=(aim)-startpoint
dir=computeDirection(dir)
local cfrm=CFrame.new(startpoint, dir+startpoint)
local hit,pos,normal,time=raycast(game.Workspace, startpoint, cfrm*Vector3.new(0,0,Lengthdist)-startpoint, function(brick)
if brick.Name=="Glass" then
return true
elseif brick.Name=="Bullet" or brick.Name=="BulletTexture" then
return false
elseif brick:IsDescendantOf(sp.Parent) then
return false
elseif brick.Name=="Handle" then
if brick.Parent:IsDescendantOf(sp.Parent) then
return false
else
return true
end
end
return true
end)
bullet.Parent=game.Workspace
if hit~=nil then
local humanoid=hit.Parent:FindFirstChild("Humanoid")
if humanoid~=nil then
local damage=math.random(BaseDamage-(BaseDamage*.25),BaseDamage+(BaseDamage*.25))
if hit.Name=="Head" then
damage=damage*1.3
elseif hit.Name=="Torso" then
else
damage=damage*.75
end
if humanoid.Health>0 then
local eplr=game.Players:playerFromCharacter(humanoid.Parent)
local plr=game.Players:playerFromCharacter(sp.Parent)
if eplr~=nil and plr~=nil then
-- if eplr.TeamColor~=plr.TeamColor or eplr.Neutral or plr.Neutral then
tagHumanoid(humanoid)
humanoid:TakeDamage(damage)
-- end
else
tagHumanoid(humanoid)
humanoid:TakeDamage(damage)
end
end
end
if (hit.Name == "Part10") or (hit.Name == "Part11") or (hit.Name == "Part21") or (hit.Name == "Part23") or (hit.Name == "Part24") or (hit.Name == "Part8") then
rand = math.random(1,5)
if rand == 3 then
workspace.GlassSound:play()
hit:breakJoints()
end
end
if (hit.Parent:findFirstChild("Hit")) then
hit.Parent.Health.Value = hit.Parent.Health.Value - BaseDamage/3
end
distance=(startpoint-pos).magnitude
bullet.CFrame=cfrm*CFrame.new(0,0,-distance/2)
bullet.Mesh.Scale=Vector3.new(.15,.15,distance)
else
bullet.CFrame=cfrm*CFrame.new(0,0,-RayLength/2)
bullet.Mesh.Scale=Vector3.new(.15,.15,RayLength)
end
if pos~=nil then
end
local deb=game:FindFirstChild("Debris")
if deb==nil then
local debris=Instance.new("Debris")
debris.Parent=game
end
check()
game.Debris:AddItem(bullet,.05)
end
function onButton1Up(mouse)
down=false
end
function onButton1Down(mouse)
h=sp.Parent:FindFirstChild("Humanoid")
if not enabled or reloading or down or h==nil then
return
end
if sp.Ammo.Value>0 and h.Health>0 then
--[[if sp.Ammo.Value<=0 then
if not reloading then
reload(mouse)
end
return
end]]
down=true
enabled=false
while down do
if sp.Ammo.Value<=0 then
break
end
if burst then
local startpoint=sp.Handle.CFrame*BarrlePos
local mag=(mouse.Hit.p-startpoint).magnitude
local rndm=Vector3.new(math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag))
fire(mouse.Hit.p+rndm)
sp.Ammo.Value=sp.Ammo.Value-1
if sp.Ammo.Value<=0 then
break
end
wait(.05)
local startpoint=sp.Handle.CFrame*BarrlePos
local mag2=((mouse.Hit.p+rndm)-startpoint).magnitude
local rndm2=Vector3.new(math.random(-(.1/10)*mag2,(.1/10)*mag2),math.random(-(.1/10)*mag2,(.1/10)*mag2),math.random(-(.1/10)*mag2,(.1/10)*mag2))
fire(mouse.Hit.p+rndm+rndm2)
sp.Ammo.Value=sp.Ammo.Value-1
if sp.Ammo.Value<=0 then
break
end
wait(.05)
fire(mouse.Hit.p+rndm+rndm2+rndm2)
sp.Ammo.Value=sp.Ammo.Value-1
elseif shot then
sp.Ammo.Value=sp.Ammo.Value-1
local startpoint=sp.Handle.CFrame*BarrlePos
local mag=(mouse.Hit.p-startpoint).magnitude
local rndm=Vector3.new(math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag))
fire(mouse.Hit.p+rndm)
local mag2=((mouse.Hit.p+rndm)-startpoint).magnitude
local rndm2=Vector3.new(math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2))
fire(mouse.Hit.p+rndm+rndm2)
local rndm3=Vector3.new(math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2))
fire(mouse.Hit.p+rndm+rndm3)
local rndm4=Vector3.new(math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2))
fire(mouse.Hit.p+rndm+rndm4)
else
sp.Ammo.Value=sp.Ammo.Value-1
local startpoint=sp.Handle.CFrame*BarrlePos
local mag=(mouse.Hit.p-startpoint).magnitude
local rndm=Vector3.new(math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag))
fire(mouse.Hit.p+rndm)
end
wait(Firerate)
if not automatic then
break
end
end
enabled=true
else
sp.Handle.Trigger:Play()
end
end
function onEquippedLocal(mouse)
if mouse==nil then
print("Mouse not found")
return
end
mouse.Icon=Cursors[1]
mouse.KeyDown:connect(function(key) onKeyDown(key,mouse) end)
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
mouse.Button1Up:connect(function() onButton1Up(mouse) end)
check()
equiped=true
if #Cursors>1 then
while equiped do
t=r.Stepped:wait()
local action=sp.Parent:FindFirstChild("Pose")
if action~=nil then
if sp.Parent.Pose.Value=="Standing" then
Spread=MinSpread
else
Spread=MinSpread+((4/10)*(MaxSpread-MinSpread))
end
else
Spread=MinSpread
end
if t-last<SpreadRate then
Spread=Spread+.1*(MaxSpread-MinSpread)
end
if t-last2<SpreadRate then
Spread=Spread+.1*(MaxSpread-MinSpread)
end
if t-last3<SpreadRate then
Spread=Spread+.1*(MaxSpread-MinSpread)
end
if t-last4<SpreadRate then
Spread=Spread+.1*(MaxSpread-MinSpread)
end
if t-last5<SpreadRate then
Spread=Spread+.1*(MaxSpread-MinSpread)
end
if t-last6<SpreadRate then
Spread=Spread+.1*(MaxSpread-MinSpread)
end
if not reloading then
local percent=(Spread-MinSpread)/(MaxSpread-MinSpread)
for i=0,#Cursors-1 do
if percent>(i/(#Cursors-1))-((1/(#Cursors-1))/2) and percent<(i/(#Cursors-1))+((1/(#Cursors-1))/2) then
mouse.Icon=Cursors[i+1]
end
end
end
wait(Firerate*.9)
end
end
end
function onUnequippedLocal(mouse)
equiped=false
reloading=false
end
sp.Equipped:connect(onEquippedLocal)
sp.Unequipped:connect(onUnequippedLocal)
check()
|
--[[
game:GetService("RunService").Stepped:Connect(function()
camera.CFrame = CFrame.new(player.Character.HumanoidRootPart.Position) * CFrame.new(0, 0, 30)
end)
--]] |
local function onUpdate()
if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
camera.CFrame = CFrame.new(player.Character.HumanoidRootPart.Position) * CFrame.new(0, 0, 30)
end
end
RunService:BindToRenderStep("Control", Enum.RenderPriority.Input.Value, onUpdate)
|
--[=[
@return deltaScreenPosition: Vector2
:::info Only When Mouse Locked
Getting the mouse delta is only intended for when the mouse is locked. If the
mouse is _not_ locked, this will return a zero Vector2. The mouse can be locked
using the `mouse:Lock()` and `mouse:LockCenter()` method.
]=] |
function Mouse:GetDelta()
return UserInputService:GetMouseDelta()
end
|
-- elseif inputType.Value >= Enum.UserInputType.Gamepad1.Value and inputType.Value <= Enum.UserInputType.Gamepad8.Value then | |
--[[**
Takes a table where keys are child names and values are functions to check the children against.
Pass an instance tree into the function.
If at least one child passes each check, the overall check passes.
Warning! If you pass in a tree with more than one child of the same name, this function will always return false
@param checkTable The table to check against
@returns A function that checks an instance tree
**--]] |
function t.children(checkTable)
assert(checkChildren(checkTable))
return function(value)
local instanceSuccess, instanceErrMsg = t.Instance(value)
if not instanceSuccess then
return false, instanceErrMsg or ""
end
local childrenByName = {}
for _, child in ipairs(value:GetChildren()) do
local name = child.Name
if checkTable[name] then
if childrenByName[name] then
return false, string.format("Cannot process multiple children with the same name %q", name)
end
childrenByName[name] = child
end
end
for name, check in pairs(checkTable) do
local success, errMsg = check(childrenByName[name])
if not success then
return false, string.format("[%s.%s] %s", value:GetFullName(), name, errMsg or "")
end
end
return true
end
end
end
return t
|
-- ANIMATOR |
export type RawAnimationIndex = {
id: string,
weight: number
}
export type AnimationIndex = {
animation: Animation,
animationTrack: AnimationTrack,
weight: number
}
export type AnimationList = Array<AnimationIndex>
export type AnimationTable = Map<string, AnimationList>
export type AnimatorInstanceType = AnimatorType & {
StateFunctions: {},
Humanoid: Humanoid,
Character: CharacterType,
CoreAnimations: AnimationTable,
Tracks: Map<string, AnimationTrack>,
CoreAnimationTrack: AnimationTrack?,
CoreAnimation: Animation?,
Connections: {},
State: string,
Speed: number,
}
export type AnimatorType = {
Humanoid
}
export type AnimatorOptionsType = {
priority: Enum.AnimationPriority?,
speed: number?,
transition: number?,
weight: number,
}
|
--// # key, Yelp |
mouse.KeyDown:connect(function(key)
if key=="t" then
if veh.Lightbar.middle.Yelp.IsPlaying == true then
veh.Lightbar.middle.Wail:Stop()
veh.Lightbar.middle.Yelp:Stop()
veh.Lightbar.middle.Priority:Stop()
script.Parent.Parent.Sirens.Yelp.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
else
veh.Lightbar.middle.Wail:Stop()
veh.Lightbar.middle.Yelp:Play()
veh.Lightbar.middle.Priority:Stop()
script.Parent.Parent.Sirens.Yelp.BackgroundColor3 = Color3.fromRGB(215, 135, 110)
script.Parent.Parent.Sirens.Wail.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
script.Parent.Parent.Sirens.Priority.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
end
end
end)
|
--[[
Native:
tween = Tween.FromService(instance, tweenInfo, properties)
See Wiki page on Tween object for methods and such
Custom:
tween = Tween.new(tweenInfo, callbackFunction)
tween.TweenInfo
tween.Callback
tween.PlaybackState
tween:Play()
tween:Pause()
tween:Cancel()
tween.Completed(playbackState)
tween.PlaybackStateChanged(playbackState)
Custom Example:
tween = Tween.new(TweenInfo.new(2, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, true, 0), function(n)
print(n)
end)
tween:Play()
tween.Completed:Wait()
--]] |
local Tween = {}
Tween.__index = Tween
Tween.Easing = require(script:WaitForChild("Easing"))
function Tween.new(tweenInfo, callback)
do
-- Verify callback is function:
assert(typeof(callback) == "function", "Callback argument must be a function")
-- Verify tweenInfo:
local typeOfTweenInfo = typeof(tweenInfo)
assert(typeOfTweenInfo == "TweenInfo" or typeOfTweenInfo == "table", "TweenInfo must be of type TweenInfo or table")
-- Defaults:
if (typeOfTweenInfo == "table") then
if (tweenInfo.Time == nil) then tweenInfo.Time = 1 end
if (tweenInfo.EasingStyle == nil) then tweenInfo.EasingStyle = Enum.EasingStyle.Quad end
if (tweenInfo.EasingDirection == nil) then tweenInfo.EasingDirection = Enum.EasingDirection.Out end
if (tweenInfo.RepeatCount == nil) then tweenInfo.RepeatCount = 0 end
if (tweenInfo.Reverses == nil) then tweenInfo.Reverses = false end
if (tweenInfo.DelayTime == nil) then tweenInfo.DelayTime = 0 end
end
end
local completed = Instance.new("BindableEvent")
local playbackStateChanged = Instance.new("BindableEvent")
local self = setmetatable({
TweenInfo = tweenInfo;
Callback = callback;
PlaybackState = Enum.PlaybackState.Begin;
Completed = completed.Event;
PlaybackStateChanged = playbackStateChanged.Event;
_id = "tween_" .. game:GetService("HttpService"):GenerateGUID(false);
_playing = false;
_paused = false;
_completed = completed;
_playbackStateChanged = playbackStateChanged;
_elapsedTime = 0;
_repeated = 0;
_reversing = false;
_elapsedDelayTime = 0;
}, Tween)
return self
end
function Tween:ResetState()
self._playing = false
self._paused = false
self._elapsedTime = 0
self._repeated = 0
self._reversing = false
self._elapsedDelayTime = 0
end
function Tween:SetPlaybackState(state)
local lastState = self.PlaybackState
self.PlaybackState = state
if (state ~= lastState) then
self._playbackStateChanged:Fire(state)
end
end
function Tween:Play()
if (self._playing and not self._paused) then return end
self._playing = true
self._paused = false
-- Resolve easing function:
local easingFunc
if (typeof(self.TweenInfo) == "TweenInfo") then
easingFunc = Tween.Easing[self.TweenInfo.EasingDirection.Name][self.TweenInfo.EasingStyle.Name]
else
local dir, style
dir = typeof(self.TweenInfo.EasingDirection) == "EnumItem" and self.TweenInfo.EasingDirection.Name or self.TweenInfo.EasingDirection
style = typeof(self.TweenInfo.EasingStyle) == "EnumItem" and self.TweenInfo.EasingStyle.Name or self.TweenInfo.EasingStyle
easingFunc = Tween.Easing[dir][style]
if (not self.TweenInfo.RepeatCount) then
self.TweenInfo.RepeatCount = 0
end
end
local tick = tick
local elapsed = self._elapsedTime
local duration = self.TweenInfo.Time
local last = tick()
local callback = self.Callback
local reverses = self.TweenInfo.Reverses
local elapsedDelay = self._elapsedDelayTime
local durationDelay = self.TweenInfo.DelayTime
local reversing = self._reversing
local function OnCompleted()
callback(easingFunc(duration, 0, 1, duration))
game:GetService("RunService"):UnbindFromRenderStep(self._id)
self.PlaybackState = Enum.PlaybackState.Completed
self._completed:Fire(self.PlaybackState)
self:ResetState()
end
local function IsDelayed(dt)
if (elapsedDelay >= durationDelay) then return false end
elapsedDelay = (elapsedDelay + dt)
self._elapsedDelayTime = elapsedDelay
if (elapsedDelay < durationDelay) then
self:SetPlaybackState(Enum.PlaybackState.Delayed)
else
self:SetPlaybackState(Enum.PlaybackState.Playing)
end
return (elapsedDelay < durationDelay)
end
-- Tween:
game:GetService("RunService"):BindToRenderStep(self._id, Enum.RenderPriority.Camera.Value - 1, function()
local now = tick()
local dt = (now - last)
last = now
if (IsDelayed(dt)) then return end
elapsed = (elapsed + dt)
self._elapsedTime = elapsed
local notDone = (elapsed < duration)
if (notDone) then
if (reversing) then
callback(easingFunc(elapsed, 1, -1, duration))
else
callback(easingFunc(elapsed, 0, 1, duration))
end
else
if ((self._repeated < self.TweenInfo.RepeatCount) or reversing) then
if (reverses) then
reversing = (not reversing)
self._reversing = reversing
end
if ((not reverses) or (reversing)) then
self._repeated = (self._repeated + 1)
end
if (not reversing) then
self._elapsedDelayTime = 0
elapsedDelay = 0
end
self._elapsedTime = 0
elapsed = 0
else
OnCompleted()
end
end
end)
end
function Tween:Pause()
if ((not self._playing) or (self._paused)) then return end
self._paused = true
self:SetPlaybackState(Enum.PlaybackState.Paused)
game:GetService("RunService"):UnbindFromRenderStep(self._id)
end
function Tween:Cancel()
if (not self._playing) then return end
game:GetService("RunService"):UnbindFromRenderStep(self._id)
self:ResetState()
self:SetPlaybackState(Enum.PlaybackState.Cancelled)
self._completed:Fire(self.PlaybackState)
end
function Tween.fromService(...)
return game:GetService("TweenService"):Create(...)
end
Tween.FromService = Tween.fromService
Tween.New = Tween.new
return Tween
|
------------------------------------------------------------------------
-- creates and sets a nil object
-- * used only in luaK:exp2RK()
------------------------------------------------------------------------ |
function luaK:nilK(fs)
local k, v = {}, {} -- TValue
self:setnilvalue(v)
-- cannot use nil as key; instead use table itself to represent nil
self:sethvalue(k, fs.h)
return self:addk(fs, k, v)
end
|
-------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------- |
function onRunning(speed)
if speed>0.01 then
playAnimation("walk", 0.1, Humanoid)
pose = "Running"
else
playAnimation("idle", 0.1, Humanoid)
pose = "Standing"
end
end
function onDied()
pose = "Dead"
end
function onJumping()
playAnimation("jump", 0.1, Humanoid)
jumpAnimTime = jumpAnimDuration
pose = "Jumping"
end
function onClimbing(speed)
playAnimation("climb", 0.1, Humanoid)
setAnimationSpeed(speed / 12.0)
pose = "Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
if (jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
end
pose = "FreeFall"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
pose = "Seated"
end
function onPlatformStanding()
pose = "PlatformStanding"
end
function onSwimming(speed)
if speed>0 then
pose = "Running"
else
pose = "Standing"
end
end
function getTool()
for _, kid in ipairs(Figure:GetChildren()) do
if kid.className == "Tool" then return kid end
end
return nil
end
function getToolAnim(tool)
for _, c in ipairs(tool:GetChildren()) do
if c.Name == "toolanim" and c.className == "StringValue" then
return c
end
end
return nil
end
function animateTool()
if (toolAnim == "None") then
playToolAnimation("toolnone", toolTransitionTime, Humanoid)
return
end
if (toolAnim == "Slash") then
playToolAnimation("toolslash", 0, Humanoid)
return
end
if (toolAnim == "Lunge") then
playToolAnimation("toollunge", 0, Humanoid)
return
end
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder:SetDesiredAngle(3.14 /2)
LeftShoulder:SetDesiredAngle(-3.14 /2)
RightHip:SetDesiredAngle(3.14 /2)
LeftHip:SetDesiredAngle(-3.14 /2)
end
local lastTick = 0
function move(time)
local amplitude = 1
local frequency = 1
local deltaTime = time - lastTick
lastTick = time
local climbFudge = 0
local setAngles = false
if (jumpAnimTime > 0) then
jumpAnimTime = jumpAnimTime - deltaTime
end
if (pose == "FreeFall" and jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
elseif (pose == "Seated") then
playAnimation("sit", 0.5, Humanoid)
return
elseif (pose == "Running") then
playAnimation("walk", 0.1, Humanoid)
elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then |
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 10 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 800 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 3000 -- Use sliders to manipulate values
Tune.Redline = 6000 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 6000
Tune.PeakSharpness = 2
Tune.CurveMult = .2
--Incline Compensation
Tune.InclineComp = 1.5 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 450 -- RPM acceleration when clutch is off
Tune.RevDecay = 150 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 0 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response, lower = more stable RPM)
|
--[[Weight and CG]] |
Tune.Weight = 1240 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 3.5 ,
--[[Length]] 14 }
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
|
--[[Wheel Alignment]] |
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
Tune.FCamber = 2
Tune.RCamber = 2.5
Tune.FCaster = 0
Tune.FToe = 0
Tune.RToe = 0
|
------------------------- |
function DoorClose()
if Shaft00.MetalDoor.CanCollide == false then
Shaft00.MetalDoor.CanCollide = true
while Shaft00.MetalDoor.Transparency > 0.0 do
Shaft00.MetalDoor.Transparency = Shaft00.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0) --Change 10 to change the speed.
end
if Shaft01.MetalDoor.CanCollide == false then
Shaft01.MetalDoor.CanCollide = true
while Shaft01.MetalDoor.Transparency > 0.0 do
Shaft01.MetalDoor.Transparency = Shaft01.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft02.MetalDoor.CanCollide == false then
Shaft02.MetalDoor.CanCollide = true
while Shaft02.MetalDoor.Transparency > 0.0 do
Shaft02.MetalDoor.Transparency = Shaft02.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft03.MetalDoor.CanCollide == false then
Shaft03.MetalDoor.CanCollide = true
while Shaft03.MetalDoor.Transparency > 0.0 do
Shaft03.MetalDoor.Transparency = Shaft03.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft04.MetalDoor.CanCollide == false then
Shaft04.MetalDoor.CanCollide = true
while Shaft04.MetalDoor.Transparency > 0.0 do
Shaft04.MetalDoor.Transparency = Shaft04.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft05.MetalDoor.CanCollide == false then
Shaft05.MetalDoor.CanCollide = true
while Shaft05.MetalDoor.Transparency > 0.0 do
Shaft05.MetalDoor.Transparency = Shaft05.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft06.MetalDoor.CanCollide == false then
Shaft06.MetalDoor.CanCollide = true
while Shaft06.MetalDoor.Transparency > 0.0 do
Shaft06.MetalDoor.Transparency = Shaft06.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft07.MetalDoor.CanCollide == false then
Shaft07.MetalDoor.CanCollide = true
while Shaft07.MetalDoor.Transparency > 0.0 do
Shaft07.MetalDoor.Transparency = Shaft07.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft08.MetalDoor.CanCollide == false then
Shaft08.MetalDoor.CanCollide = true
while Shaft08.MetalDoor.Transparency > 0.0 do
Shaft08.MetalDoor.Transparency = Shaft08.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft09.MetalDoor.CanCollide == false then
Shaft09.MetalDoor.CanCollide = true
while Shaft09.MetalDoor.Transparency > 0.0 do
Shaft09.MetalDoor.Transparency = Shaft09.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft10.MetalDoor.CanCollide == false then
Shaft10.MetalDoor.CanCollide = true
while Shaft10.MetalDoor.Transparency > 0.0 do
Shaft10.MetalDoor.Transparency = Shaft10.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft11.MetalDoor.CanCollide == false then
Shaft11.MetalDoor.CanCollide = true
while Shaft11.MetalDoor.Transparency > 0.0 do
Shaft11.MetalDoor.Transparency = Shaft11.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft12.MetalDoor.CanCollide == false then
Shaft12.MetalDoor.CanCollide = true
while Shaft12.MetalDoor.Transparency > 0.0 do
Shaft12.MetalDoor.Transparency = Shaft12.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft13.MetalDoor.CanCollide == false then
Shaft13.MetalDoor.CanCollide = true
while Shaft13.MetalDoor.Transparency > 0.0 do
Shaft13.MetalDoor.Transparency = Shaft13.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
end
function onClicked()
DoorClose()
end
script.Parent.MouseButton1Click:connect(onClicked)
script.Parent.MouseButton1Click:connect(function()
if clicker == true
then clicker = false
else
return
end
end)
script.Parent.MouseButton1Click:connect(function()
Car.Touched:connect(function(otherPart)
if otherPart == Elevator.Floors.F07
then StopE() DoorOpen()
end
end)end)
function StopE()
Car.BodyVelocity.velocity = Vector3.new(0, 0, 0)
Car.BodyPosition.position = Elevator.Floors.F07.Position
clicker = true
end
function DoorOpen()
while Shaft06.MetalDoor.Transparency < 1.0 do
Shaft06.MetalDoor.Transparency = Shaft06.MetalDoor.Transparency + .1
wait(0.000001)
end
Shaft06.MetalDoor.CanCollide = false
end
|
--sort by keys |
newTable.xsort = function(tbl, sort)
local keys = newTable.keys(tbl)
table.sort(keys, sort)
return function()
if #keys == 0 then
return nil
end
local nextValue = table.remove(keys, 1)
return nextValue, tbl[nextValue]
end
end
|
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data |
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
return plrData.Classes.Base.Smasher.NoHumor.Value == true
end
|
--Unequip a title for a player |
function functions.UnequipTitle(plr: Player)
local plrStats = plr.leaderstats
local plrEquippedTitle = plrStats.EquippedTitle
if plrEquippedTitle.Value ~= "" then
local char = plr.Character
if char.HumanoidRootPart:FindFirstChild("TITLE BILLBOARD GUI") then
char.HumanoidRootPart["TITLE BILLBOARD GUI"]:Destroy()
end
plrEquippedTitle.Value = ""
end
end
|
------------------------------------------------------------------------
--
-- * used in luaK:infix()
------------------------------------------------------------------------ |
function luaK:goiffalse(fs, e)
local pc -- pc of last jump
self:dischargevars(fs, e)
local k = e.k
if k == "VNIL" or k == "VFALSE"then
pc = self.NO_JUMP -- always false; do nothing
elseif k == "VTRUE" then
pc = self:jump(fs) -- always jump
elseif k == "VJMP" then
pc = e.info
else
pc = self:jumponcond(fs, e, true)
end
e.t = self:concat(fs, e.t, pc) -- insert last jump in `t' list
self:patchtohere(fs, e.f)
e.f = self.NO_JUMP
end
|
------------------------------------------------------------ |
local pos1 = Danger.Position.X
local pos2 = Danger.Position.Y
local pos3 = Danger.Position.Z |
--[[[Default Controls]] |
--Peripheral Deadzones
Tune.Peripherals = {
MSteerWidth = 67 , -- Mouse steering control width (0 - 100% of screen width)
MSteerDZone = 10 , -- Mouse steering deadzone (0 - 100%)
ControlLDZone = 5 , -- Controller steering L-deadzone (0 - 100%)
ControlRDZone = 5 , -- Controller steering R-deadzone (0 - 100%)
}
--Control Mapping
Tune.Controls = {
--Keyboard Controls
--Mode Toggles
ToggleTCS = Enum.KeyCode.ButtonR2 ,
ToggleABS = Enum.KeyCode.ButtonR2 ,
ToggleTransMode = Enum.KeyCode.M ,
ToggleMouseDrive = Enum.KeyCode.ButtonR2 ,
--Primary Controls
Throttle = Enum.KeyCode.Up ,
Brake = Enum.KeyCode.Down ,
SteerLeft = Enum.KeyCode.Left ,
SteerRight = Enum.KeyCode.Right ,
--Secondary Controls
Throttle2 = Enum.KeyCode.W ,
Brake2 = Enum.KeyCode.S ,
SteerLeft2 = Enum.KeyCode.A ,
SteerRight2 = Enum.KeyCode.D ,
--Manual Transmission
ShiftUp = Enum.KeyCode.E ,
ShiftDown = Enum.KeyCode.Q ,
Clutch = Enum.KeyCode.LeftShift ,
--Handbrake
PBrake = Enum.KeyCode.P ,
--Mouse Controls
MouseThrottle = Enum.UserInputType.MouseButton1 ,
MouseBrake = Enum.UserInputType.MouseButton2 ,
MouseClutch = Enum.KeyCode.W ,
MouseShiftUp = Enum.KeyCode.E ,
MouseShiftDown = Enum.KeyCode.Q ,
MousePBrake = Enum.KeyCode.LeftShift ,
--Controller Mapping
ContlrThrottle = Enum.KeyCode.ButtonR2 ,
ContlrBrake = Enum.KeyCode.ButtonL2 ,
ContlrSteer = Enum.KeyCode.Thumbstick1 ,
ContlrShiftUp = Enum.KeyCode.ButtonY ,
ContlrShiftDown = Enum.KeyCode.ButtonX ,
ContlrClutch = Enum.KeyCode.ButtonR1 ,
ContlrPBrake = Enum.KeyCode.ButtonL1 ,
ContlrToggleTMode = Enum.KeyCode.DPadUp ,
ContlrToggleTCS = Enum.KeyCode.DPadDown ,
ContlrToggleABS = Enum.KeyCode.DPadRight ,
}
|
--------LEFT DOOR -------- |
game.Workspace.doorleft.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l22.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l41.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l52.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l63.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l71.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l43.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l61.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l53.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l72.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l62.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l51.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l32.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l42.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l73.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.Lighting.flashcurrent.Value = "12" |
--local gridlayout = frame:WaitForChild("UIGridLayout") | |
-- |
local line_verbs = {
CR = 0, LF = 1, CRLF = 2, ANYRLF = 3, ANY = 4, NUL = 5,
};
local function is_newline(str_arr, i, verb_flags)
local line_verb_n = verb_flags.newline;
local chr = str_arr[i];
if line_verb_n == 0 then
-- carriage return
return chr == 0x0D;
elseif line_verb_n == 2 then
-- carriage return followed by line feed
return chr == 0x0A and str_arr[i - 1] == 0x20;
elseif line_verb_n == 3 then
-- any of the above
return chr == 0x0A or chr == 0x0D;
elseif line_verb_n == 4 then
-- any of Unicode newlines
return chr == 0x0A or chr == 0x0B or chr == 0x0C or chr == 0x0D or chr == 0x85 or chr == 0x2028 or chr == 0x2029;
elseif line_verb_n == 5 then
-- null
return chr == 0;
end;
-- linefeed
return chr == 0x0A;
end;
local function tkn_char_match(tkn_part, str_arr, i, flags, verb_flags)
local chr = str_arr[i];
if not chr then
return false;
elseif flags.ignoreCase and chr >= 0x61 and chr <= 0x7A then
chr -= 0x20;
end;
if type(tkn_part) == "number" then
return tkn_part == chr;
elseif tkn_part[1] == "charset" then
for _, v in ipairs(tkn_part[3]) do
if tkn_char_match(v, str_arr, i, flags, verb_flags) then
return not tkn_part[2];
end;
end;
return tkn_part[2];
elseif tkn_part[1] == "range" then
return chr >= tkn_part[2] and chr <= tkn_part[3] or flags.ignoreCase and chr >= 0x41 and chr <= 0x5A and (chr + 0x20) >= tkn_part[2] and (chr + 0x20) <= tkn_part[3];
elseif tkn_part[1] == "class" then
local char_class = tkn_part[2];
local negate = tkn_part[3];
local match = false;
-- if and elseifs :(
-- Might make these into tables in the future
if char_class == "xdigit" then
match = chr >= 0x30 and chr <= 0x39 or chr >= 0x41 and chr <= 0x46 or chr >= 0x61 and chr <= 0x66;
elseif char_class == "ascii" then
match = chr <= 0x7F;
-- cannot be accessed through POSIX classes
elseif char_class == "vertical_tab" then
match = chr >= 0x0A and chr <= 0x0D or chr == 0x2028 or chr == 0x2029;
--
elseif flags.unicode then
local current_category = u_categories[chr] or 'Cn';
local first_category = current_category:sub(1, 1);
if char_class == "alnum" then
match = first_category == 'L' or current_category == 'Nl' or current_category == 'Nd';
elseif char_class == "alpha" then
match = first_category == 'L' or current_category == 'Nl';
elseif char_class == "blank" then
match = current_category == 'Zs' or chr == 0x09;
elseif char_class == "cntrl" then
match = current_category == 'Cc';
elseif char_class == "digit" then
match = current_category == 'Nd';
elseif char_class == "graph" then
match = first_category ~= 'P' and first_category ~= 'C';
elseif char_class == "lower" then
match = current_category == 'Ll';
elseif char_class == "print" then
match = first_category ~= 'C';
elseif char_class == "punct" then
match = first_category == 'P';
elseif char_class == "space" then
match = first_category == 'Z' or chr >= 0x09 and chr <= 0x0D;
elseif char_class == "upper" then
match = current_category == 'Lu';
elseif char_class == "word" then
match = first_category == 'L' or current_category == 'Nl' or current_category == 'Nd' or current_category == 'Pc';
end;
elseif char_class == "alnum" then
match = chr >= 0x30 and chr <= 0x39 or chr >= 0x41 and chr <= 0x5A or chr >= 0x61 and chr <= 0x7A;
elseif char_class == "alpha" then
match = chr >= 0x41 and chr <= 0x5A or chr >= 0x61 and chr <= 0x7A;
elseif char_class == "blank" then
match = chr == 0x09 or chr == 0x20;
elseif char_class == "cntrl" then
match = chr <= 0x1F or chr == 0x7F;
elseif char_class == "digit" then
match = chr >= 0x30 and chr <= 0x39;
elseif char_class == "graph" then
match = chr >= 0x21 and chr <= 0x7E;
elseif char_class == "lower" then
match = chr >= 0x61 and chr <= 0x7A;
elseif char_class == "print" then
match = chr >= 0x20 and chr <= 0x7E;
elseif char_class == "punct" then
match = class_ascii_punct[chr];
elseif char_class == "space" then
match = chr >= 0x09 and chr <= 0x0D or chr == 0x20;
elseif char_class == "upper" then
match = chr >= 0x41 and chr <= 0x5A;
elseif char_class == "word" then
match = chr >= 0x30 and chr <= 0x39 or chr >= 0x41 and chr <= 0x5A or chr >= 0x61 and chr <= 0x7A or chr == 0x5F;
end;
if negate then
return not match;
end;
return match;
elseif tkn_part[1] == "category" then
local chr_category = u_categories[chr] or 'Cn';
local category_v = tkn_part[3];
local category_len = #category_v;
if category_len == 3 then
local match = false;
if category_v == "Xan" or category_v == "Xwd" then
match = chr_category:find("^[LN]") or category_v == "Xwd" and chr == 0x5F;
elseif category_v == "Xps" or category_v == "Xsp" then
match = chr_category:sub(1, 1) == 'Z' or chr >= 0x09 and chr <= 0x0D;
elseif category_v == "Xuc" then
match = tkn_char_match(xuc_chr, str_arr, i, flags, verb_flags);
end;
if tkn_part[2] then
return not match;
end
return match;
elseif chr_category:sub(1, category_len) == category_v then
return not tkn_part[2];
end;
return tkn_part[2];
elseif tkn_part[1] == 0x2E then
return flags.dotAll or not is_newline(str_arr, i, verb_flags);
elseif tkn_part[1] == 0x4E then
return not is_newline(str_arr, i, verb_flags);
elseif tkn_part[1] == 0x52 then
if verb_flags.newline_seq == 0 then
-- CR, LF or CRLF
return chr == 0x0A or chr == 0x0D;
end;
-- any unicode newline
return chr == 0x0A or chr == 0x0B or chr == 0x0C or chr == 0x0D or chr == 0x85 or chr == 0x2028 or chr == 0x2029;
end;
return false;
end;
local function find_alternation(token, i, count)
while true do
local v = token[i];
local is_table = type(v) == "table";
if v == alternation then
return i, count;
elseif is_table and v[1] == 0x28 then
if count then
count += v.count;
end;
i = v[3];
elseif is_table and v[1] == "quantifier" and type(v[5]) == "table" and v[5][1] == 0x28 then
if count then
count += v[5].count;
end;
i = v[5][3];
elseif not v or is_table and v[1] == 0x29 then
return nil, count;
elseif count then
if is_table and v[1] == "quantifier" then
count += v[3];
else
count += 1;
end;
end;
i += 1;
end;
end;
local function re_rawfind(token, str_arr, init, flags, verb_flags, as_bool)
local tkn_i, str_i, start_i = 0, init, init;
local states = { };
while tkn_i do
if tkn_i == 0 then
tkn_i += 1;
local next_alt = find_alternation(token, tkn_i);
if next_alt then
table.insert(states, 1, { "alternation", next_alt, str_i });
end;
continue;
end;
local ctkn = token[tkn_i];
local tkn_type = type(ctkn) == "table" and ctkn[1];
if not ctkn then
break;
elseif ctkn == "ACCEPT" then
local not_lookaround = true;
local close_i = tkn_i;
repeat
close_i += 1;
local is_table = type(token[close_i]) == "table";
local close_i_tkn = token[close_i];
if is_table and (close_i_tkn[1] == 0x28 or close_i_tkn[1] == "quantifier" and type(close_i_tkn[5]) == "table" and close_i_tkn[5][1] == 0x28) then
close_i = close_i_tkn[1] == "quantifier" and close_i_tkn[5][3] or close_i_tkn[3];
elseif is_table and close_i_tkn[1] == 0x29 and (close_i_tkn[4] == 0x21 or close_i_tkn[4] == 0x3D) then
not_lookaround = false;
tkn_i = close_i;
break;
end;
until not close_i_tkn;
if not_lookaround then
break;
end;
elseif ctkn == "PRUNE" or ctkn == "SKIP" then
table.insert(states, 1, { ctkn, str_i });
tkn_i += 1;
elseif tkn_type == 0x28 then
table.insert(states, 1, { "group", tkn_i, str_i, nil, ctkn[2], ctkn[3], ctkn[4] });
tkn_i += 1;
local next_alt, count = find_alternation(token, tkn_i, (ctkn[4] == 0x21 or ctkn[4] == 0x3D) and ctkn[5] and 0);
if next_alt then
table.insert(states, 1, { "alternation", next_alt, str_i });
end;
if count then
str_i -= count;
end;
elseif tkn_type == 0x29 and ctkn[4] ~= 0x21 then
if ctkn[4] == 0x21 or ctkn[4] == 0x3D then
while true do
local selected_match_start;
local selected_state = table.remove(states, 1);
if selected_state[1] == "group" and selected_state[2] == ctkn[3] then
if (ctkn[4] == 0x21 or ctkn[4] == 0x3D) and not ctkn[5] then
str_i = selected_state[3];
end;
if selected_match_start then
table.insert(states, 1, selected_match_start);
end;
break;
elseif selected_state[1] == "matchStart" and not selected_match_start and ctkn[4] == 0x3D then
selected_match_start = selected_state;
end;
end;
elseif ctkn[4] == 0x3E then
repeat
local selected_state = table.remove(states, 1);
until not selected_state or selected_state[1] == "group" and selected_state[2] == ctkn[3];
else
for i, v in ipairs(states) do
if v[1] == "group" and v[2] == ctkn[3] then
if v.jmp then
-- recursive match
tkn_i = v.jmp;
end;
v[4] = str_i;
if v[7] == "quantifier" and v[10] + 1 < v[9] then
if token[ctkn[3]][4] ~= "lazy" or v[10] + 1 < v[8] then
tkn_i = ctkn[3];
end;
local ctkn1 = token[ctkn[3]];
local new_group = { "group", v[2], str_i, nil, ctkn1[5][2], ctkn1[5][3], "quantifier", ctkn1[2], ctkn1[3], v[10] + 1, v[11], ctkn1[4] };
table.insert(states, 1, new_group);
if v[11] then
table.insert(states, 1, { "alternation", v[11], str_i });
end;
end;
break;
end;
end;
end;
tkn_i += 1;
elseif tkn_type == 0x4B then
table.insert(states, 1, { "matchStart", str_i });
tkn_i += 1;
elseif tkn_type == 0x7C then
local close_i = tkn_i;
repeat
close_i += 1;
local is_table = type(token[close_i]) == "table";
local close_i_tkn = token[close_i];
if is_table and (close_i_tkn[1] == 0x28 or close_i_tkn[1] == "quantifier" and type(close_i_tkn[5]) == "table" and close_i_tkn[5][1] == 0x28) then
close_i = close_i_tkn[1] == "quantifier" and close_i_tkn[5][3] or close_i_tkn[3];
end;
until is_table and close_i_tkn[1] == 0x29 or not close_i_tkn;
if token[close_i] then
for _, v in ipairs(states) do
if v[1] == "group" and v[6] == close_i then
tkn_i = v[6];
break;
end;
end;
else
tkn_i = close_i;
end;
elseif tkn_type == "recurmatch" then
table.insert(states, 1, { "group", ctkn[3], str_i, nil, nil, token[ctkn[3]][3], nil, jmp = tkn_i });
tkn_i = ctkn[3] + 1;
local next_alt, count = find_alternation(token, tkn_i);
if next_alt then
table.insert(states, 1, { "alternation", next_alt, str_i });
end;
else
local match;
if ctkn == "FAIL" then
match = false;
elseif tkn_type == 0x29 then
repeat
local selected_state = table.remove(states, 1);
until selected_state[1] == "group" and selected_state[2] == ctkn[3];
elseif tkn_type == "quantifier" then
if type(ctkn[5]) == "table" and ctkn[5][1] == 0x28 then
local next_alt = find_alternation(token, tkn_i + 1);
if next_alt then
table.insert(states, 1, { "alternation", next_alt, str_i });
end;
table.insert(states, next_alt and 2 or 1, { "group", tkn_i, str_i, nil, ctkn[5][2], ctkn[5][3], "quantifier", ctkn[2], ctkn[3], 0, next_alt, ctkn[4] });
if ctkn[4] == "lazy" and ctkn[2] == 0 then
tkn_i = ctkn[5][3];
end;
match = true;
else
local start_i, end_i;
local pattern_count = 1;
local is_backref = type(ctkn[5]) == "table" and ctkn[5][1] == "backref";
if is_backref then
pattern_count = 0;
local group_n = ctkn[5][2];
for _, v in ipairs(states) do
if v[1] == "group" and v[5] == group_n then
start_i, end_i = v[3], v[4];
pattern_count = end_i - start_i;
break;
end;
end;
end;
local min_max_i = str_i + ctkn[2] * pattern_count;
local mcount = 0;
while mcount < ctkn[3] do
if is_backref then
if start_i and end_i then
local org_i = str_i;
if utf8_sub(str_arr.s, start_i, end_i) ~= utf8_sub(str_arr.s, org_i, str_i + pattern_count) then
break;
end;
else
break;
end;
elseif not tkn_char_match(ctkn[5], str_arr, str_i, flags, verb_flags) then
break;
end;
str_i += pattern_count;
mcount += 1;
end;
match = mcount >= ctkn[2];
if match and ctkn[4] ~= "possessive" then
if ctkn[4] == "lazy" then
min_max_i, str_i = str_i, min_max_i;
end;
table.insert(states, 1, { "quantifier", tkn_i, str_i, math.min(min_max_i, str_arr.n + 1), (ctkn[4] == "lazy" and 1 or -1) * pattern_count });
end;
end;
elseif tkn_type == "backref" then
local start_i, end_i;
local group_n = ctkn[2];
for _, v in ipairs(states) do
if v[1] == "group" and v[5] == group_n then
start_i, end_i = v[3], v[4];
break;
end;
end;
if start_i and end_i then
local org_i = str_i;
str_i += end_i - start_i;
match = utf8_sub(str_arr.s, start_i, end_i) == utf8_sub(str_arr.s, org_i, str_i);
end;
else
local chr = str_arr[str_i];
if tkn_type == 0x24 or tkn_type == 0x5A or tkn_type == 0x7A then
match = str_i == str_arr.n + 1 or tkn_type == 0x24 and flags.multiline and is_newline(str_arr, str_i + 1, verb_flags) or tkn_type == 0x5A and str_i == str_arr.n and is_newline(str_arr, str_i, verb_flags);
elseif tkn_type == 0x5E or tkn_type == 0x41 or tkn_type == 0x47 then
match = str_i == 1 or tkn_type == 0x5E and flags.multiline and is_newline(str_arr, str_i - 1, verb_flags) or tkn_type == 0x47 and str_i == init;
elseif tkn_type == 0x42 or tkn_type == 0x62 then
local start_m = str_i == 1 or flags.multiline and is_newline(str_arr, str_i - 1, verb_flags);
local end_m = str_i == str_arr.n + 1 or flags.multiline and is_newline(str_arr, str_i, verb_flags);
local w_m = tkn_char_match(ctkn[2], str_arr[str_i - 1], flags) and 0 or tkn_char_match(ctkn[2], chr, flags) and 1;
if w_m == 0 then
match = end_m or not tkn_char_match(ctkn[2], chr, flags);
elseif w_m then
match = start_m or not tkn_char_match(ctkn[2], str_arr[str_i - 1], flags);
end;
if tkn_type == 0x42 then
match = not match;
end;
else
match = tkn_char_match(ctkn, str_arr, str_i, flags, verb_flags);
str_i += 1;
end;
end;
if not match then
while true do
local prev_type, prev_state = states[1] and states[1][1], states[1];
if not prev_type or prev_type == "PRUNE" or prev_type == "SKIP" then
if prev_type then
table.clear(states);
end;
if start_i > str_arr.n then
if as_bool then
return false;
end;
return nil;
end;
start_i = prev_type == "SKIP" and prev_state[2] or start_i + 1;
tkn_i, str_i = 0, start_i;
break;
elseif prev_type == "alternation" then
tkn_i, str_i = prev_state[2], prev_state[3];
local next_alt, count = find_alternation(token, tkn_i + 1);
if next_alt then
prev_state[2] = next_alt;
else
table.remove(states, 1);
end;
if count then
str_i -= count;
end;
break;
elseif prev_type == "group" then
if prev_state[7] == "quantifier" then
if prev_state[12] == "greedy" and prev_state[10] >= prev_state[8]
or prev_state[12] == "lazy" and prev_state[10] < prev_state[9] and not prev_state[13] then
tkn_i, str_i = prev_state[12] == "greedy" and prev_state[6] or prev_state[2], prev_state[3];
if prev_state[12] == "greedy" then
table.remove(states, 1);
break;
elseif prev_state[10] >= prev_state[8] then
prev_state[13] = true;
break;
end;
end;
elseif prev_state[7] == 0x21 then
table.remove(states, 1);
tkn_i, str_i = prev_state[6], prev_state[3];
break;
end;
elseif prev_type == "quantifier" then
if math.sign(prev_state[4] - prev_state[3]) == math.sign(prev_state[5]) then
prev_state[3] += prev_state[5];
tkn_i, str_i = prev_state[2], prev_state[3];
break;
end;
end;
-- keep match out state and recursive state, can be safely removed
-- prevents infinite loop
table.remove(states, 1);
end;
end;
tkn_i += 1;
end;
end;
if as_bool then
return true;
end;
local match_start_ran = false;
local span = table.create(token.group_n);
span[0], span.n = { start_i, str_i }, token.group_n;
for _, v in ipairs(states) do
if v[1] == "matchStart" and not match_start_ran then
span[0][1], match_start_ran = v[2], true;
elseif v[1] == "group" and v[5] and not span[v[5]] then
span[v[5]] = { v[3], v[4] };
end;
end;
return span;
end;
|
--// States |
local L_64_ = false
local L_65_ = false
local L_66_ = false
local L_67_ = false
local L_68_ = false
local L_69_ = true
local L_70_ = false
local L_71_ = false
local L_72_ = false
local L_73_ = false
local L_74_ = false
local L_75_ = false
local L_76_ = false
local L_77_ = false
local L_78_ = false
local L_79_ = false
local L_80_ = false
local L_81_ = false
local L_82_ = false
local L_83_ = false
local L_84_ = true
local L_85_ = true
local L_86_ = false
local L_87_
local L_88_
local L_89_
local L_90_
local L_91_
local L_92_ = L_24_.FireMode
local L_93_ = 0
local L_94_ = false
local L_95_ = true
local L_96_ = false
local L_97_ = 70
|
-- if _Tune.Config == "FWD" or _Tune.Config == "AWD" then for i,v in pairs(car.Wheels:GetChildren()) do if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then table.insert(Drive,v) end end end |
--Power Rear Wheels
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then for i,v in pairs(car.Wheels:GetChildren()) do if v.Name=="RL" or v.Name=="RR" or v.Name=="R" then table.insert(Drive,v) end end end
--Determine Wheel Size
local wDia = 0 for i,v in pairs(Drive) do if v.Size.x>wDia then wDia = v.Size.x end end
--Pre-Toggled PBrake
for i,v in pairs(car.Wheels:GetChildren()) do if math.abs(v["#AV"].maxTorque.Magnitude-PBrakeForce)<1 then _PBrake=true end end
|
-- the toggleables |
local walkSpeed = 16
local aggroRange = 60
local stateData = {
["state"] = "Idle",
["targ"] = nil,
["lastOrder"] = 0,
}
local animController = char:WaitForChild("AnimationController")
local preAnims = { |
--returns the wielding player of this tool |
function getPlayer()
local char = Tool.Parent
return game:GetService("Players"):GetPlayerFromCharacter(char)
end
|
--
-- TO HIDE MANUALLY: |
topHint.Delete.Disabled = false |
-- Deprecated in favour of GetMessageModeTextButton
-- Retained for compatibility reasons. |
function methods:GetMessageModeTextLabel()
return self:GetMessageModeTextButton()
end
function methods:IsFocused()
if self.UserHasChatOff then
return false
end
return self:GetTextBox():IsFocused()
end
function methods:GetVisible()
return self.GuiObject.Visible
end
function methods:CaptureFocus()
if not self.UserHasChatOff then
self:GetTextBox():CaptureFocus()
end
end
function methods:ReleaseFocus(didRelease)
self:GetTextBox():ReleaseFocus(didRelease)
end
function methods:ResetText()
self:GetTextBox().Text = ""
end
function methods:SetText(text)
self:GetTextBox().Text = text
end
function methods:GetEnabled()
return self.GuiObject.Visible
end
function methods:SetEnabled(enabled)
if self.UserHasChatOff then
-- The chat bar can not be removed if a user has chat turned off so that
-- the chat bar can display a message explaining that chat is turned off.
self.GuiObject.Visible = true
else
self.GuiObject.Visible = enabled
end
end
function methods:SetTextLabelText(text)
if not self.UserHasChatOff then
self.TextLabel.Text = text
end
end
function methods:SetTextBoxText(text)
self.TextBox.Text = text
end
function methods:GetTextBoxText()
return self.TextBox.Text
end
function methods:ResetSize()
self.TargetYSize = 0
self:TweenToTargetYSize()
end
local function measureSize(textObj)
return TextService:GetTextSize(
textObj.Text,
textObj.TextSize,
textObj.Font,
Vector2.new(textObj.AbsoluteSize.X, 10000)
)
end
function methods:CalculateSize()
if self.CalculatingSizeLock then
return
end
self.CalculatingSizeLock = true
local textSize = nil
local bounds = nil
if self:IsFocused() or self.TextBox.Text ~= "" then
textSize = self.TextBox.TextSize
bounds = measureSize(self.TextBox).Y
else
textSize = self.TextLabel.TextSize
bounds = measureSize(self.TextLabel).Y
end
local newTargetYSize = bounds - textSize
if (self.TargetYSize ~= newTargetYSize) then
self.TargetYSize = newTargetYSize
self:TweenToTargetYSize()
end
self.CalculatingSizeLock = false
end
function methods:TweenToTargetYSize()
local endSize = UDim2.new(1, 0, 1, self.TargetYSize)
local curSize = self.GuiObject.Size
local curAbsoluteSizeY = self.GuiObject.AbsoluteSize.Y
self.GuiObject.Size = endSize
local endAbsoluteSizeY = self.GuiObject.AbsoluteSize.Y
self.GuiObject.Size = curSize
local pixelDistance = math.abs(endAbsoluteSizeY - curAbsoluteSizeY)
local tweeningTime = math.min(1, (pixelDistance * (1 / self.TweenPixelsPerSecond))) -- pixelDistance * (seconds per pixels)
local success = pcall(function() self.GuiObject:TweenSize(endSize, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, tweeningTime, true) end)
if (not success) then
self.GuiObject.Size = endSize
end
end
function methods:SetTextSize(textSize)
if not self:IsInCustomState() then
if self.TextBox then
self.TextBox.TextSize = textSize
end
if self.TextLabel then
self.TextLabel.TextSize = textSize
end
end
end
function methods:GetDefaultChannelNameColor()
if ChatSettings.DefaultChannelNameColor then
return ChatSettings.DefaultChannelNameColor
end
return Color3.fromRGB(35, 76, 142)
end
function methods:SetChannelTarget(targetChannel)
local messageModeTextButton = self.GuiObjects.MessageModeTextButton
local textBox = self.TextBox
local textLabel = self.TextLabel
self.TargetChannel = targetChannel
if not self:IsInCustomState() then
if targetChannel ~= ChatSettings.GeneralChannelName then
messageModeTextButton.Size = UDim2.new(0, 1000, 1, 0)
local localizedTargetChannel = targetChannel
if ChatLocalization.tryLocalize then
localizedTargetChannel = ChatLocalization:tryLocalize(targetChannel)
end
messageModeTextButton.Text = string.format("[%s] ", localizedTargetChannel)
local channelNameColor = self:GetChannelNameColor(targetChannel)
if channelNameColor then
messageModeTextButton.TextColor3 = channelNameColor
else
messageModeTextButton.TextColor3 = self:GetDefaultChannelNameColor()
end
local xSize = messageModeTextButton.TextBounds.X
messageModeTextButton.Size = UDim2.new(0, xSize, 1, 0)
textBox.Size = UDim2.new(1, -xSize, 1, 0)
textBox.Position = UDim2.new(0, xSize, 0, 0)
textLabel.Size = UDim2.new(1, -xSize, 1, 0)
textLabel.Position = UDim2.new(0, xSize, 0, 0)
else
messageModeTextButton.Text = ""
messageModeTextButton.Size = UDim2.new(0, 0, 0, 0)
textBox.Size = UDim2.new(1, 0, 1, 0)
textBox.Position = UDim2.new(0, 0, 0, 0)
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.Position = UDim2.new(0, 0, 0, 0)
end
end
end
function methods:IsInCustomState()
return self.InCustomState
end
function methods:ResetCustomState()
if self.InCustomState then
self.CustomState:Destroy()
self.CustomState = nil
self.InCustomState = false
self.ChatBarParentFrame:ClearAllChildren()
self:CreateGuiObjects(self.ChatBarParentFrame)
self:SetTextLabelText(
ChatLocalization:Get(
"GameChat_ChatMain_ChatBarText",
'To chat click here or press "/" key'
)
)
end
end
function methods:EnterWhisperState(player)
self:ResetCustomState()
if WhisperModule.CustomStateCreator then
self.CustomState = WhisperModule.CustomStateCreator(
player,
self.ChatWindow,
self,
ChatSettings
)
self.InCustomState = true
else
local playerName
if ChatSettings.PlayerDisplayNamesEnabled then
playerName = player.DisplayName
else
playerName = player.Name
end
self:SetText("/w " .. playerName)
end
self:CaptureFocus()
end
function methods:GetCustomMessage()
if self.InCustomState then
return self.CustomState:GetMessage()
end
return nil
end
function methods:CustomStateProcessCompletedMessage(message)
if self.InCustomState then
return self.CustomState:ProcessCompletedMessage()
end
return false
end
function methods:FadeOutBackground(duration)
self.AnimParams.Background_TargetTransparency = 1
self.AnimParams.Background_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
self:FadeOutText(duration)
end
function methods:FadeInBackground(duration)
self.AnimParams.Background_TargetTransparency = 0.6
self.AnimParams.Background_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
self:FadeInText(duration)
end
function methods:FadeOutText(duration)
self.AnimParams.Text_TargetTransparency = 1
self.AnimParams.Text_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
end
function methods:FadeInText(duration)
self.AnimParams.Text_TargetTransparency = 0.4
self.AnimParams.Text_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
end
function methods:AnimGuiObjects()
self.GuiObject.BackgroundTransparency = self.AnimParams.Background_CurrentTransparency
self.GuiObjects.TextBoxFrame.BackgroundTransparency = self.AnimParams.Background_CurrentTransparency
self.GuiObjects.TextLabel.TextTransparency = self.AnimParams.Text_CurrentTransparency
self.GuiObjects.TextBox.TextTransparency = self.AnimParams.Text_CurrentTransparency
self.GuiObjects.MessageModeTextButton.TextTransparency = self.AnimParams.Text_CurrentTransparency
end
function methods:InitializeAnimParams()
self.AnimParams.Text_TargetTransparency = 0.4
self.AnimParams.Text_CurrentTransparency = 0.4
self.AnimParams.Text_NormalizedExptValue = 1
self.AnimParams.Background_TargetTransparency = 0.6
self.AnimParams.Background_CurrentTransparency = 0.6
self.AnimParams.Background_NormalizedExptValue = 1
end
function methods:Update(dtScale)
self.AnimParams.Text_CurrentTransparency = CurveUtil:Expt(
self.AnimParams.Text_CurrentTransparency,
self.AnimParams.Text_TargetTransparency,
self.AnimParams.Text_NormalizedExptValue,
dtScale
)
self.AnimParams.Background_CurrentTransparency = CurveUtil:Expt(
self.AnimParams.Background_CurrentTransparency,
self.AnimParams.Background_TargetTransparency,
self.AnimParams.Background_NormalizedExptValue,
dtScale
)
self:AnimGuiObjects()
end
function methods:SetChannelNameColor(channelName, channelNameColor)
self.ChannelNameColors[channelName] = channelNameColor
if self.GuiObjects.MessageModeTextButton.Text == channelName then
self.GuiObjects.MessageModeTextButton.TextColor3 = channelNameColor
end
end
function methods:GetChannelNameColor(channelName)
return self.ChannelNameColors[channelName]
end
|
--[[Rear]] | --
Tune.RTireProfile = 1 -- Tire profile, aggressive or smooth
Tune.RProfileHeight = .45 -- Profile height, conforming to tire
Tune.RTireCompound = 0 -- The more compounds you have, the harder your tire will get towards the middle, sacrificing grip for wear
Tune.RTireFriction = 3 -- Your tire's friction in the best conditions.
|
----- Private Functions ----- |
local function ProcessReceipt(receipt_info)
local ProductId = receipt_info.ProductId
local player = Players:GetPlayerByUserId(receipt_info.PlayerId)
if player == nil then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
local profile = PlayerData.Profiles[player]
if not profile then return end
local ProductToBuy, amount = EggConfig.GetEggFromProduct(ProductId)
local pets = HatchBind:Invoke(player, ProductToBuy, amount)
task.wait(1.5)
Remotes.Eggs.EggProductPurchased:FireClient(player, ProductToBuy, pets)
end
|
--Door Sound
--Local Setting(Do not touch) |
SP = script.Parent.Parent
Data = SP.Data
Floor = Data.Floor
Motor = Data.Motor
Car = SP.Car
Door = Data.Door
Direction = Data.Direction
TCarG = Car:GetChildren()
Floors = SP.Floors
TFloorsG = Floors:GetChildren()
TotalFloors = 0
|
--Hand |
local RHL = character.RightHand:FindFirstChild("RightWristRigAttachment")
local RHR = character.LeftHand:FindFirstChild("LeftWristRigAttachment")
|
---SG Is Here---
---Please Dont Change Anything Can Dont Work If You Change-- |
local repStorage = game:GetService("ReplicatedStorage")
local remote = repStorage:FindFirstChild("Rebirth")
remote.OnServerEvent:Connect(function(plr, x)
if plr.leaderstats.Coins.Value >= 100 * (x.Value + 1) then
x.Value = x.Value + 1
plr.leaderstats.Coins.Value = 0
plr.leaderstats.Clicks.Value = 0
end
end)
|
--[[Wheel Alignment]] |
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
Tune.FCamber = -0.2
Tune.RCamber = 0
Tune.FToe = 0
Tune.RToe = 0
|
-- New raycast parameters. |
local CastParams = RaycastParams.new()
CastParams.IgnoreWater = true
CastParams.FilterType = Enum.RaycastFilterType.Blacklist
CastParams.FilterDescendantsInstances = {}
|
-- Import relevant references |
Selection = Core.Selection;
Create = Core.Create;
Support = Core.Support;
Security = Core.Security;
Support.ImportServices();
|
-------------------------------------------------------------------------- |
local car = script.Parent.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
local cValues = script.Parent.Parent:WaitForChild("Values")
|
-- LOCAL |
local starterGui = game:GetService("StarterGui")
local guiService = game:GetService("GuiService")
local hapticService = game:GetService("HapticService")
local runService = game:GetService("RunService")
local userInputService = game:GetService("UserInputService")
local tweenService = game:GetService("TweenService")
local players = game:GetService("Players")
local VRService = game:GetService("VRService")
local voiceChatService = game:GetService("VoiceChatService")
local localizationService = game:GetService("LocalizationService")
local iconModule = script.Parent
local TopbarPlusReference = require(iconModule.TopbarPlusReference)
local referenceObject = TopbarPlusReference.getObject()
local leadPackage = referenceObject and referenceObject.Value
if leadPackage and leadPackage.IconController ~= script then
return require(leadPackage.IconController)
end
if not referenceObject then
TopbarPlusReference.addToReplicatedStorage()
end
local IconController = {}
local Signal = require(iconModule.Signal)
local TopbarPlusGui = require(iconModule.TopbarPlusGui)
local topbarIcons = {}
local forceTopbarDisabled = false
local menuOpen
local topbarUpdating = false
local cameraConnection
local controllerMenuOverride
local isStudio = runService:IsStudio()
local localPlayer = players.LocalPlayer
local voiceChatIsEnabledForUserAndWithinExperience = false
local disableControllerOption = false
local STUPID_CONTROLLER_OFFSET = 32
|
--[=[
Folds an array of values or promises into a single value. The array is traversed sequentially.
The reducer function can return a promise or value directly. Each iteration receives the resolved value from the previous, and the first receives your defined initial value.
The folding will stop at the first rejection encountered.
```lua
local basket = {"blueberry", "melon", "pear", "melon"}
Promise.fold(basket, function(cost, fruit)
if fruit == "blueberry" then
return cost -- blueberries are free!
else
-- call a function that returns a promise with the fruit price
return fetchPrice(fruit):andThen(function(fruitCost)
return cost + fruitCost
end)
end
end, 0)
```
@since v3.1.0
@param list {T | Promise<T>}
@param reducer (accumulator: U, value: T, index: number) -> U | Promise<U>
@param initialValue U
]=] |
function Promise.fold(list, reducer, initialValue)
assert(type(list) == "table", "Bad argument #1 to Promise.fold: must be a table")
assert(isCallable(reducer), "Bad argument #2 to Promise.fold: must be a function")
local accumulator = Promise.resolve(initialValue)
return Promise.each(list, function(resolvedElement, i)
accumulator = accumulator:andThen(function(previousValueResolved)
return reducer(previousValueResolved, resolvedElement, i)
end)
end):andThen(function()
return accumulator
end)
end
|
--[[
Assigns a new spot on a canvas for the current player.
Complex logic for multiple cases, but we broke these down into a table form in Confluence.
Refer to the tech spec for more information!
https://confluence.rbx.com/display/SOCIAL/Surface+Art+Tech+Spec#SurfaceArtTechSpec-spot-assigning-logic
Parameters:
- canvas (Canvas): current Canvas object that player wants to apply an art on
]] |
function PlayerSpots:assignSpot(player, canvas)
-- Removes previous spot that has no art placed. This happens if player gets a spot but cancels before placing an art
self:_removeUnusedSpots(player)
local playerHasQuota = #self.placedSpots < self.quota
local canvasHasSpot = not canvas:isFull()
local playerHasArtOnSurface = self:_hasArtOnCanvas(canvas)
if canvasHasSpot and playerHasQuota then
return self:_assignRandomSpot(canvas)
elseif canvasHasSpot and not playerHasQuota then
self:_removeOldestArt()
return self:_assignRandomSpot(canvas)
elseif not canvasHasSpot and playerHasArtOnSurface then
self:_removeOldestArtFromCanvas(canvas)
return self:_assignRandomSpot(canvas)
elseif canvasHasSpot and not playerHasQuota and not playerHasArtOnSurface then
self:_removeOldestArtFromOtherCanvas(canvas)
return self:_assignRandomSpot(canvas)
elseif not canvasHasSpot and not playerHasArtOnSurface then
return false, constants.Errors.SpotNotAvailable
end
end
|
-- May return NaN or inf or -inf
-- This is a way of finding the angle between the two vectors: |
local function findAngleBetweenXZVectors(vec2, vec1)
return math_atan2(vec1.X*vec2.Z-vec1.Z*vec2.X, vec1.X*vec2.X + vec1.Z*vec2.Z)
end
local function GetValueObject(name, defaultValue)
local valueObj = script:FindFirstChild(name)
if valueObj then
return valueObj.Value
end
return defaultValue
end
local function LoadOrCreateNumberValueParameter(name, valueType, updateFunction)
local valueObj = script:FindFirstChild(name)
if valueObj and valueObj:isA(valueType) then
-- Value object exists and is the correct type, use its value
externalProperties[name] = valueObj.Value
elseif externalProperties[name] ~= nil then
-- Create missing (or replace incorrectly-typed) valueObject with default value
valueObj = Instance.new(valueType)
valueObj.Name = name
valueObj.Parent = script
valueObj.Value = externalProperties[name]
else
print("externalProperties table has no entry for ",name)
return
end
if updateFunction then
if changedSignalConnections[name] then
changedSignalConnections[name]:disconnect()
end
changedSignalConnections[name] = valueObj.Changed:connect(function(newValue)
externalProperties[name] = newValue
updateFunction()
end)
end
end
local function SetAndBoundsCheckAzimuthValues()
minAzimuthAbsoluteRad = math.rad(externalProperties["ReferenceAzimuth"]) - math.abs(math.rad(externalProperties["CWAzimuthTravel"]))
maxAzimuthAbsoluteRad = math.rad(externalProperties["ReferenceAzimuth"]) + math.abs(math.rad(externalProperties["CCWAzimuthTravel"]))
useAzimuthLimits = externalProperties["UseAzimuthLimits"]
if useAzimuthLimits then
curAzimuthRad = math.max(curAzimuthRad, minAzimuthAbsoluteRad)
curAzimuthRad = math.min(curAzimuthRad, maxAzimuthAbsoluteRad)
end
end
local function SetAndBoundsCheckElevationValues()
-- These degree values are the direct user input values. It is deliberate that they are
-- ranged checked only against the extremes, and not against each other. Any time one
-- is changed, both of the internal values in radians are recalculated. This allows for
-- A developer to change the values in any order and for the end results to be that the
-- internal values adjust to match intent as best as possible.
local minElevationDeg = math.max(externalProperties["MinElevation"], MIN_ALLOWED_ELEVATION_DEG)
local maxElevationDeg = math.min(externalProperties["MaxElevation"], MAX_ALLOWED_ELEVATION_DEG)
-- Set internal values in radians
minElevationRad = math.rad(math.min(minElevationDeg, maxElevationDeg))
maxElevationRad = math.rad(math.max(minElevationDeg, maxElevationDeg))
curElevationRad = math.max(curElevationRad, minElevationRad)
curElevationRad = math.min(curElevationRad, maxElevationRad)
end
local function SetAndBoundsCheckDistanceValues()
minDistance = externalProperties["MinDistance"]
maxDistance = externalProperties["MaxDistance"]
curDistance = math.max(curDistance, minDistance)
curDistance = math.min(curDistance, maxDistance)
end
|
-----------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------- |
local Vida = script.Parent.Stats.Frame.Vida
local Consciente = script.Parent.Stats.Frame.Consciente
local Dor = script.Parent.Stats.Frame.Dor
local Ferido = script.Parent.Stats.Frame.Ferido
local Sangrando = script.Parent.Stats.Frame.Sangrando
local BleedTween = TS:Create(Sangrando, TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,-1,true), {TextColor3 = Color3.fromRGB(255, 0, 0)} )
BleedTween:Play()
RS.RenderStepped:connect(function()
if script.Parent.Visible == true then
if Target.Value ~= nil then
local player = game.Players:FindFirstChild(Target.Value.Name)
local P2_Client = player.Character:FindFirstChild("ACS_Client")
if player and P2_Client then
local vHuman = player.Character.Humanoid
local vSang = player.Character.ACS_Client.Variaveis.Sangue
local pie = (vHuman.Health / vHuman.MaxHealth)
script.Parent.Overview.Frame.VidaBar.Bar.Size = UDim2.new(pie, 0, 1, 0)
local Pizza = (vSang.Value / vSang.MaxValue)
script.Parent.Overview.Frame.SangueBar.Bar.Size = UDim2.new(Pizza, 0, 1, 0)
else
Target.Value = nil
end
else
local pie = (Human.Health / Human.MaxHealth)
script.Parent.Overview.Frame.VidaBar.Bar.Size = UDim2.new(pie, 0, 1, 0)
local Pizza = (Saude.Variaveis.Sangue.Value / Saude.Variaveis.Sangue.MaxValue)
script.Parent.Overview.Frame.SangueBar.Bar.Size = UDim2.new(Pizza, 0, 1, 0)
end
if Target.Value == nil then
if Human.Health <= 0 then
Vida.Text = "Dead"
Vida.TextColor3 = Color3.fromRGB(255,0,0)
Consciente.Visible = false
elseif Human.Health <= (Human.MaxHealth * .5) then
Vida.Text = "High Risk"
Vida.TextColor3 = Color3.fromRGB(255,0,0)
Consciente.Visible = true
elseif Human.Health <= (Human.MaxHealth * .75) then
Vida.Text = "Low Risk"
Vida.TextColor3 = Color3.fromRGB(255,255,0)
Consciente.Visible = true
elseif Human.Health <= (Human.MaxHealth) then
Vida.Text = "Healthy"
Vida.TextColor3 = Color3.fromRGB(255,255,255)
Consciente.Visible = true
end
if Saude:GetAttribute("Collapsed") == true then
Consciente.Text = "Unconscious"
else
Consciente.Text = "Conscious"
end
if Saude.Variaveis.Dor.Value <= 0 then
Dor.Text = "No pain"
Dor.TextColor3 = Color3.fromRGB(255,255,255)
Dor.Visible = false
elseif Saude.Variaveis.Dor.Value <= 50 then
Dor.Text = "Minor pain"
Dor.TextColor3 = Color3.fromRGB(255,255,255)
Dor.Visible = true
elseif Saude.Variaveis.Dor.Value < 100 then
Dor.Text = "Major pain"
Dor.TextColor3 = Color3.fromRGB(255,255,0)
Dor.Visible = true
elseif Saude.Variaveis.Dor.Value >= 100 then
Dor.Text = "Extreme pain"
Dor.TextColor3 = Color3.fromRGB(255,0,0)
Dor.Visible = true
end
if Saude:GetAttribute("Injured") == true then
Ferido.Visible = true
else
Ferido.Visible = false
end
if Saude:GetAttribute("Bleeding") == true or Saude:GetAttribute("Tourniquet")then
if Saude:GetAttribute("Tourniquet") then
Sangrando.Text = 'Tourniquet'
else
Sangrando.Text = 'Bleeding'
end
Sangrando.Visible = true
else
Sangrando.Visible = false
end
else
local player2 = game.Players:FindFirstChild(Target.Value.Name)
local PlHuman = player2.Character.Humanoid
local PlSaude = player2.Character.ACS_Client
if PlHuman.Health > 0 then
if PlHuman.Health <= 0 then
Vida.Text = "Dead"
Vida.TextColor3 = Color3.fromRGB(255,0,0)
Consciente.Visible = false
elseif PlHuman.Health <= (PlHuman.MaxHealth * .5) then
Vida.Text = "High Risk"
Vida.TextColor3 = Color3.fromRGB(255,0,0)
Consciente.Visible = true
elseif PlHuman.Health <= (PlHuman.MaxHealth * .75) then
Vida.Text = "Low Risk"
Vida.TextColor3 = Color3.fromRGB(255,255,0)
Consciente.Visible = true
elseif PlHuman.Health <= (PlHuman.MaxHealth) then
Vida.Text = "Healthy"
Vida.TextColor3 = Color3.fromRGB(255,255,255)
Consciente.Visible = true
end
if PlSaude:GetAttribute("Collapsed") == true then
Consciente.Text = "Unconscious"
else
Consciente.Text = "Conscious"
end
if PlSaude.Variaveis.Dor.Value <= 0 then
Dor.Text = "No pain"
Dor.TextColor3 = Color3.fromRGB(255,255,255)
Dor.Visible = false
elseif PlSaude.Variaveis.Dor.Value <= 50 then
Dor.Text = "Minor pain"
Dor.TextColor3 = Color3.fromRGB(255,255,255)
Dor.Visible = true
elseif PlSaude.Variaveis.Dor.Value < 100 then
Dor.Text = "Major pain"
Dor.TextColor3 = Color3.fromRGB(255,255,0)
Dor.Visible = true
elseif PlSaude.Variaveis.Dor.Value >= 100 then
Dor.Text = "Extreme pain"
Dor.TextColor3 = Color3.fromRGB(255,0,0)
Dor.Visible = true
end
if PlSaude:GetAttribute("Injured") == true then
Ferido.Visible = true
else
Ferido.Visible = false
end
if PlSaude:GetAttribute("Bleeding") == true or PlSaude:GetAttribute("Tourniquet") then
if PlSaude:GetAttribute("Tourniquet")then
Sangrando.Text = 'Tourniquet'
else
Sangrando.Text = 'Bleeding'
end
Sangrando.Visible = true
else
Sangrando.Visible = false
end
end
end
end
end) |
-- ONLY SUPPORTS ORDINAL TABLES (ARRAYS). Takes the range of entries in this table in the range [start, finish] and returns that range as a table. |
Table.range = function (tbl, start, finish)
return table.move(tbl, start, finish, 1, table.create(finish - start + 1))
end
|
--[[
This loads HD Admin into your game.
Require the 'HD Admin Main Module' by ForeverHD for automatic updates.
You can view the HD Admin Main Module here:
https://www.roblox.com/library/2686494999/HD-Admin-Main-Module
--]] |
local loaderFolder = script.Parent.Parent
local mainModule = require(2686494999)
mainModule:Initialize(loaderFolder)
loaderFolder:Destroy()
|
--[=[
@within TableUtil
@function IsEmpty
@param tbl table
@return boolean
Returns `true` if the given table is empty. This is
simply performed by checking if `next(tbl)` is `nil`
and works for both arrays and dictionaries. This is
useful when needing to check if a table is empty but
not knowing if it is an array or dictionary.
```lua
TableUtil.IsEmpty({}) -- true
TableUtil.IsEmpty({"abc"}) -- false
TableUtil.IsEmpty({abc = 32}) -- false
```
]=] |
local function IsEmpty(tbl)
return next(tbl) == nil
end
|
--- Cleans up all tasks |
function Maid:DoCleaning()
local Tasks = self.Tasks
-- Disconnect all events first as we know this is safe
for Index, Task in pairs(Tasks) do
if typeof(Task) == "RBXScriptConnection" then
Tasks[Index] = nil
Task:disconnect()
end
end
-- Clear out tasks table completely, even if clean up tasks add more tasks to the maid
local Index, Task = next(Tasks)
while Task ~= nil do
Tasks[Index] = nil
if type(Task) == "function" then
Task()
elseif typeof(Task) == "RBXScriptConnection" then
Task:disconnect()
elseif Task.Destroy then
Task:Destroy()
elseif Task.destroy then
Task:destroy()
elseif Task.disconnect then -- for pseudo RBXScriptConnection
Task:disconnect()
end
Index, Task = next(Tasks)
end
end
Maid.Destroy = Maid.DoCleaning
return Maid
|
-- If you want to change the hat that you are trying on, change the "Mesh" Just delete the one in the brick that this script is in,
-- and copy a mesh from a different hat, that you want to try on with this script. | |
--//trunk |
local tk = Instance.new("Motor", script.Parent.Parent.Misc.TK.SS)
tk.MaxVelocity = 0.02
tk.Part0 = script.Parent.TK
tk.Part1 = tk.Parent
|
--Fix network issues |
for i,v in ipairs(script.Parent:GetDescendants()) do
if v:IsA("BasePart") and v:CanSetNetworkOwnership() == true then
v:SetNetworkOwner(nil)
end
end
|
-- Local private variables and constants |
local UNIT_Z = Vector3.new(0,0,1)
local X1_Y0_Z1 = Vector3.new(1,0,1) --Note: not a unit vector, used for projecting onto XZ plane
local ZERO_VECTOR3 = Vector3.new(0,0,0)
local ZERO_VECTOR2 = Vector2.new(0,0)
local TAU = 2 * math.pi
|
--[[Engine]]
--Torque Curve |
Tune.Horsepower = 265 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6980 -- Use sliders to manipulate values
Tune.Redline = 8000 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
|
--[[
Helper functions
]] |
local random = Random.new()
local function getRandomPointInCircle(centerPosition, circleRadius)
local radius = math.sqrt(random:NextNumber()) * circleRadius
local angle = random:NextNumber(0, math.pi * 2)
local x = centerPosition.X + radius * math.cos(angle)
local z = centerPosition.Z + radius * math.sin(angle)
local position = Vector3.new(x, centerPosition.Y, z)
return position
end
|
----- Private variables ----- |
local FreeRunnerThread = nil
|
-- Setup animation objects |
function scriptChildModified(child)
local fileList = animNames[child.Name]
if (fileList ~= nil) then
configureAnimationSet(child.Name, fileList)
end
end
script.ChildAdded:connect(scriptChildModified)
script.ChildRemoved:connect(scriptChildModified)
for name, fileList in pairs(animNames) do
configureAnimationSet(name, fileList)
end
|
--[[**
ensures value is NaN
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]] |
function t.nan(value)
if value ~= value then
return true
else
return false, "unexpected non-NaN value"
end
end
|
-- elseif input.UserInputType == self.activeGamepad and input.KeyCode == Enum.KeyCode.ButtonL3 then
-- if (state == Enum.UserInputState.Begin) then
-- self.L3ButtonDown = true
-- elseif (state == Enum.UserInputState.End) then
-- self.L3ButtonDown = false
-- self.currentZoomSpeed = 1.00
-- end
-- end |
end
function BaseCamera:DoKeyboardZoom(name, state, input)
if not self.hasGameLoaded and VRService.VREnabled then
return Enum.ContextActionResult.Pass
end
if state ~= Enum.UserInputState.Begin then
return Enum.ContextActionResult.Pass
end
if self.distanceChangeEnabled and Players.LocalPlayer.CameraMode ~= Enum.CameraMode.LockFirstPerson then
if input.KeyCode == Enum.KeyCode.I then
self:SetCameraToSubjectDistance( self.currentSubjectDistance - 5 )
elseif input.KeyCode == Enum.KeyCode.O then
self:SetCameraToSubjectDistance( self.currentSubjectDistance + 5 )
end
return Enum.ContextActionResult.Sink
end
return Enum.ContextActionResult.Pass
end
function BaseCamera:BindAction(actionName, actionFunc, createTouchButton, ...)
table.insert(self.boundContextActions, actionName)
ContextActionService:BindActionAtPriority(actionName, actionFunc, createTouchButton,
CAMERA_ACTION_PRIORITY, ...)
end
function BaseCamera:BindGamepadInputActions()
self:BindAction("BaseCameraGamepadPan", function(name, state, input) return self:GetGamepadPan(name, state, input) end,
false, Enum.KeyCode.Thumbstick2)
self:BindAction("BaseCameraGamepadZoom", function(name, state, input) return self:DoGamepadZoom(name, state, input) end,
false, Enum.KeyCode.DPadLeft, Enum.KeyCode.DPadRight, Enum.KeyCode.ButtonR3)
end
function BaseCamera:BindKeyboardInputActions()
self:BindAction("BaseCameraKeyboardPanArrowKeys", function(name, state, input) return self:DoKeyboardPanTurn(name, state, input) end,
false, Enum.KeyCode.Left, Enum.KeyCode.Right)
self:BindAction("BaseCameraKeyboardPan", function(name, state, input) return self:DoKeyboardPan(name, state, input) end,
false, Enum.KeyCode.Comma, Enum.KeyCode.Period, Enum.KeyCode.PageUp, Enum.KeyCode.PageDown)
self:BindAction("BaseCameraKeyboardZoom", function(name, state, input) return self:DoKeyboardZoom(name, state, input) end,
false, Enum.KeyCode.I, Enum.KeyCode.O)
end
local function isInDynamicThumbstickArea(input)
local playerGui = Players.LocalPlayer:FindFirstChildOfClass("PlayerGui")
local touchGui = playerGui and playerGui:FindFirstChild("TouchGui")
local touchFrame = touchGui and touchGui:FindFirstChild("TouchControlFrame")
local thumbstickFrame = touchFrame and touchFrame:FindFirstChild("DynamicThumbstickFrame")
if not thumbstickFrame then
return false
end
local frameCornerTopLeft = thumbstickFrame.AbsolutePosition
local frameCornerBottomRight = frameCornerTopLeft + thumbstickFrame.AbsoluteSize
if input.Position.X >= frameCornerTopLeft.X and input.Position.Y >= frameCornerTopLeft.Y then
if input.Position.X <= frameCornerBottomRight.X and input.Position.Y <= frameCornerBottomRight.Y then
return true
end
end
return false
end
|
--[=[
@param fn (...: any) -> ()
@return Connection
Connects a function to the remote signal. The function will be
called anytime the equivalent server-side RemoteSignal is
fired at this specific client that created this client signal.
]=] |
function ClientRemoteSignal:Connect(fn: (...any) -> ())
if self._directConnect then
return self._re.OnClientEvent:Connect(fn)
else
return self._signal:Connect(fn)
end
end
|
-- Sets the position of the falling object
-- This function checks if the object is a Part or a Model, as those are positioned differently |
local function positionFallingObject(object)
local objectCFrame = getRandomCFrameInVolume(dropZone)
if object:IsA("BasePart") then
object.CFrame = objectCFrame
elseif object:IsA("Model") then
if not object.PrimaryPart then
object.PrimaryPart = object:FindFirstChildWhichIsA("BasePart", true)
end
object.PrimaryPart.CFrame = objectCFrame
end
object.Parent = game.Workspace
end
|
-- In radians the minimum accuracy penalty |
local MinSpread = 0.001 |
-- Services |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local Players = game:GetService("Players")
local CollectionService = game:GetService("CollectionService")
local Conf = require(ReplicatedFirst.Configurations.MainConfiguration)
local Util = require(ReplicatedStorage.Libraries.Util)
local MatchmakingDestination = require(ReplicatedStorage.Libraries.MatchmakingDestination)
local WeaponsSystem = require(ReplicatedStorage.WeaponsSystem.WeaponsSystem)
local DamageHandler = require(ReplicatedStorage.Core.DamageHandler)
|
-- The next configurations are ONLY for Roblox Ad Boards. |
config.OffButtonEnabled = true -- If the turn off boards button is displayed.
config.EvacuateButtonEnabled = true -- If the evacuate button is displayed.
config.AdvertisementButtonEnabled = true -- If the Advertisement button is displayed. |
--and now BLINKERS!!!! |
function left()
FL.Material = "Neon"
RL.Material = "Neon"
end
function unleft()
FL.Material = "SmoothPlastic"
RL.Material = "SmoothPlastic"
end
function right()
FR.Material = "Neon"
RR.Material = "Neon"
end
function unright()
FR.Material = "SmoothPlastic"
RR.Material = "SmoothPlastic"
end
while true do
wait(0.2)--no crash m8!!!
--
if seat.Lights.Value == true then --lights
lightson()
else
lightsoff()
end
--
if seat.dGear.Value == "R" then --reverse lights
reverse()
else
unreverse()
end
--
if seat.Parent.Throttle == -1 then
brake()
else
unbrake()
end
--and now... BLINKERS!!!
if seat.Blinked.Value == true then
if seat.BLeft.Value == true then
left()
else
unleft()
end
if seat.BRight.Value == true then
right()
else
unright()
end
else
unright()
unleft()
end
end
|
------------------------------------------------------------------------------------------------------------------------------------------------ |
if script.Parent:FindFirstChild("Arm1") then
local g = script.Parent.Arm1:Clone()
g.Parent = File
for _,i in pairs(g:GetChildren()) do
if i:IsA("Part") or i:IsA("UnionOperation") or i:IsA("MeshPart") then
i.CanCollide = false
i.Anchored = false
local Y = Instance.new("Weld")
Y.Part0 = Player.Character["Left Arm"]
Y.Part1 = g.Middle
Y.C0 = CFrame.new(0, 0, 0)
Y.Parent = Player.Character["Left Arm"]
end
end
end |
-- map a value from one range to another |
local function map(x, inMin, inMax, outMin, outMax)
return (x - inMin)*(outMax - outMin)/(inMax - inMin) + outMin
end
local function playSound(sound)
sound.TimePosition = 0
sound.Playing = true
end
local function shallowCopy(t)
local out = {}
for k, v in pairs(t) do
out[k] = v
end
return out
end
local function initializeSoundSystem(player, humanoid, rootPart)
local sounds = {}
-- initialize sounds
for name, props in pairs(SOUND_DATA) do
local sound = Instance.new("Sound")
sound.Name = name
-- set default values
sound.Archivable = false
sound.EmitterSize = 5
sound.MaxDistance = 150
sound.Volume = 0
for propName, propValue in pairs(props) do
sound[propName] = propValue
end
sound.Parent = rootPart
sounds[name] = sound
end
local playingLoopedSounds = {}
local function stopPlayingLoopedSounds(except)
for sound in pairs(shallowCopy(playingLoopedSounds)) do
if sound ~= except then
sound.Playing = false
playingLoopedSounds[sound] = nil
end
end
end
-- state transition callbacks
local stateTransitions = {
[Enum.HumanoidStateType.FallingDown] = function()
stopPlayingLoopedSounds()
end,
[Enum.HumanoidStateType.GettingUp] = function()
stopPlayingLoopedSounds()
playSound(sounds.GettingUp)
end,
[Enum.HumanoidStateType.Jumping] = function()
stopPlayingLoopedSounds()
playSound(sounds.Jumping)
end,
[Enum.HumanoidStateType.Swimming] = function()
local verticalSpeed = math.abs(rootPart.Velocity.Y)
if verticalSpeed > 0.1 then
sounds.Splash.Volume = math.clamp(map(verticalSpeed, 100, 350, 0.28, 1), 0, 1)
playSound(sounds.Splash)
end
stopPlayingLoopedSounds(sounds.Swimming)
sounds.Swimming.Playing = true
playingLoopedSounds[sounds.Swimming] = true
end,
[Enum.HumanoidStateType.Freefall] = function()
sounds.FreeFalling.Volume = 0
stopPlayingLoopedSounds(sounds.FreeFalling)
playingLoopedSounds[sounds.FreeFalling] = true
end,
[Enum.HumanoidStateType.Landed] = function()
stopPlayingLoopedSounds()
local verticalSpeed = math.abs(rootPart.Velocity.Y)
if verticalSpeed > 75 then
sounds.Landing.Volume = math.clamp(map(verticalSpeed, 50, 100, 0, 1), 0, 1)
playSound(sounds.Landing)
end
end,
[Enum.HumanoidStateType.Running] = function()
stopPlayingLoopedSounds(sounds.Running)
sounds.Running.Playing = true
playingLoopedSounds[sounds.Running] = true
end,
[Enum.HumanoidStateType.Climbing] = function()
local sound = sounds.Climbing
if math.abs(rootPart.Velocity.Y) > 0.1 then
sound.Playing = true
stopPlayingLoopedSounds(sound)
else
stopPlayingLoopedSounds()
end
playingLoopedSounds[sound] = true
end,
[Enum.HumanoidStateType.Seated] = function()
stopPlayingLoopedSounds()
end,
[Enum.HumanoidStateType.Dead] = function()
stopPlayingLoopedSounds()
playSound(sounds.Died)
end,
}
-- updaters for looped sounds
local loopedSoundUpdaters = {
[sounds.Climbing] = function(dt, sound, vel)
sound.Playing = vel.Magnitude > 0.1
end,
[sounds.FreeFalling] = function(dt, sound, vel)
if vel.Magnitude > 75 then
sound.Volume = math.clamp(sound.Volume + 0.9*dt, 0, 1)
else
sound.Volume = 0
end
end,
[sounds.Running] = function(dt, sound, vel)
sound.Playing = vel.Magnitude > 0.5 and humanoid.MoveDirection.Magnitude > 0.5
end,
}
-- state substitutions to avoid duplicating entries in the state table
local stateRemap = {
[Enum.HumanoidStateType.RunningNoPhysics] = Enum.HumanoidStateType.Running,
}
local activeState = stateRemap[humanoid:GetState()] or humanoid:GetState()
local stateChangedConn = humanoid.StateChanged:Connect(function(_, state)
state = stateRemap[state] or state
if state ~= activeState then
local transitionFunc = stateTransitions[state]
if transitionFunc then
transitionFunc()
end
activeState = state
end
end)
local steppedConn = RunService.Stepped:Connect(function(_, worldDt)
-- update looped sounds on stepped
for sound in pairs(playingLoopedSounds) do
local updater = loopedSoundUpdaters[sound]
if updater then
updater(worldDt, sound, rootPart.Velocity)
end
end
end)
local humanoidAncestryChangedConn
local rootPartAncestryChangedConn
local characterAddedConn
local function terminate()
stateChangedConn:Disconnect()
steppedConn:Disconnect()
humanoidAncestryChangedConn:Disconnect()
rootPartAncestryChangedConn:Disconnect()
characterAddedConn:Disconnect()
end
humanoidAncestryChangedConn = humanoid.AncestryChanged:Connect(function(_, parent)
if not parent then
terminate()
end
end)
rootPartAncestryChangedConn = rootPart.AncestryChanged:Connect(function(_, parent)
if not parent then
terminate()
end
end)
characterAddedConn = player.CharacterAdded:Connect(terminate)
end
local function playerAdded(player)
local function characterAdded(character)
-- Avoiding memory leaks in the face of Character/Humanoid/RootPart lifetime has a few complications:
-- * character deparenting is a Remove instead of a Destroy, so signals are not cleaned up automatically.
-- ** must use a waitForFirst on everything and listen for hierarchy changes.
-- * the character might not be in the dm by the time CharacterAdded fires
-- ** constantly check consistency with player.Character and abort if CharacterAdded is fired again
-- * Humanoid may not exist immediately, and by the time it's inserted the character might be deparented.
-- * RootPart probably won't exist immediately.
-- ** by the time RootPart is inserted and Humanoid.RootPart is set, the character or the humanoid might be deparented.
if not character.Parent then
waitForFirst(character.AncestryChanged, player.CharacterAdded)
end
if player.Character ~= character or not character.Parent then
return
end
local humanoid = character:FindFirstChildOfClass("Humanoid")
while character:IsDescendantOf(game) and not humanoid do
waitForFirst(character.ChildAdded, character.AncestryChanged, player.CharacterAdded)
humanoid = character:FindFirstChildOfClass("Humanoid")
end
if player.Character ~= character or not character:IsDescendantOf(game) then
return
end
-- must rely on HumanoidRootPart naming because Humanoid.RootPart does not fire changed signals
local rootPart = character:FindFirstChild("HumanoidRootPart")
while character:IsDescendantOf(game) and not rootPart do
waitForFirst(character.ChildAdded, character.AncestryChanged, humanoid.AncestryChanged, player.CharacterAdded)
rootPart = character:FindFirstChild("HumanoidRootPart")
end
if rootPart and humanoid:IsDescendantOf(game) and character:IsDescendantOf(game) and player.Character == character then
initializeSoundSystem(player, humanoid, rootPart)
end
end
if player.Character then
characterAdded(player.Character)
end
player.CharacterAdded:Connect(characterAdded)
end
Players.PlayerAdded:Connect(playerAdded)
for _, player in ipairs(Players:GetPlayers()) do
playerAdded(player)
end
|
--Get the datastore. |
local PlayersItems = game:GetService("DataStoreService"):GetDataStore("Items")
|
-- << SETUP >> |
for _,revent in pairs(main.signals:GetChildren()) do
if revent:IsA("RemoteEvent") then
revent.OnClientEvent:Connect(function(args)
if not main.initialized then main.client.Signals.Initialized.Event:Wait() end
---------------------------------------------
if revent.Name == "ChangeStat" then
local statName, newValue = args[1], args[2]
main.pdata[statName] = newValue
if statName == "Donor" then
main:GetModule("PageSpecial"):UpdateDonorFrame()
end
elseif revent.Name == "InsertStat" then
local locationName, newValue = args[1], args[2]
table.insert(main.pdata[locationName], newValue)
elseif revent.Name == "RemoveStat" then
local locationName, newValue = args[1], args[2]
for i,v in pairs(main.pdata[locationName]) do
if tostring(v) == tostring(newValue) then
table.remove(main.pdata[locationName], i)
break
end
end
elseif revent.Name == "Notice" or revent.Name == "Error" then
main:GetModule("Notices"):Notice(revent.Name, args[1], args[2], args[3])
elseif revent.Name == "ShowPage" then
main:GetModule("GUIs"):ShowSpecificPage(args[1], args[2])
elseif revent.Name == "ShowBannedUser" then
main:GetModule("GUIs"):ShowSpecificPage("Admin", "Banland")
if type(args) == "table" then
main:GetModule("cf"):ShowBannedUser(args)
end
elseif revent.Name == "SetCameraSubject" then
main:GetModule("cf"):SetCameraSubject(args)
elseif revent.Name == "Clear" then
main:GetModule("Messages"):ClearMessageContainer()
elseif revent.Name == "ShowWarning" then
main:GetModule("cf"):ShowWarning(args)
elseif revent.Name == "Message" then
main:GetModule("Messages"):Message(args)
elseif revent.Name == "Hint" then
main:GetModule("Messages"):Hint(args)
elseif revent.Name == "GlobalAnnouncement" then
main:GetModule("Messages"):GlobalAnnouncement(args)
elseif revent.Name == "SetCoreGuiEnabled" then
main.starterGui:SetCoreGuiEnabled(Enum.CoreGuiType[args[1]], args[2])
elseif revent.Name == "CreateLog" then
main:GetModule("cf"):CreateNewCommandMenu(args[1], args[2], 5)
elseif revent.Name == "CreateAlert" then
main:GetModule("cf"):CreateNewCommandMenu("alert", {args[1], args[2]}, 8, true)
elseif revent.Name == "CreateBanMenu" then
main:GetModule("cf"):CreateNewCommandMenu("banMenu", args, 6)
elseif revent.Name == "CreatePollMenu" then
main:GetModule("cf"):CreateNewCommandMenu("pollMenu", args, 9)
elseif revent.Name == "CreateMenu" then
main:GetModule("cf"):CreateNewCommandMenu(args.MenuName, args.Data, args.TemplateId)
elseif revent.Name == "CreateCommandMenu" then
local title = args[1]
local details = args[2]
local menuType = args[3]
main:GetModule("cf"):CreateNewCommandMenu(title, details, menuType)
elseif revent.Name == "RankChanged" then
main:GetModule("cf"):UpdateIconVisiblity()
main:GetModule("PageAbout"):UpdateRankName()
main:GetModule("GUIs"):DisplayPagesAccordingToRank(true)
if main.initialized then
main:GetModule("PageCommands"):CreateCommands()
end
elseif revent.Name == "ExecuteClientCommand" then
local speaker, args, commandName, other = args[1], args[2], args[3], args[4]
local unFunction = other.UnFunction
local functionType = "Function"
if unFunction then
functionType = "UnFunction"
end
local clientCommand = main:GetModule("ClientCommands")[commandName]
if clientCommand then
local Function = clientCommand[functionType]
if Function then
Function(speaker, args, clientCommand)
end
end
elseif revent.Name == "ReplicationEffectClientCommand" then
local commandName = args[1]
local speaker = args[2]
local rArgs = args[3]
local clientCommand = main:GetModule("ClientCommands")[commandName]
if clientCommand then
local replicationEffect = clientCommand.ReplicationEffect
if replicationEffect then
replicationEffect(speaker, rArgs, clientCommand)
end
end
elseif revent.Name == "ActivateClientCommand" then
local commandName = args[1]
local extraDetails = args[2]
--Custom speed
local speed = extraDetails and ((extraDetails.Speed ~= 0 and extraDetails.Speed) or nil)
if speed then
main.commandSpeeds[commandName] = speed
local oldMenu = main.gui:FindFirstChild("CommandMenufly")
main:GetModule("cf"):DestroyCommandMenuFrame(oldMenu)
end
--Deactivate other flight commands
if main.commandSpeeds[commandName] then
for otherCommandName, _ in pairs(main.commandSpeeds) do
if otherCommandName ~= commandName then
main:GetModule("cf"):DeactivateCommand(otherCommandName)
end
end
end
--Activate command
main.commandsAllowedToUse[commandName] = true
main:GetModule("cf"):ActivateClientCommand(commandName, extraDetails)
--Setup command menu
local menuDetails, menuType
for menuTypeName, menuCommands in pairs(main.commandsWithMenus) do
menuDetails = menuCommands[commandName]
if menuDetails then
menuType = tonumber(menuTypeName:match("%d+"))
break
end
end
if menuDetails then
main:GetModule("cf"):CreateNewCommandMenu(commandName, menuDetails, menuType)
end
elseif revent.Name == "DeactivateClientCommand" then
main:GetModule("cf"):DeactivateCommand(args[1])
elseif revent.Name == "FadeInIcon" then
local topBarFrame = main.gui.CustomTopBar
local imageButton = topBarFrame.ImageButton
imageButton.ImageTransparency = 1
main.tweenService:Create(imageButton, TweenInfo.new(1), {ImageTransparency = 0}):Play()
elseif revent.Name == "ChangeMainVariable" then
main[args[1]] = args
end
---------------------------------------------
end)
elseif revent:IsA("RemoteFunction") then
function revent.OnClientInvoke(args)
if not main.initialized then main.client.Signals.Initialized.Event:Wait() end
---------------------------------------------
if revent.Name == "GetLocalDate" then
return os.date("*t", args)
end
end
end
end
return module
|
-- Returns the current angle being used
-- by Roblox's shadow mapping system. |
function FpsCamera:GetShadowAngle()
local angle = Lighting:GetSunDirection()
if angle.Y < -0.3 then
-- Use the moon's angle instead.
angle = Lighting:GetMoonDirection()
end
return angle
end
|
--!strict
-- upstream: https://github.com/facebook/react/blob/a457e02ae3a2d3903fcf8748380b1cc293a2445e/packages/react/src/IsSomeRendererActing.js
--[[*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
]] | |
--end
--End of Function KeyDown() |
function KU(key)
key = key:lower()
if(key == "d") then
faster = false
wait(.1)
faster = false
end
if(key == "a") then
slower = false
wait(.1)
slower = false
end
if(key == "w") then
uper = false
wait(.1)
uper = false
end
if(key == "s") then
downer = false
wait(.1)
downer = false
end
if(key == "t") then
minigun_shoot = false
end
if(key == "z") then
show_ammo = false
end
if(key == "q") then
startLock = false
end |
--[[
Returns first value (success), and packs all following values.
]] |
local function packResult(success, ...)
return success, select("#", ...), { ... }
end
local function makeErrorHandler(traceback)
assert(traceback ~= nil, "traceback is nil")
return function(err)
-- If the error object is already a table, forward it directly.
-- Should we extend the error here and add our own trace?
if type(err) == "table" then
return err
end
return Error.new({
error = err,
kind = Error.Kind.ExecutionError,
trace = debug.traceback(tostring(err), 2),
context = "Promise created at:\n\n" .. traceback,
})
end
end
|
--PARÁMETROS |
local parada = script.Parent.Parent.Parada.Value --TIEMPO DE PARADA
|
-- / Player / -- |
local PlayerGui = MainGui.Parent
local Player = PlayerGui.Parent
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local PlayerStats = Player:WaitForChild("PlayerStats")
local Oxygen = PlayerStats:WaitForChild("Oxygen")
-- / Game Assets / --
local GameAssets = game.ServerStorage.GameAssets
|
-- Convenience function so that calling code does not have to first get the activeController
-- and then call GetMoveVector on it. When there is no active controller, this function returns the
-- zero vector |
function ControlModule:GetMoveVector(): Vector3
if self.activeController then
return self.activeController:GetMoveVector()
end
return Vector3.new(0,0,0)
end
function ControlModule:GetActiveController()
return self.activeController
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.