prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
---------------
-- Constants --
--------------- |
local FADE_TARGET = 0.75
local FADE_RATE = 0.1
local MODE = {
CUSTOM = 1, -- Whatever you want!
LIMBS = 2, -- Track limbs
MOVEMENT = 3, -- Track movement
CORNERS = 4, -- Char model corners
CIRCLE1 = 5, -- Circle of casts around character
CIRCLE2 = 6, -- Circle of casts around character, camera relative
LIMBMOVE = 7, -- LIMBS mode + MOVEMENT mode
}
Invisicam.MODE = MODE
local STARTING_MODE = MODE.LIMBS
local LIMB_TRACKING_SET = {
['Head'] = true,
['Left Arm'] = true,
['Right Arm'] = true,
['Left Leg'] = true,
['Right Leg'] = true,
['LeftLowerArm'] = true,
['RightLowerArm'] = true,
['LeftLowerLeg'] = true,
['RightLowerLeg'] = true
}
local CORNER_FACTORS = {
Vector3.new(1, 1, -1),
Vector3.new(1, -1, -1),
Vector3.new(-1, -1, -1),
Vector3.new(-1, 1, -1)
}
local CIRCLE_CASTS = 10
local MOVE_CASTS = 3
|
--wr2.MaxVelocity = 0.007
--wr2.Part0 = script.Parent.Parent.Misc.RR.Door.WD
--wr2.Part1 = wr2.Parent |
sw.MaxVelocity = 0.1
sw.Part0 = script.Parent.SW
sw.Part1 = sw.Parent
TK.MaxVelocity = 0.03
TK.Part0 = script.Parent.TK
TK.Part1 = TK.Parent
|
-------- OMG HAX |
r = game:service("RunService")
local damage = 10
local slash_damage = 12
local lunge_damage = 24
sword = script.Parent.Handle
Tool = script.Parent
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "http://www.roblox.com/asset/?id=11998777"
SlashSound.Parent = sword
local LungeSound = Instance.new("Sound")
LungeSound.SoundId = "http://www.roblox.com/asset/?id=11998796"
LungeSound.Parent = sword
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "http://www.roblox.com/asset/?id=11998770"
UnsheathSound.Parent = sword
function blow(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
tagHumanoid(humanoid, vPlayer)
humanoid:TakeDamage(damage)
wait(1)
untagHumanoid(humanoid)
end
end
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
SlashSound:play()
Tool.Parent.Torso["Right Shoulder"].MaxVelocity = 0.7
Tool.Parent.Torso["Right Shoulder"].DesiredAngle = 3.6
wait(.1)
Tool.Parent.Torso["Right Shoulder"].MaxVelocity = 1
end
function lunge()
damage = lunge_damage
LungeSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Lunge"
anim.Parent = Tool
local force = Instance.new("BodyVelocity")
force.velocity = Vector3.new(0,80,0)
force.Parent = Tool.Parent.Torso
wait(.25)
force.velocity = (Tool.Parent.Torso.CFrame.lookVector * 160) + Vector3.new(0, 60,0)
--swordOut()
wait(.5)
force.Parent = nil
wait(.5)
--swordUp()
damage = slash_damage
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
function swordAcross()
-- parry
end
Tool.Enabled = true
local last_attack = 0
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
t = r.Stepped:wait()
if (t - last_attack < .2) then
lunge()
else
attack()
end
last_attack = t
--wait(.5)
Tool.Enabled = true
end
function onEquipped()
UnsheathSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
--Made by Luckymaxer |
Debris = game:GetService("Debris")
Character = script.Parent
Humanoid = Character:FindFirstChild("Humanoid")
Duration = script:FindFirstChild("Duration")
Rate = (1 / 60)
function DestroyScript()
Debris:AddItem(script, 0.5)
script:Destroy()
end
if not Humanoid or Humanoid.Health == 0 or not Duration or Duration.Value <= 0 then
DestroyScript()
return
end
while Humanoid.Health > 0 and Duration.Value > 0 do
if Humanoid then
Humanoid.WalkSpeed = 6
end
local Time = wait(Rate)
Duration.Value = (Duration.Value - Time)
end
if Humanoid then
Humanoid.WalkSpeed = 16
end
DestroyScript()
|
------------------------------------------------------------ |
local TwinService = game:GetService("TweenService")
local AnimationHighLight = TweenInfo.new(1.5, Enum.EasingStyle.Sine ,Enum.EasingDirection.InOut)
local Info1 = {Position = Vector3.new(pos1,Positionn,pos3)}
local Info2 = {Position = Vector3.new(pos1,Positionn2,pos3)}
local AnimkaUp = TwinService:Create(Danger, AnimationHighLight, Info1 )
local AnimkaDown = TwinService:Create(Danger, AnimationHighLight, Info2 )
while true do
AnimkaUp:Play()
wait(1.5)
AnimkaDown:Play()
wait(1.5)
end
|
--Stickmasterluke |
sp=script.Parent
framerate=30
frames=1
running=false
direction=1
function waitForChild(instance,name)
while not instance:FindFirstChild(name) do
instance.ChildAdded:wait()
end
end
waitForChild(sp,"Bottom")
waitForChild(sp.Bottom,"OpenDoor")
waitForChild(sp.Bottom,"Configuration")
function checkframes()
if sp:FindFirstChild("Bottom") then
local config=sp.Bottom:FindFirstChild("Configuration")
if config then
frames=math.floor(config.TimeToMove.Value*framerate)+1
end
end
end
sp.Bottom.Configuration.TimeToMove.Changed:connect(checkframes)
checkframes()
function updatedoor(frame)
local percentage=frame/frames
if sp:FindFirstChild("Bottom") then
local hingedist=1.9
local hinge1=sp.Bottom:FindFirstChild("Door1")
if hinge1~=nil then
hinge1.C1=CFrame.new(-hingedist,-hingedist,0)*CFrame.Angles(0,0,(math.pi/2)*percentage)*CFrame.new(hingedist,hingedist,0)
end
local hinge1=sp.Bottom:FindFirstChild("Door2")
if hinge1~=nil then
hinge1.C1=CFrame.new(-hingedist,hingedist,0)*CFrame.Angles(0,0,(math.pi/2)*percentage)*CFrame.new(hingedist,-hingedist,0)
end
local hinge1=sp.Bottom:FindFirstChild("Door3")
if hinge1~=nil then
hinge1.C1=CFrame.new(hingedist,hingedist,0)*CFrame.Angles(0,0,(math.pi/2)*percentage)*CFrame.new(-hingedist,-hingedist,0)
end
local hinge1=sp.Bottom:FindFirstChild("Door4")
if hinge1~=nil then
hinge1.C1=CFrame.new(hingedist,-hingedist,0)*CFrame.Angles(0,0,(math.pi/2)*percentage)*CFrame.new(-hingedist,hingedist,0)
end
end
end
function runloop()
if not running then
running=true
while true do
if sp:FindFirstChild("Bottom") then
local frame=sp.Bottom:FindFirstChild("Frame")
if frame then
frame.Value=frame.Value+direction
if frame.Value>frames then
frame.Value=frames
end
if frame.Value<=0 then
frame.Value=0
end
updatedoor(frame.Value)
wait(1/framerate)
if frame then
if (frame.Value<=0 and direction==-1) or (frame.Value>=frames and direction==1) then
break
end
end
else
break
end
else
break
end
end
running=false
end
end
function check(val)
if val>.5 then
direction=1
else
direction=-1
end
runloop()
end
sp.Bottom.OpenDoor.SourceValueChanged:connect(check)
check(sp.Bottom.OpenDoor:GetCurrentValue())
|
--[[if CurrentX >= SlowdownPoint then
local Multiplier = Start/End;
Speed = 20 * (1 - Multiplier);
if Speed < 1 then
Speed = 1;
end
end]] | |
-- © Native Lighting & NativeFX, All Rights Reserved, Do not edit or distribute. | |
-- Make the HotbarFrame, which holds only the Hotbar Slots |
HotbarFrame = NewGui('Frame', 'Hotbar')
HotbarFrame.BackgroundTransparency = 0.7
local grad = script.UIGradient:Clone()
grad.Parent = HotbarFrame
HotbarFrame.Parent = MainFrame
|
--------SIDE SQUARES-------- |
game.Workspace.sidesquares.l11.BrickColor = BrickColor.new(1023)
game.Workspace.sidesquares.l12.BrickColor = BrickColor.new(1023)
game.Workspace.sidesquares.l21.BrickColor = BrickColor.new(1023)
game.Workspace.sidesquares.l31.BrickColor = BrickColor.new(1023)
game.Workspace.rightpalette.l11.BrickColor = BrickColor.new(1023)
game.Workspace.rightpalette.l12.BrickColor = BrickColor.new(1023)
game.Workspace.rightpalette.l21.BrickColor = BrickColor.new(1023)
game.Workspace.rightpalette.l22.BrickColor = BrickColor.new(1023)
game.Workspace.sidesquares.l13.BrickColor = BrickColor.new(106)
game.Workspace.sidesquares.l23.BrickColor = BrickColor.new(106)
game.Workspace.sidesquares.l33.BrickColor = BrickColor.new(106)
game.Workspace.sidesquares.l34.BrickColor = BrickColor.new(106)
game.Workspace.rightpalette.l13.BrickColor = BrickColor.new(106)
game.Workspace.rightpalette.l23.BrickColor = BrickColor.new(106)
game.Workspace.rightpalette.l14.BrickColor = BrickColor.new(106)
game.Workspace.rightpalette.l24.BrickColor = BrickColor.new(106)
game.Workspace.sidesquares.l14.BrickColor = BrickColor.new(1013)
game.Workspace.sidesquares.l15.BrickColor = BrickColor.new(1013)
game.Workspace.sidesquares.l24.BrickColor = BrickColor.new(1013)
game.Workspace.sidesquares.l25.BrickColor = BrickColor.new(1013)
game.Workspace.sidesquares.l35.BrickColor = BrickColor.new(1013)
game.Workspace.rightpalette.l15.BrickColor = BrickColor.new(1013)
game.Workspace.rightpalette.l25.BrickColor = BrickColor.new(1013)
game.Workspace.rightpalette.l16.BrickColor = BrickColor.new(1013)
game.Workspace.rightpalette.l26.BrickColor = BrickColor.new(1013)
|
-- Function to preload audio assets |
AudioPlayer.preloadAudio = function(assetArray)
local audioAssets = {}
-- Add new "Sound" assets to "audioAssets" array
for name, audioID in pairs(assetArray) do
local audioInstance = Instance.new("Sound")
audioInstance.SoundId = "rbxassetid://" .. audioID
audioInstance.Name = name
audioInstance.Parent = SoundService
table.insert(audioAssets, audioInstance)
end
local success, assets = pcall(function()
ContentProvider:PreloadAsync(audioAssets)
end)
end
|
-- KEYBINDS HERE |
local bind1 = Enum.KeyCode.LeftShift -- This is the keybind this script is set to by default
local bind2 = Enum.KeyCode.RightShift -- This is the second keybind this script is set to by default
|
--BasedWeld2.0 |
function MakeWeld(x,y,type,s)
local W=Instance.new(type)
W.Part0=x W.Part1=y
W.C0=x.CFrame:inverse()*x.CFrame
W.C1=y.CFrame:inverse()*x.CFrame
W.Parent=x
if type=="Motor" and s~=nil then
W.MaxVelocity=s
end
return W
end
function ModelWeld(a,b)
if a:IsA("BasePart") then
MakeWeld(b,a,"Weld")
elseif a:IsA("Model") then
for i,v in pairs(a:GetChildren()) do
ModelWeld(v,b)
end
end
end
function UnAnchor(a)
if a:IsA("BasePart") then a.Anchored=false elseif a:IsA("Model") then for i,v in pairs(a:GetChildren()) do UnAnchor(v) end end
end |
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 580 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 4.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
-- Variables |
local b_close = script.Parent
local tpMenu = script.Parent.Parent
|
--- Connect a new handler to the event. Returns a connection object that can be disconnected.
-- @tparam function handler Function handler called with arguments passed when `:Fire(...)` is called
-- @treturn Connection Connection object that can be disconnected |
function Signal:Connect(handler)
if not (type(handler) == "function") then
error(("connect(%s)"):format(typeof(handler)), 2)
end
return self._bindableEvent.Event:Connect(function()
handler(unpack(self._argData, 1, self._argCount))
end)
end
|
--Rescripted by Luckymaxer |
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Mesh = Handle:WaitForChild("Mesh")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RbxUtility = LoadLibrary("RbxUtility")
Create = RbxUtility.Create
BaseUrl = "http://www.roblox.com/asset/?id="
Meshes = {
GrappleWithHook = 33393806,
Grapple = 30308256,
Hook = 30307623,
}
Animations = {
Crouch = {Animation = Tool:WaitForChild("Crouch"), FadeTime = 0.25, Weight = nil, Speed = nil},
}
Sounds = {
Fire = Handle:WaitForChild("Fire"),
Connect = Handle:WaitForChild("Connect"),
Hit = Handle:WaitForChild("Hit"),
}
for i, v in pairs(Meshes) do
Meshes[i] = (BaseUrl .. v)
end
BasePart = Create("Part"){
Material = Enum.Material.Plastic,
Shape = Enum.PartType.Block,
TopSurface = Enum.SurfaceType.Smooth,
BottomSurface = Enum.SurfaceType.Smooth,
FormFactor = Enum.FormFactor.Custom,
Size = Vector3.new(0.2, 0.2, 0.2),
CanCollide = true,
Locked = true,
}
BaseRope = BasePart:Clone()
BaseRope.Name = "Effect"
BaseRope.BrickColor = BrickColor.new("Really black")
BaseRope.Anchored = true
BaseRope.CanCollide = false
Create("CylinderMesh"){
Scale = Vector3.new(1, 1, 1),
Parent = BaseRope,
}
BaseGrappleHook = BasePart:Clone()
BaseGrappleHook.Name = "Projectile"
BaseGrappleHook.Transparency = 0
BaseGrappleHook.Size = Vector3.new(1, 0.4, 1)
BaseGrappleHook.Anchored = false
BaseGrappleHook.CanCollide = true
Create("SpecialMesh"){
MeshType = Enum.MeshType.FileMesh,
MeshId = (BaseUrl .. "30307623"),
TextureId = (BaseUrl .. "30307531"),
Scale = Mesh.Scale,
VertexColor = Vector3.new(1, 1, 1),
Offset = Vector3.new(0, 0, 0),
Parent = BaseGrappleHook,
}
Create("BodyGyro"){
Parent = BaseGrappleHook,
}
for i, v in pairs({Sounds.Connect, Sounds.Hit}) do
local Sound = v:Clone()
Sound.Parent = BaseGrappleHook
end
Gravity = 196.20
Rate = (1 / 60)
MaxDistance = 200
CanFireWhileGrappling = true
Crouching = false
ToolEquipped = false
ServerControl = (Tool:FindFirstChild("ServerControl") or Create("RemoteFunction"){
Name = "ServerControl",
Parent = Tool,
})
ClientControl = (Tool:FindFirstChild("ClientControl") or Create("RemoteFunction"){
Name = "ClientControl",
Parent = Tool,
})
for i, v in pairs(Tool:GetChildren()) do
if v:IsA("BasePart") and v ~= Handle then
v:Destroy()
end
end
Mesh.MeshId = Meshes.GrappleWithHook
Handle.Transparency = 0
Tool.Enabled = true
function CheckTableForString(Table, String)
for i, v in pairs(Table) do
if string.find(string.lower(String), string.lower(v)) then
return true
end
end
return false
end
function CheckIntangible(Hit)
local ProjectileNames = {"Water", "Arrow", "Projectile", "Effect", "Rail", "Laser", "Bullet", "GrappleHook"}
if Hit and Hit.Parent then
if ((not Hit.CanCollide or CheckTableForString(ProjectileNames, Hit.Name)) and not Hit.Parent:FindFirstChild("Humanoid")) then
return true
end
end
return false
end
function CastRay(StartPos, Vec, Length, Ignore, DelayIfHit)
local Ignore = ((type(Ignore) == "table" and Ignore) or {Ignore})
local RayHit, RayPos, RayNormal = game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(StartPos, Vec * Length), Ignore)
if RayHit and CheckIntangible(RayHit) then
if DelayIfHit then
wait()
end
RayHit, RayPos, RayNormal = CastRay((RayPos + (Vec * 0.01)), Vec, (Length - ((StartPos - RayPos).magnitude)), Ignore, DelayIfHit)
end
return RayHit, RayPos, RayNormal
end
function AdjustRope()
if not Rope or not Rope.Parent or not CheckIfGrappleHookAlive() then
return
end
local StartPosition = Handle.Position
local EndPosition = GrappleHook.Position
local RopeLength = (StartPosition - EndPosition).Magnitude
Rope.Size = Vector3.new(1, 1, 1)
Rope.Mesh.Scale = Vector3.new(0.1, RopeLength, 0.1)
Rope.CFrame = (CFrame.new(((StartPosition + EndPosition) / 2), EndPosition) * CFrame.Angles(-(math.pi / 2), 0, 0))
end
function DisconnectGrappleHook(KeepBodyObjects)
for i, v in pairs({Rope, GrappleHook, GrappleHookChanged}) do
if v then
if tostring(v) == "Connection" then
v:disconnect()
elseif type(v) == "userdata" and v.Parent then
v:Destroy()
end
end
end
if CheckIfAlive() and not KeepBodyObjects then
for i, v in pairs(Torso:GetChildren()) do
if string.find(string.lower(v.ClassName), string.lower("Body")) then
v:Destroy()
end
end
end
Connected = false
Mesh.MeshId = Meshes.GrappleWithHook
end
function TryToConnect()
if not ToolEquipped or not CheckIfAlive() or not CheckIfGrappleHookAlive() or Connected then
DisconnectGrappleHook()
return
end
local DistanceApart = (Torso.Position - GrappleHook.Position).Magnitude
if DistanceApart > MaxDistance then
DisconnectGrappleHook()
return
end
local Directions = {Vector3.new(0, 1, 0), Vector3.new(0, -1, 0), Vector3.new(1, 0, 0), Vector3.new(-1, 0, 0), Vector3.new(0, 0, 1), Vector3.new(0, 0, -1)}
local ClosestRay = {DistanceApart = math.huge}
for i, v in pairs(Directions) do
local Direction = CFrame.new(GrappleHook.Position, (GrappleHook.CFrame + v * 2).p).lookVector
local RayHit, RayPos, RayNormal = CastRay((GrappleHook.Position + Vector3.new(0, 0, 0)), Direction, 2, {Character, GrappleHook, Rope}, false)
if RayHit then
local DistanceApart = (GrappleHook.Position - RayPos).Magnitude
if DistanceApart < ClosestRay.DistanceApart then
ClosestRay = {Hit = RayHit, Pos = RayPos, Normal = RayNormal, DistanceApart = DistanceApart}
end
end
end
if ClosestRay.Hit then
Connected = true
local GrappleCFrame = CFrame.new(ClosestRay.Pos, (CFrame.new(ClosestRay.Pos) + ClosestRay.Normal * 2).p) * CFrame.Angles((math.pi / 2), 0, 0)
GrappleCFrame = (GrappleCFrame * CFrame.new(0, -(GrappleHook.Size.Y / 1.5), 0))
GrappleCFrame = (CFrame.new(GrappleCFrame.p, Handle.Position) * CFrame.Angles(0, math.pi, 0))
local Weld = Create("Motor6D"){
Part0 = GrappleHook,
Part1 = ClosestRay.Hit,
C0 = GrappleCFrame:inverse(),
C1 = ClosestRay.Hit.CFrame:inverse(),
Parent = GrappleHook,
}
for i, v in pairs(GrappleHook:GetChildren()) do
if string.find(string.lower(v.ClassName), string.lower("Body")) then
v:Destroy()
end
end
local HitSound = GrappleHook:FindFirstChild("Hit")
if HitSound then
HitSound:Play()
end
local BackUpGrappleHook = GrappleHook
wait(0.4)
if not CheckIfGrappleHookAlive() or GrappleHook ~= BackUpGrappleHook then
return
end
Sounds.Connect:Play()
local ConnectSound = GrappleHook:FindFirstChild("Connect")
if ConnectSound then
ConnectSound:Play()
end
for i, v in pairs(Torso:GetChildren()) do
if string.find(string.lower(v.ClassName), string.lower("Body")) then
v:Destroy()
end
end
local TargetPosition = GrappleHook.Position
local BackUpPosition = TargetPosition
local BodyPos = Create("BodyPosition"){
D = 1000,
P = 3000,
maxForce = Vector3.new(1000000, 1000000, 1000000),
position = TargetPosition,
Parent = Torso,
}
local BodyGyro = Create("BodyGyro"){
maxTorque = Vector3.new(math.huge, math.huge, math.huge),
cframe = CFrame.new(Torso.Position, Vector3.new(GrappleCFrame.p.X, Torso.Position.Y, GrappleCFrame.p.Z)),
Parent = Torso,
}
Spawn(function()
while TargetPosition == BackUpPosition and CheckIfGrappleHookAlive() and Connected and ToolEquipped and CheckIfAlive() do
BodyPos.position = GrappleHook.Position
wait()
end
end)
end
end
function CheckIfGrappleHookAlive()
return (((GrappleHook and GrappleHook.Parent --[[and Rope and Rope.Parent]]) and true) or false)
end
function CheckIfAlive()
return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent and Player and Player.Parent) and true) or false)
end
function Activated()
if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then
return
end
local MousePosition = InvokeClient("MousePosition")
if not MousePosition then
return
end
MousePosition = MousePosition.Position
if CheckIfGrappleHookAlive() then
if not CanFireWhileGrappling then
return
end
if GrappleHookChanged then
GrappleHookChanged:disconnect()
end
DisconnectGrappleHook(true)
end
if GrappleHookChanged then
GrappleHookChanged:disconnect()
end
Tool.Enabled = false
Sounds.Fire:Play()
Mesh.MeshId = Meshes.Grapple
GrappleHook = BaseGrappleHook:Clone()
GrappleHook.CFrame = (CFrame.new((Handle.Position + (MousePosition - Handle.Position).Unit * 5), MousePosition) * CFrame.Angles(0, 0, 0))
local Weight = 70
GrappleHook.Velocity = (GrappleHook.CFrame.lookVector * Weight)
local Force = Create("BodyForce"){
force = Vector3.new(0, Weight-20, 0),
Parent = GrappleHook,
}
GrappleHook.Parent = Tool
GrappleHookChanged = GrappleHook.Changed:connect(function(Property)
if Property == "Parent" then
DisconnectGrappleHook()
end
end)
Rope = BaseRope:Clone()
Rope.Parent = Tool
Spawn(function()
while CheckIfGrappleHookAlive() and ToolEquipped and CheckIfAlive() do
AdjustRope()
Spawn(function()
if not Connected then
TryToConnect()
end
end)
wait()
end
end)
wait(2)
Tool.Enabled = true
end
local seatedConnection = nil
function Equipped(Mouse)
Character = Tool.Parent
Humanoid = Character:FindFirstChild("Humanoid")
Torso = Character:FindFirstChild("HumanoidRootPart")
Player = Players:GetPlayerFromCharacter(Character)
if not CheckIfAlive() then
return
end
spawn(function()
DisconnectGrappleHook()
if HumanoidJumping then
HumanoidJumping:disconnect()
end
HumanoidJumping = Humanoid.Jumping:connect(function()
DisconnectGrappleHook()
end)
end)
Crouching = false
ToolEquipped = true
Tool.Enabled = not Humanoid.Sit
seatedConnection = Humanoid.Seated:connect(function(active,seat)
if active then
Tool.Enabled = false
else
Tool.Enabled = true
end
end)
end
function Unequipped()
if HumanoidJumping then
HumanoidJumping:disconnect()
end
DisconnectGrappleHook()
Crouching = false
ToolEquipped = false
seatedConnection:disconnect()
end
function OnServerInvoke(player, mode, value)
if player ~= Player or not ToolEquipped or not value or not CheckIfAlive() then
return
end
if mode == "KeyPress" then
local Key = value.Key
local Down = value.Down
if Key == "q" and Down then
DisconnectGrappleHook()
elseif Key == "c" and Down then
Crouching = not Crouching
Spawn(function()
InvokeClient(((Crouching and "PlayAnimation") or "StopAnimation"), Animations.Crouch)
end)
end
end
end
function InvokeClient(Mode, Value)
local ClientReturn = nil
pcall(function()
ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
end)
return ClientReturn
end
ServerControl.OnServerInvoke = OnServerInvoke
Tool.Activated:connect(Activated)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
--Feel free to change other properties |
trail.Parent = script.Parent.HumanoidRootPart
att0.Parent = script.Parent.HumanoidRootPart
att1.Parent = script.Parent.HumanoidRootPart
trail.Attachment0 = att0
trail.Attachment1 = att1
trail.Enabled = true
att0.Position = Vector3.new(.5, 0, 0)
att1.Position = Vector3.new(-.5, 0, 0)
|
-----RandomDebris----- |
local Colors = {
Color3.fromRGB(91, 91, 91),
}
local Materials = {
Enum.Material.Plastic,
} |
-- Regular :WaitForChild had issues with order (remoteevents were going through before waitforchild resumed) |
function WaitForChild(parent, name)
local remote = parent:FindFirstChild(name)
if not remote then
local thread = coroutine.running()
local con
con = parent.ChildAdded:Connect(function(child)
if child.Name == name then
con:Disconnect()
remote = child
ResumeThread(thread)
end
end)
YieldThread()
end
return remote
end
function GetEventHandler(name)
local handler = EventHandlers[name]
if handler then
return handler
end
local handler = {
Name = name,
Folder = EventsFolder,
Callbacks = {},
IncomingQueueErrored = nil
}
EventHandlers[name] = handler
if IsServer then
local remote = Instance.new("RemoteEvent")
remote.Name = handler.Name
remote.Parent = handler.Folder
handler.Remote = remote
else
FastSpawn(function()
handler.Queue = {}
local remote = WaitForChild(handler.Folder, handler.Name)
handler.Remote = remote
if #handler.Callbacks == 0 then
handler.IncomingQueue = {}
end
remote.OnClientEvent:Connect(function(...)
if handler.IncomingQueue then
if #handler.IncomingQueue >= 2048 then
if not handler.IncomingQueueErrored then
handler.IncomingQueueErrored = true
FastSpawn(error, string.format("Exhausted remote invocation queue for %s", remote:GetFullName()), -1)
delay(1, function()
handler.IncomingQueueErrored = nil
end)
end
if #handler.IncomingQueue >= 8172 then
table.remove(handler.IncomingQueue, 1)
end
end
ReceiveCounter += 1
table.insert(handler.IncomingQueue, table.pack(ReceiveCounter, handler, ...))
return
end
SafeFireEvent(handler, ...)
end)
if not IsStudio then
remote.Name = ""
end
for _,fn in pairs(handler.Queue) do
fn()
end
handler.Queue = nil
end)
end
return handler
end
function GetFunctionHandler(name)
local handler = FunctionHandlers[name]
if handler then
return handler
end
local handler = {
Name = name,
Folder = FunctionsFolder,
Callback = nil,
IncomingQueueErrored = nil
}
FunctionHandlers[name] = handler
if IsServer then
local remote = Instance.new("RemoteFunction")
remote.Name = handler.Name
remote.Parent = handler.Folder
handler.Remote = remote
else
FastSpawn(function()
handler.Queue = {}
local remote = WaitForChild(handler.Folder, handler.Name)
handler.Remote = remote
handler.IncomingQueue = {}
handler.OnClientInvoke = function(...)
if not handler.Callback then
if #handler.IncomingQueue >= 2048 then
if not handler.IncomingQueueErrored then
handler.IncomingQueueErrored = true
FastSpawn(error, string.format("Exhausted remote invocation queue for %s", remote:GetFullName()), -1)
delay(1, function()
handler.IncomingQueueErrored = nil
end)
end
if #handler.IncomingQueue >= 8172 then
table.remove(handler.IncomingQueue, 1)
end
end
ReceiveCounter += 1
local params = table.pack(ReceiveCounter, handler, coroutine.running())
table.insert(handler.IncomingQueue, params)
YieldThread()
end
return SafeInvokeCallback(handler, ...)
end
if not IsStudio then
remote.Name = ""
end
for _,fn in pairs(handler.Queue) do
fn()
end
handler.Queue = nil
end)
end
return handler
end
function AddToQueue(handler, fn, doWarn)
if handler.Remote then
return fn()
end
handler.Queue[#handler.Queue + 1] = fn
if doWarn then
delay(5, function()
if not handler.Remote then
warn(debug.traceback(("Infinite yield possible on '%s:WaitForChild(\"%s\")'"):format(handler.Folder:GetFullName(), handler.Name)))
end
end)
end
end
function ExecuteDeferredHandlers()
local handlers = DeferredHandlers
local queue = {}
DeferredHandlers = {}
for handler in pairs(handlers) do
local incoming = handler.IncomingQueue
handler.IncomingQueue = nil
table.move(incoming, 1, #incoming, #queue + 1, queue)
end
table.sort(queue, function(a, b) return a[1] < b[1] end)
for _,v in ipairs(queue) do
local handler = v[2]
if handler.Callbacks then
SafeFireEvent(handler, unpack(v, 3))
else
ResumeThread(v[3])
end
end
end
local Middleware = {
MatchParams = function(name, paramTypes)
paramTypes = { unpack(paramTypes) }
local paramStart = 1
for i,v in pairs(paramTypes) do
local list = type(v) == "string" and string.split(v, "|") or v
local dict = {}
local typeListString = ""
for _,v in pairs(list) do
local typeString = v:gsub("^%s+", ""):gsub("%s+$", "")
typeListString ..= (#typeListString > 0 and " or " or "") .. typeString
dict[typeString:lower()] = true
end
dict._string = typeListString
paramTypes[i] = dict
end
if IsServer then
paramStart = 2
table.insert(paramTypes, 1, false)
end
local function MatchParams(fn, ...)
local params = table.pack(...)
if params.n > #paramTypes then
if IsStudio then
warn(("[Network] Invalid number of parameters to %s (%s expected, got %s)"):format(name, #paramTypes - paramStart + 1, params.n - paramStart + 1))
end
return
end
for i = paramStart, #paramTypes do
local argType = typeof(params[i])
local argExpected = paramTypes[i]
if not argExpected[argType:lower()] and not argExpected.any then
if IsStudio then
warn(("[Network] Invalid parameter %d to %s (%s expected, got %s)"):format(i - paramStart + 1, name, argExpected._string, argType))
end
return
end
end
return fn(...)
end
return MatchParams
end
}
function combineFn(handler, final, ...)
local middleware = { ... }
if typeof(final) == "table" then
local info = final
final = final[1]
if info.MatchParams then
table.insert(middleware, Middleware.MatchParams(handler.Name, info.MatchParams))
end
end
local function NetworkHandler(...)
if LoggingNetwork then
local client = ...
table.insert(LoggingNetwork[client][handler.Remote].dataIn, GetParamString(select(2, ...)))
end
local currentIndex = 1
local function runMiddleware(index, ...)
if index ~= currentIndex then
return
end
currentIndex += 1
if index <= #middleware then
return middleware[index](function(...) return runMiddleware(index + 1, ...) end, ...)
end
return final(...)
end
return runMiddleware(1, ...)
end
return NetworkHandler
end
function Network:BindEvents(pre, callbacks)
if typeof(pre) == "table" then
pre, callbacks = nil, pre
end
for name,fn in pairs(callbacks) do
local handler = GetEventHandler(name)
if not handler then
error(("Tried to bind callback to non-existing RemoteEvent %q"):format(name))
end
handler.Callbacks[#handler.Callbacks + 1] = combineFn(handler, fn, pre)
if IsServer then
handler.Remote.OnServerEvent:Connect(function(...)
SafeFireEvent(handler, ...)
end)
else
if handler.IncomingQueue then
DeferredHandlers[handler] = true
end
end
end
ExecuteDeferredHandlers()
end
function Network:BindFunctions(pre, callbacks)
if typeof(pre) == "table" then
pre, callbacks = nil, pre
end
for name,fn in pairs(callbacks) do
local handler = GetFunctionHandler(name)
if not handler then
error(("Tried to bind callback to non-existing RemoteFunction %q"):format(name))
end
if handler.Callback then
error(("Tried to bind multiple callbacks to the same RemoteFunction (%s)"):format(handler.Remote:GetFullName()))
end
handler.Callback = combineFn(handler, fn, pre)
if IsServer then
handler.Remote.OnServerInvoke = function(...)
return SafeInvokeCallback(handler, ...)
end
else
if handler.IncomingQueue then
DeferredHandlers[handler] = true
end
end
end
ExecuteDeferredHandlers()
end
|
--[[
Function called when leaving the state
]] |
function PlayerPostGame.onLeave(stateMachine, serverPlayer, event, from, to)
end
return PlayerPostGame
|
-- Builds a set of runnable Tweens from a table of instances and values |
local function BuildTweens(root, tweenTable)
local tweens = {}
VisitAllInstances(root, tweenTable, function(instance, props)
for prop, values in pairs(props) do
local keyframes = values.Keyframes
local lastTime = 0
for _, keyframe in ipairs(keyframes) do
local tweenInfo = TweenInfo.new(keyframe.Time - lastTime,
keyframe.EasingStyle,keyframe.EasingDirection, 0, false, 0)
local propTable = {
[prop] = keyframe.Value
}
local tween = TweenService:Create(instance, tweenInfo, propTable)
table.insert(tweens, {
Tween = tween,
DelayTime = lastTime,
})
lastTime = keyframe.Time
end
end
end)
return tweens
end
local TweenUtilities = {}
TweenUtilities.__index = TweenUtilities
function TweenUtilities.new(root, tweenTable)
local self = {
running = false,
root = root,
tweenTable = tweenTable,
tweens = BuildTweens(root, tweenTable),
}
setmetatable(self, TweenUtilities)
return self
end
function TweenUtilities:ResetValues()
VisitAllInstances(self.root, self.tweenTable, function(instance, props)
for prop, values in pairs(props) do
local initialValue = values.InitialValue
instance[prop] = initialValue
end
end)
end
function TweenUtilities:PlayTweens(callback)
if self.running then
self:PauseTweens()
end
self.running = true
local delayedTweens = {}
for _, props in pairs(self.tweens) do
local tween = props.Tween
local delayTime = props.DelayTime
if delayTime == 0 then
tween:Play()
else
table.insert(delayedTweens, {
Tween = tween,
DelayTime = delayTime,
Playing = false,
})
end
end
local heartbeatConnection
local start = tick()
local tweensDone = false
heartbeatConnection = RunService.Heartbeat:Connect(function()
local now = tick() - start
if not self.running then
self.running = false
heartbeatConnection:Disconnect()
if callback then
callback()
end
return
end
if tweensDone then
local allDone = true
for _, props in pairs(self.tweens) do
local tween = props.Tween
if tween.PlaybackState == Enum.PlaybackState.Playing then
allDone = false
end
end
if allDone then
self.running = false
heartbeatConnection:Disconnect()
if callback then
callback()
end
return
end
else
local allPlaying = true
for _, props in pairs(delayedTweens) do
if not props.Playing then
if now > props.DelayTime then
props.Playing = true
props.Tween:Play()
else
allPlaying = false
end
end
end
tweensDone = allPlaying
end
end)
end
function TweenUtilities:PauseTweens()
self.running = false
for _, props in pairs(self.tweens) do
local tween = props.Tween
tween:Cancel()
end
end
return TweenUtilities
|
---------------------------------------Function end here. |
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
--Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
if (check()) then
fire(script.Parent.Parent["Humanoid"].TargetPoint)
wait(0.0)
onActivated()
end
return
--Tool.Enabled = true
end
script.Parent.Activated:connect(onActivated)
|
-- OTHER VARIABLES -- |
local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")
local humanoid = char:WaitForChild("Humanoid")
|
--[[Weight and CG]] |
Tune.Weight = 100000 -- 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 = 5 -- Front Wheel Density
Tune.RWheelDensity = 5 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 5 -- Size of structural members (larger = more stable/carry more weight)
Tune.AxleDensity = 1 -- Density of structural members
|
--// Set up |
for L_18_forvar1, L_19_forvar2 in pairs(game.Players:GetChildren()) do
if L_19_forvar2:IsA('Player') and L_19_forvar2.Character and L_19_forvar2.Character.Head and L_19_forvar2.Character.Humanoid and L_19_forvar2.Character.Humanoid.Health > 0 then
if L_19_forvar2.TeamColor == L_1_.TeamColor then
if L_19_forvar2.Character.Saude.FireTeam.SquadName.Value ~= '' then
spawnTag(L_19_forvar2.Character, L_19_forvar2.Character.Saude.FireTeam.SquadColor.Value)
else
spawnTag(L_19_forvar2.Character, Color3.fromRGB(255,255,255))
end
end;
end;
end
|
----------------------------------
-----------CONNECTIONS------------
---------------------------------- |
SeatWeldConnection = nil
function MakeSeatConnections()
SeatWeldConnection = SeatWeld.Changed:connect(WeldChanged)
end
function BreakSeatConnections()
SeatWeldConnection:disconnect()
end
Piano.Bench.Seat.Changed:Connect(function()
Piano.Bench.Seat.Changed:Wait()
if Piano.Bench.Seat.Occupant == nil or Piano.Bench.Seat.Changed == "" or not Piano.Bench.Seat.Changed then
Shutdown()
end
end)
Seat.ChildAdded:connect(ChildAdded)
|
--[[
Performs property validation if the static method validateProps is declared.
validateProps should follow assert's expected arguments:
(false, message: string) | true. The function may return a message in the
true case; it will be ignored. If this fails, the function will throw the
error.
]] |
function Component:__validateProps(props)
if not config.propValidation then
return
end
local validator = self[InternalData].componentClass.validateProps
if validator == nil then
return
end
if typeof(validator) ~= "function" then
error(("validateProps must be a function, but it is a %s.\nCheck the definition of the component %q."):format(
typeof(validator),
self.__componentName
))
end
local success, failureReason = validator(props)
if not success then
failureReason = failureReason or "<Validator function did not supply a message>"
error(("Property validation failed: %s\n\n%s"):format(
tostring(failureReason),
self:getElementTraceback() or "<enable element tracebacks>"),
0)
end
end
|
--[=[
An observable that never completes.
@prop NEVER Observable<()>
@readonly
@within Rx
]=] |
local Rx = {
EMPTY = Observable.new(function(sub)
sub:Complete()
end);
NEVER = Observable.new(function(_)
end);
}
|
-- ROBLOX services |
local Teams = game.Teams
local Players = game.Players
|
-- Colors |
local FriendlyReticleColor = Color3.new(0, 1, 0)
local EnemyReticleColor = Color3.new(1, 0, 0)
local NeutralReticleColor = Color3.new(1, 1, 1)
local Spread = MinSpread
local AmmoInClip = ClipSize
local Tool = script.Parent
local Handle = WaitForChild(Tool, 'Handle')
local WeaponGui = nil
local Receiver = WaitForChild(Tool, 'Receiver')
local LeftButtonDown
local Reloading = false
local IsShooting = false
|
--local hitsound=waitForChild(Torso,"HitSound")
--[[
local sounds={
waitForChild(Torso,"GroanSound"),
waitForChild(Torso,"RawrSound")
}
--]] |
if healthregen then
local regenscript=waitForChild(sp,"HealthRegenerationScript")
regenscript.Disabled=false
end
Humanoid.WalkSpeed=wonderspeed
local toolAnim="None"
local toolAnimTime=0
BodyColors.HeadColor=BrickColor.new("Grime")
local randomcolor1=colors[math.random(1,#colors)]
BodyColors.TorsoColor=BrickColor.new(randomcolor1)
BodyColors.LeftArmColor=BrickColor.new(randomcolor1)
BodyColors.RightArmColor=BrickColor.new(randomcolor1)
local randomcolor2=colors[math.random(1,#colors)]
BodyColors.LeftLegColor=BrickColor.new(randomcolor2)
BodyColors.RightLegColor=BrickColor.new(randomcolor2)
function onRunning(speed)
if speed>0 then
pose="Running"
else
pose="Standing"
end
end
function onDied()
pose="Dead"
end
function onJumping()
pose="Jumping"
end
function onClimbing()
pose="Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
pose = "FreeFall"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
pose = "Seated"
end
function onPlatformStanding()
pose = "PlatformStanding"
end
function moveJump()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle=3.14
LeftShoulder.DesiredAngle=-3.14
RightHip.DesiredAngle=0
LeftHip.DesiredAngle=0
end
function moveFreeFall()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity =0.5
RightShoulder.DesiredAngle=3.14
LeftShoulder.DesiredAngle=-3.14
RightHip.DesiredAngle=0
LeftHip.DesiredAngle=0
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder.DesiredAngle=3.14 /2
LeftShoulder.DesiredAngle=-3.14 /2
RightHip.DesiredAngle=3.14 /2
LeftHip.DesiredAngle=-3.14 /2
end
function animate(time)
local amplitude
local frequency
if (pose == "Jumping") then
moveJump()
return
end
if (pose == "FreeFall") then
moveFreeFall()
return
end
if (pose == "Seated") then
moveSit()
return
end
local climbFudge = 0
if (pose == "Running") then
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
amplitude = 1
frequency = 9
elseif (pose == "Climbing") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
amplitude = 1
frequency = 9
climbFudge = 3.14
else
amplitude = 0.1
frequency = 1
end
desiredAngle = amplitude * math.sin(time*frequency)
if not chasing and frequency==9 then
frequency=4
end
if chasing then
RightShoulder.DesiredAngle=math.pi/2
LeftShoulder.DesiredAngle=-math.pi/2
RightHip.DesiredAngle=-desiredAngle*2
LeftHip.DesiredAngle=-desiredAngle*2
else
RightShoulder.DesiredAngle=desiredAngle + climbFudge
LeftShoulder.DesiredAngle=desiredAngle - climbFudge
RightHip.DesiredAngle=-desiredAngle
LeftHip.DesiredAngle=-desiredAngle
end
end
function attack(time,attackpos)
if time-lastattack>=1 then
local hit,pos=raycast(Torso.Position,(attackpos-Torso.Position).unit,attackrange)
if hit and hit.Parent~=nil and hit.Parent.Name~=sp.Name then
local h=hit.Parent:FindFirstChild("Humanoid")
if h then
local creator=sp:FindFirstChild("creator")
if creator then
if creator.Value~=nil then
if creator.Value~=game.Players:GetPlayerFromCharacter(h.Parent) then
for i,oldtag in ipairs(h:GetChildren()) do
if oldtag.Name=="creator" then
oldtag:remove()
end
end
creator:clone().Parent=h
else
return
end
end
end
h:TakeDamage(damage) |
--// Animations |
-- Idle Anim
IdleAnim = function(char, speed, objs)
TweenJoint(objs[2], nil , CFrame.new(-0.902175903, 0.295501232, -1.32277012, 1, 0, 0, 0, 1.19248806e-08, 1, 0, -1, 1.19248806e-08), function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[3], nil , CFrame.new(1.06851184, 0.973718464, -2.29667926, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.18)
end;
-- FireMode Anim
FireModeAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(0.340285569, 0, -0.0787199363, 0.962304771, 0.271973342, 0, -0.261981696, 0.926952124, -0.268561482, -0.0730415657, 0.258437991, 0.963262498), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.1)
TweenJoint(objs[2], nil , CFrame.new(0.67163527, -0.310947895, -1.34432662, 0.766044378, -2.80971371e-008, 0.642787576, -0.620885074, -0.258818865, 0.739942133, 0.166365519, -0.965925872, -0.198266774), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.25)
objs[4]:WaitForChild("Click"):Play()
end;
-- Reload Anim
ReloadAnim = function(char, speed, objs)
TweenJoint(objs[2], nil , CFrame.new(-0.630900264, 0.317047596, -1.27966166, 0.985866964, -0.167529628, -7.32295247e-09, 0, -4.37113883e-08, 1, -0.167529613, -0.985867023, -4.30936176e-08), function(X) return math.sin(math.rad(X)) end, 0.5)
TweenJoint(objs[3], nil , CFrame.new(0.436954767, 0.654289246, -1.82817471, 0.894326091, -0.267454475, 0.358676374, -0.413143814, -0.185948789, 0.891479254, -0.171734676, -0.945458114, -0.276796043), function(X) return math.sin(math.rad(X)) end, 0.5)
wait(0.5)
local MagC = Tool:WaitForChild("Mag"):clone()
MagC:FindFirstChild("Mag"):Destroy()
MagC.Parent = Tool
MagC.Name = "MagC"
local MagCW = Instance.new("Motor6D")
MagCW.Part0 = MagC
MagCW.Part1 = workspace.CurrentCamera:WaitForChild("Arms"):WaitForChild("Left Arm")
MagCW.Parent = MagC
MagCW.C1 = MagC.CFrame:toObjectSpace(objs[4].CFrame)
objs[4].Transparency = 1
objs[6]:WaitForChild("MagOut"):Play()
TweenJoint(objs[3], nil , CFrame.new(0.436954767, 0.654289246, -3.00337243, 0.894326091, -0.267454475, 0.358676374, -0.413143814, -0.185948789, 0.891479254, -0.171734676, -0.945458114, -0.276796043), function(X) return math.sin(math.rad(X)) end, 0.3)
TweenJoint(objs[2], nil , CFrame.new(-0.630900264, 0.317047596, -1.27966166, 0.985866964, -0.167529628, -7.32295247e-09, 0.0120280236, 0.0707816631, 0.997419298, -0.16709727, -0.983322799, 0.0717963576), function(X) return math.sin(math.rad(X)) end, 0.1)
wait(0.1)
TweenJoint(objs[2], nil , CFrame.new(-1.11434817, 0.317047596, -0.672240019, 0.658346057, -0.747599542, -0.0876094475, 0.0672011375, -0.0575498641, 0.996078312, -0.749709547, -0.661651671, 0.0123518109), function(X) return math.sin(math.rad(X)) end, 0.3)
wait(0.3)
objs[6]:WaitForChild('MagIn'):Play()
TweenJoint(objs[3], nil , CFrame.new(-0.273085892, 0.654289246, -1.48434556, 0.613444746, -0.780330896, 0.121527649, -0.413143814, -0.185948789, 0.891479254, -0.673050761, -0.597081661, -0.43645826), function(X) return math.sin(math.rad(X)) end, 0.3)
wait(0.4)
MagC:Destroy()
objs[4].Transparency = 0
end;
-- Bolt Anim
BoltBackAnim = function(char, speed, objs)
local newWeld = Utilize.Weld(char:WaitForChild('Left Arm'),Tool:WaitForChild('BoltingArm'))
newWeld.Parent = char:WaitForChild('Left Arm')
newWeld.Name = 'NewWeld'
char:WaitForChild('Right Arm'):WaitForChild('Grip').Part0 = nil
TweenJoint(objs[3], nil , CFrame.new(-1.52445853, 0.388179123, -1.12311268, 0.973574817, -2.72326495e-09, -0.228368327, 0.228368327, 1.16097638e-08, 0.973574817, 0, -1, 1.19248806e-08), function(X) return math.sin(math.rad(X)) end, 0.2)
wait(0.2)
objs[5]:WaitForChild("BoltBack"):Play()
TweenJoint(objs[1], nil , CFrame.new(-0.0144310016, -0.0199942607, 0, -4.37113883e-08, -1, 0, 1, -4.37113883e-08, 0, 0, 0, 0.99999994), function(X) return math.sin(math.rad(X)) end, 0.2)
TweenJoint(objs[3], nil , CFrame.new(-1.37251711, 0.388179123, -0.827557564, 0.973574817, -2.72326495e-09, -0.228368327, 0.228368327, 1.16097638e-08, 0.973574817, 0, -1, 1.19248806e-08), function(X) return math.sin(math.rad(X)) end, 0.2)
wait(0.2)
TweenJoint(objs[1], nil , CFrame.new(-0.0144310016, -0.0199942607, 0.57348932, -4.37113883e-08, -1, 0, 1, -4.37113883e-08, 0, 0, 0, 0.99999994), function(X) return math.sin(math.rad(X)) end, 0.2)
TweenJoint(objs[3], nil , CFrame.new(-1.28267622, 0.0287755914, -0.838171721, 0.973574817, -2.72326495e-09, -0.228368327, 0.228368327, 1.16097638e-08, 0.973574817, 0, -1, 1.19248806e-08), function(X) return math.sin(math.rad(X)) end, 0.2)
wait(0.2)
end;
BoltForwardAnim = function(char, speed, objs)
objs[5]:WaitForChild("BoltForward"):Play()
TweenJoint(objs[1], nil , CFrame.new(-0.0144310016, -0.0199942607, -0.0408249125, -4.37113883e-08, -1, 0, 1, -4.37113883e-08, 0, 0, 0, 0.99999994), function(X) return math.sin(math.rad(X)) end, 0.1)
TweenJoint(objs[3], nil , CFrame.new(-1.37251711, 0.388179123, -0.827557564, 0.973574817, -2.72326495e-09, -0.228368327, 0.228368327, 1.16097638e-08, 0.973574817, 0, -1, 1.19248806e-08), function(X) return math.sin(math.rad(X)) end, 0.2)
wait(0.2)
TweenJoint(objs[3], nil , CFrame.new(-0.902175903, 0.295501232, -1.32277012, 1, 0, 0, 0, 1.19248806e-08, 1, 0, -1, 1.19248806e-08), function(X) return math.sin(math.rad(X)) end, 0.2)
TweenJoint(objs[1], nil , CFrame.new(), function(X) return math.sin(math.rad(X)) end, 0.1)
wait(0.2)
char:WaitForChild('Right Arm'):WaitForChild('Grip').Part0 = char:WaitForChild('Right Arm')
char:WaitForChild('Left Arm').NewWeld:Destroy()
wait(0.2)
end;
-- Bolting Back
BoltingBackAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(0, 0, 0.573770154, 1, 0, 0, 0, 1, 0, 0, 0, 1), function(X) return math.sin(math.rad(X)) end, 0.001)
end;
BoltingForwardAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(), function(X) return math.sin(math.rad(X)) end, 0.001)
end;
InspectAnim = function(char, speed, objs)
ts:Create(objs[1],TweenInfo.new(1),{C1 = CFrame.new(0.805950999, 0.654529691, -1.92835355, 0.999723792, 0.0109803826, 0.0207702816, -0.0223077796, 0.721017241, 0.692557871, -0.00737112388, -0.692829967, 0.721063137)}):Play()
ts:Create(objs[2],TweenInfo.new(1),{C1 = CFrame.new(-1.49363565, -0.699174881, -1.32277012, 0.66716975, -8.8829113e-09, -0.74490571, 0.651565909, -0.484672248, 0.5835706, -0.361035138, -0.874695837, -0.323358655)}):Play()
wait(1)
ts:Create(objs[2],TweenInfo.new(1),{C1 = CFrame.new(1.37424219, -0.699174881, -1.03685927, -0.204235911, 0.62879771, 0.750267386, 0.65156585, -0.484672219, 0.58357054, 0.730581641, 0.60803473, -0.310715646)}):Play()
wait(1)
ts:Create(objs[2],TweenInfo.new(1),{C1 = CFrame.new(-0.902175903, 0.295501232, -1.32277012, 0.935064793, -0.354476899, 4.22709467e-09, -0.110443868, -0.291336805, 0.950223684, -0.336832345, -0.888520718, -0.311568588)}):Play()
ts:Create(objs[1],TweenInfo.new(1),{C1 = CFrame.new(0.447846293, 0.654529572, -1.81345785, 0.761665463, -0.514432132, 0.393986136, -0.560285628, -0.217437655, 0.799250066, -0.325492471, -0.82950604, -0.453843832)}):Play()
wait(1)
local MagC = Tool:WaitForChild("Mag"):clone()
MagC:FindFirstChild("Mag"):Destroy()
MagC.Parent = Tool
MagC.Name = "MagC"
local MagCW = Instance.new("Motor6D")
MagCW.Part0 = MagC
MagCW.Part1 = workspace.CurrentCamera:WaitForChild("Arms"):WaitForChild("Left Arm")
MagCW.Parent = MagC
MagCW.C1 = MagC.CFrame:toObjectSpace(Tool:WaitForChild('Mag').CFrame)
Tool.Mag.Transparency = 1
Tool:WaitForChild('Grip'):WaitForChild("MagOut"):Play()
ts:Create(objs[2],TweenInfo.new(0.15),{C1 = CFrame.new(-0.902175903, 0.295501232, -1.55972552, 0.935064793, -0.354476899, 4.22709467e-09, -0.110443868, -0.291336805, 0.950223684, -0.336832345, -0.888520718, -0.311568588)}):Play()
ts:Create(objs[1],TweenInfo.new(0.3),{C1 = CFrame.new(0.447846293, 0.654529572, -2.9755671, 0.761665463, -0.514432132, 0.393986136, -0.568886042, -0.239798605, 0.786679745, -0.31021595, -0.823320091, -0.475299776)}):Play()
wait(0.13)
ts:Create(objs[2],TweenInfo.new(0.20),{C1 = CFrame.new(-0.902175903, 0.295501232, -1.28149843, 0.935064793, -0.354476899, 4.22709467e-09, -0.110443868, -0.291336805, 0.950223684, -0.336832345, -0.888520718, -0.311568588)}):Play()
wait(0.20)
ts:Create(objs[1],TweenInfo.new(0.5),{C1 = CFrame.new(0.447846293, -0.650498748, -1.82401526, 0.761665463, -0.514432132, 0.393986136, -0.646156013, -0.55753684, 0.521185875, -0.0484529883, -0.651545882, -0.75706023)}):Play()
wait(0.8)
ts:Create(objs[1],TweenInfo.new(0.6),{C1 = CFrame.new(0.447846293, 0.654529572, -2.9755671, 0.761665463, -0.514432132, 0.393986136, -0.568886042, -0.239798605, 0.786679745, -0.31021595, -0.823320091, -0.475299776)}):Play()
wait(0.5)
Tool:WaitForChild('Grip'):WaitForChild("MagIn"):Play()
ts:Create(objs[1],TweenInfo.new(0.3),{C1 = CFrame.new(0.447846293, 0.654529572, -1.81345785, 0.761665463, -0.514432132, 0.393986136, -0.560285628, -0.217437655, 0.799250066, -0.325492471, -0.82950604, -0.453843832)}):Play()
wait(0.3)
MagC:Destroy()
Tool.Mag.Transparency = 0
wait(0.1)
end;
nadeReload = function(char, speed, objs)
ts:Create(objs[1], TweenInfo.new(0.6), {C1 = CFrame.new(-0.902175903, -1.15645337, -1.32277012, 0.984807789, -0.163175702, -0.0593911409, 0, -0.342020363, 0.939692557, -0.17364797, -0.925416529, -0.336824328)}):Play()
ts:Create(objs[2], TweenInfo.new(0.6), {C1 = CFrame.new(0.805950999, 0.654529691, -1.92835355, 0.787567914, -0.220087856, 0.575584888, -0.323594928, 0.647189975, 0.690240026, -0.524426222, -0.72986728, 0.438486755)}):Play()
wait(0.6)
ts:Create(objs[2], TweenInfo.new(0.6), {C1 = CFrame.new(0.805950999, 0.559619546, -1.73060048, 0.802135408, -0.348581612, 0.484839559, -0.597102284, -0.477574915, 0.644508123, 0.00688350201, -0.806481719, -0.59121877)}):Play()
wait(0.6)
end;
AttachAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(-2.05413628, -0.386312962, -0.955676377, 0.5, 0, -0.866025329, 0.852868497, -0.17364797, 0.492403895, -0.150383547, -0.984807789, -0.086823985), function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[2], nil , CFrame.new(0.931334019, 1.66565645, -1.2231313, 0.787567914, -0.220087856, 0.575584888, -0.0180282295, 0.925416708, 0.378521889, -0.615963817, -0.308488399, 0.724860728), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.18)
end;
-- Patrol Anim
PatrolAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , sConfig.PatrolPosR, function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[2], nil , sConfig.PatrolPosL, function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.18)
end;
}
return Settings
|
--[=[
@return Mouse
Constructs a new mouse input capturer.
```lua
local mouse = Mouse.new()
```
]=] |
function Mouse.new()
local self = setmetatable({}, Mouse)
self._trove = Trove.new()
self.LeftDown = self._trove:Construct(Signal)
self.LeftUp = self._trove:Construct(Signal)
self.RightDown = self._trove:Construct(Signal)
self.RightUp = self._trove:Construct(Signal)
self.Scrolled = self._trove:Construct(Signal)
self._trove:Connect(UserInputService.InputBegan, function(input, processed)
if processed then return end
if input.UserInputType == Enum.UserInputType.MouseButton1 then
self.LeftDown:Fire()
elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
self.RightDown:Fire()
end
end)
self._trove:Connect(UserInputService.InputEnded, function(input, processed)
if processed then return end
if input.UserInputType == Enum.UserInputType.MouseButton1 then
self.LeftUp:Fire()
elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
self.RightUp:Fire()
end
end)
self._trove:Connect(UserInputService.InputChanged, function(input, processed)
if processed then return end
if input.UserInputType == Enum.UserInputType.MouseWheel then
self.Scrolled:Fire(input.Position.Z)
end
end)
return self
end
|
--[[
Calls the bound function every interval until shouldContinueCallback doesn't return true
]] |
return function(interval, boundFunction, shouldContinueCallback)
spawn(
function()
while shouldContinueCallback do
boundFunction()
wait(interval)
end
end
)
end
|
--Script made by Shaakra-- |
function waitForChild( parent, childName )
while true do
local child = parent:findFirstChild( childName )
if child then return child end
parent.ChildAdded:wait()
end
end
local Figure = script.Parent
local Head = waitForChild( Figure, "Head" )
local Humanoid = waitForChild( Figure, "Humanoid" )
Humanoid.Health = 200
while true do
local s = wait( 4 )
local Health = Humanoid.Health
if Health > 0 and Health < Humanoid.MaxHealth then
Health = Health + 0.08 * s * Humanoid.MaxHealth
if Health * 1.05 < Humanoid.MaxHealth then
Humanoid.Health = Health
else
Humanoid.Health = Humanoid.MaxHealth
end
end
end
|
-- Require Shime |
local shimmer = require(game.ReplicatedStorage.Shime)
|
--gman9544-- |
pod = script.Parent
function onTouched(part)
part.BrickColor = BrickColor.new("Medium blue")
wait(0)
part.Reflectance = 1
wait(0)
part.Reflectance = 1
wait(0)
part.Reflectance = 1
wait(0)
part.Reflectance = 1
part.Anchored = true
part.Material = "Ice"
wait(0)
end
connection = pod.Touched:connect(onTouched)
|
--[[
CameraShakePresets.Bump
CameraShakePresets.Explosion
CameraShakePresets.Earthquake
CameraShakePresets.GentleSway
CameraShakePresets.BadTrip
CameraShakePresets.HandheldCamera
CameraShakePresets.Vibration
CameraShakePresets.RoughDriving
--]] |
local CameraShakeInstance = require(script.Parent.CameraShakeInstance)
local CameraShakePresets = {
-- A high-magnitude, short, yet smooth shake.
-- Should happen once.
Bump = function()
local c = CameraShakeInstance.new(2.5, 4, 0.1, 0.75)
c.PositionInfluence = Vector3.new(0.15, 0.15, 0.15)
c.RotationInfluence = Vector3.new(1, 1, 1)
return c
end;
-- An intense and rough shake.
-- Should happen once.
Explosion = function()
local c = CameraShakeInstance.new(5, 10, 0, 1.5)
c.PositionInfluence = Vector3.new(0.25, 0.25, 0.25)
c.RotationInfluence = Vector3.new(4, 1, 1)
return c
end;
-- A continuous, rough shake
-- Sustained.
Earthquake = function()
local c = CameraShakeInstance.new(0.6, 3.5, 2, 10)
c.PositionInfluence = Vector3.new(0.25, 0.25, 0.25)
c.RotationInfluence = Vector3.new(1, 1, 4)
return c
end;
-- A gentle left/right/up/down sway. Good for intro screens/landscapes.
-- Sustained.
GentleSway = function()
local c = CameraShakeInstance.new(0.65, 0.08, 0.1, 0.75)
c.PositionInfluence = Vector3.new(1.20, 0.35, 0.05)
c.RotationInfluence = Vector3.new(0.02, 0.02, 0.02)
return c
end;
-- A bizarre shake with a very high magnitude and low roughness.
-- Sustained.
BadTrip = function()
local c = CameraShakeInstance.new(10, 0.15, 5, 10)
c.PositionInfluence = Vector3.new(0, 0, 0.15)
c.RotationInfluence = Vector3.new(2, 1, 4)
return c
end;
-- A subtle, slow shake.
-- Sustained.
HandheldCamera = function()
local c = CameraShakeInstance.new(1, 0.25, 5, 10)
c.PositionInfluence = Vector3.new(0, 0, 0)
c.RotationInfluence = Vector3.new(1, 0.5, 0.5)
return c
end;
-- A very rough, yet low magnitude shake.
-- Sustained.
Vibration = function()
local c = CameraShakeInstance.new(0.4, 20, 2, 2)
c.PositionInfluence = Vector3.new(0, 0.15, 0)
c.RotationInfluence = Vector3.new(1.25, 0, 4)
return c
end;
-- A slightly rough, medium magnitude shake.
-- Sustained.
RoughDriving = function()
local c = CameraShakeInstance.new(1, 2, 1, 1)
c.PositionInfluence = Vector3.new(0, 0, 0)
c.RotationInfluence = Vector3.new(1, 1, 1)
return c
end;
}
return setmetatable({}, {
__index = function(t, i)
local f = CameraShakePresets[i]
if (type(f) == "function") then
return f()
end
error("No preset found with index \"" .. i .. "\"")
end;
})
|
--[=[
@within Touch
@prop TouchTap Signal<(touchPositions: {Vector2}, processed: boolean)>
@tag Event
Proxy for [UserInputService.TouchTap](https://developer.roblox.com/en-us/api-reference/event/UserInputService/TouchTap).
]=]
--[=[
@within Touch
@prop TouchTapInWorld Signal<(position: Vector2, processed: boolean)>
@tag Event
Proxy for [UserInputService.TouchTapInWorld](https://developer.roblox.com/en-us/api-reference/event/UserInputService/TouchTapInWorld).
]=]
--[=[
@within Touch
@prop TouchMoved Signal<(touch: InputObject, processed: boolean)>
@tag Event
Proxy for [UserInputService.TouchMoved](https://developer.roblox.com/en-us/api-reference/event/UserInputService/TouchMoved).
]=]
--[=[
@within Touch
@prop TouchLongPress Signal<(touchPositions: {Vector2}, state: Enum.UserInputState, processed: boolean)>
@tag Event
Proxy for [UserInputService.TouchLongPress](https://developer.roblox.com/en-us/api-reference/event/UserInputService/TouchLongPress).
]=]
--[=[
@within Touch
@prop TouchPan Signal<(touchPositions: {Vector2}, totalTranslation: Vector2, velocity: Vector2, state: Enum.UserInputState, processed: boolean)>
@tag Event
Proxy for [UserInputService.TouchPan](https://developer.roblox.com/en-us/api-reference/event/UserInputService/TouchPan).
]=]
--[=[
@within Touch
@prop TouchPinch Signal<(touchPositions: {Vector2}, scale: number, velocity: Vector2, state: Enum.UserInputState, processed: boolean)>
@tag Event
Proxy for [UserInputService.TouchPinch](https://developer.roblox.com/en-us/api-reference/event/UserInputService/TouchPinch).
]=]
--[=[
@within Touch
@prop TouchRotate Signal<(touchPositions: {Vector2}, rotation: number, velocity: number, state: Enum.UserInputState, processed: boolean)>
@tag Event
Proxy for [UserInputService.TouchRotate](https://developer.roblox.com/en-us/api-reference/event/UserInputService/TouchRotate).
]=]
--[=[
@within Touch
@prop TouchSwipe Signal<(swipeDirection: Enum.SwipeDirection, numberOfTouches: number, processed: boolean)>
@tag Event
Proxy for [UserInputService.TouchSwipe](https://developer.roblox.com/en-us/api-reference/event/UserInputService/TouchSwipe).
]=]
--[=[
@within Touch
@prop TouchStarted Signal<(touch: InputObject, processed: boolean)>
@tag Event
Proxy for [UserInputService.TouchStarted](https://developer.roblox.com/en-us/api-reference/event/UserInputService/TouchStarted).
]=]
--[=[
@within Touch
@prop TouchEnded Signal<(touch: InputObject, processed: boolean)>
@tag Event
Proxy for [UserInputService.TouchEnded](https://developer.roblox.com/en-us/api-reference/event/UserInputService/TouchEnded).
]=] | |
--------RIGHT DOOR -------- |
game.Workspace.doorright.l53.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]] |
local autoscaling = false --Estimates top speed
local UNITS = { --Click on speed to change units
--First unit is default
{
units = "MPH" ,
scaling = (10/12) * (60/88) , -- 1 stud : 10 inches | ft/s to MPH
maxSpeed = 140 ,
spInc = 20 , -- Increment between labelled notches
},
{
units = "KM/H" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 220 ,
spInc = 40 , -- Increment between labelled notches
},
{
units = "SPS" ,
scaling = 1 , -- Roblox standard
maxSpeed = 280 ,
spInc = 40 , -- Increment between labelled notches
}
}
|
-- Compare two arrays of strings line-by-line. Format as comparison lines. |
local function diffLinesUnified(
aLines: { [number]: string },
bLines: { [number]: string },
options: DiffOptions?
): string
if isEmptyString(aLines) then
aLines = {}
end
if isEmptyString(bLines) then
bLines = {}
end
return printDiffLines(diffLinesRaw(aLines, bLines), normalizeDiffOptions(options))
end
|
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = {};
local l__ReplicatedStorage__2 = game.ReplicatedStorage;
local v3 = require(game.ReplicatedStorage.Modules.Lightning);
local v4 = require(game.ReplicatedStorage.Modules.Xeno);
local l__TweenService__5 = game.TweenService;
local l__Debris__6 = game.Debris;
local u1 = require(game.ReplicatedStorage.Modules.CameraShaker);
function v1.RunStompFx(p1, p2, p3, p4)
local v7 = game.ReplicatedStorage.KillFX["Primary Bomb"].Explosion:Clone();
v7.Position = p2.Position;
v7.Parent = workspace.Ignored.Animations;
v7["1"]:Play();
task.delay(0.5, function()
v7.click:Play();
v7.Star.Enabled = true;
task.wait(0.25);
v7.Star.Enabled = false;
v7["2"]:Play();
if (p4.Character.PrimaryPart.Position - p2.Position).Magnitude < 25 then
local v8 = Instance.new("ColorCorrectionEffect", game.Lighting);
v8.TintColor = Color3.fromRGB(255, 144, 17);
game.TweenService:Create(v8, TweenInfo.new(1), {
TintColor = Color3.fromRGB(255, 255, 255)
}):Play();
game.Debris:AddItem(v8, 1);
local v9 = u1.new(Enum.RenderPriority.Camera.Value, function(p5)
workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * p5;
end);
v9:Start();
v9:Shake(u1.Presets.Bump);
end;
for v10, v11 in pairs(v7.Attachment:GetChildren()) do
v11.Enabled = true;
end;
for v12, v13 in pairs(p2.Parent:GetDescendants()) do
if v13:IsA("BasePart") then
v13.Transparency = 1;
end;
end;
task.wait(0.4);
for v14, v15 in pairs(v7.Attachment:GetChildren()) do
v15.Enabled = false;
end;
end);
return nil;
end;
return v1;
|
------------------------- |
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
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
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
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.F03
then StopE() DoorOpen()
end
end)end)
function StopE()
Car.BodyVelocity.velocity = Vector3.new(0, 0, 0)
Car.BodyPosition.position = Elevator.Floors.F03.Position
clicker = true
end
function DoorOpen()
while Shaft02.MetalDoor.Transparency < 1.0 do
Shaft02.MetalDoor.Transparency = Shaft02.MetalDoor.Transparency + .1
wait(0.000001)
end
Shaft02.MetalDoor.CanCollide = false
end
|
--[=[
@within TableUtil
@function Shuffle
@param tbl table
@param rngOverride Random?
@return table
Shuffles the table.
```lua
local t = {1, 2, 3, 4, 5, 6, 7, 8, 9}
local shuffled = TableUtil.Shuffle(t)
print(shuffled) --> e.g. {9, 4, 6, 7, 3, 1, 5, 8, 2}
```
:::note Arrays only
This function works on arrays, but not dictionaries.
]=] |
local function Shuffle(tbl: Table, rngOverride: Random?): Table
assert(type(tbl) == "table", "First argument must be a table")
local shuffled = table.clone(tbl)
local random = if typeof(rngOverride) == "Random" then rngOverride else rng
for i = #tbl, 2, -1 do
local j = random:NextInteger(1, i)
shuffled[i], shuffled[j] = shuffled[j], shuffled[i]
end
return shuffled
end
|
-- Initialize: |
Player.CameraMode = Enum.CameraMode.LockFirstPerson
RunService.Stepped:Connect(function()
end)
return nil
|
--------------------------------------------------------------# |
function Tween(instance,tweeninformation,goals)
TweenService:Create(instance,tweeninformation,goals):Play()
end
LightGroup = script.Parent.Lights:GetChildren()
while true do
wait(0)
if script.Parent.on.Value then
soundfolder.BlinkOn:Play()
for i = 1,#LightGroup do
Tween(script.Parent.DLR,TweenInfo.new(deltatime),{Transparency = 1}) -- Add DLR under the "Left" model to make this work
Tween(LightGroup[i],TweenInfo.new(deltatime),{Transparency = 0})
Tween(LightGroup[i].Light,TweenInfo.new(deltatime),{Brightness = 2})
end
wait(0.4)
soundfolder.BlinkOff:Play()
for i = 1,#LightGroup do
Tween(LightGroup[i],TweenInfo.new(deltatime),{Transparency = 1})
Tween(LightGroup[i].Light,TweenInfo.new(deltatime),{Brightness = 0})
end
wait(0.5)
else
for i = 1,#LightGroup do
Tween(script.Parent.DLR,TweenInfo.new(deltatime*2),{Transparency = 0})
Tween(LightGroup[i],TweenInfo.new(deltatime),{Transparency = 1})
Tween(LightGroup[i].Light,TweenInfo.new(deltatime),{Brightness = 0})
end
wait(0.1)
end
end
|
-- carSeat.Parent.Misc.IL.SS.Motor.DesiredAngle = -0.3 |
wait(1/3)
Debounce = false
end
elseif k == 'x' then -- hazards
if not Debounce then
Debounce = true
handler:FireServer('blinkers', 'Hazards')
wait(1/3)
Debounce = false
end
elseif k == 'q' then
carSeat.Parent.Misc.LP.SS.Motor.DesiredAngle = .1
elseif k == 'e' then
carSeat.Parent.Misc.RP.SS.Motor.DesiredAngle = -.1
end
end)
Mouse.KeyUp:connect(function(key)
local k = key:lower()
if k == 's' then
handler:FireServer('updateLights', 'brake', false)
elseif k == 'z' then
elseif k == 'q' then
carSeat.Parent.Misc.LP.SS.Motor.DesiredAngle = 0
elseif k == 'e' then
carSeat.Parent.Misc.RP.SS.Motor.DesiredAngle = 0
end
end)
handler.OnClientEvent:connect(function(...)
local Args = {...}
if Args[1] then
if Args[1] == 'blink' then
if Args[2] then
local P = Args[2]
if Args[3] then
local Play = Args[3]
script.Parent.Blink.Pitch = P
if Play == true then
script.Parent.Blink:Play()
elseif Play == false then
script.Parent.Blink:Stop()
end
end
end
end
end
end)
|
--Rescripted by Luckymaxer |
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
Speed = 100
Duration = 99
NozzleOffset = Vector3.new(0, 0.4, -1.1)
Sounds = {
Fire = Handle:WaitForChild("Fire"),
Reload = Handle:WaitForChild("Reload"),
HitFade = Handle:WaitForChild("HitFade")
}
PointLight = Handle:WaitForChild("PointLight")
ServerControl = (Tool:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
ServerControl.Name = "ServerControl"
ServerControl.Parent = Tool
ClientControl = (Tool:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
ClientControl.Name = "ClientControl"
ClientControl.Parent = Tool
ServerControl.OnServerInvoke = (function(player, Mode, Value, arg)
if player ~= Player or Humanoid.Health == 0 or not Tool.Enabled then
return
end
if Mode == "Click" and Value then
Activated(arg)
end
end)
function InvokeClient(Mode, Value)
pcall(function()
ClientControl:InvokeClient(Player, Mode, Value)
end)
end
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
function FindCharacterAncestor(Parent)
if Parent and Parent ~= game:GetService("Workspace") then
local humanoid = Parent:FindFirstChild("Humanoid")
if humanoid then
return Parent, humanoid
else
return FindCharacterAncestor(Parent.Parent)
end
end
return nil
end
function GetTransparentsRecursive(Parent, PartsTable)
local PartsTable = (PartsTable or {})
for i, v in pairs(Parent:GetChildren()) do
local TransparencyExists = false
pcall(function()
local Transparency = v["Transparency"]
if Transparency then
TransparencyExists = true
end
end)
if TransparencyExists then
table.insert(PartsTable, v)
end
GetTransparentsRecursive(v, PartsTable)
end
return PartsTable
end
function SelectionBoxify(Object)
local SelectionBox = Instance.new("SelectionBox")
SelectionBox.Adornee = Object
SelectionBox.Color = BrickColor.new("Really red")
SelectionBox.Parent = Object
return SelectionBox
end
local function Light(Object)
local Light = PointLight:Clone()
Light.Range = (Light.Range + 2)
Light.Parent = Object
end
function FadeOutObjects(Objects, FadeIncrement)
repeat
local LastObject = nil
for i, v in pairs(Objects) do
v.Transparency = (v.Transparency + FadeIncrement)
LastObject = v
end
wait()
until LastObject.Transparency >= 1 or not LastObject
end
function Dematerialize(character, humanoid, FirstPart)
if not character or not humanoid then
return
end
humanoid.WalkSpeed = 0
local Parts = {}
for i, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
v.Anchored = true
table.insert(Parts, v)
elseif v:IsA("LocalScript") or v:IsA("Script") then
v:Destroy()
end
end
local SelectionBoxes = {}
local FirstSelectionBox = SelectionBoxify(FirstPart)
Light(FirstPart)
wait(0.05)
for i, v in pairs(Parts) do
if v ~= FirstPart then
table.insert(SelectionBoxes, SelectionBoxify(v))
Light(v)
end
end
local ObjectsWithTransparency = GetTransparentsRecursive(character)
FadeOutObjects(ObjectsWithTransparency, 0.1)
wait(0.5)
character:BreakJoints()
humanoid.Health = 0
Debris:AddItem(character, 2)
local FadeIncrement = 0.05
Delay(0.2, function()
FadeOutObjects({FirstSelectionBox}, FadeIncrement)
if character and character.Parent then
character:Destroy()
end
end)
FadeOutObjects(SelectionBoxes, FadeIncrement)
end
function Touched(Projectile, Hit)
if not Hit or not Hit.Parent then
return
end
local character, humanoid = FindCharacterAncestor(Hit)
if character and humanoid and character ~= Character then
local ForceFieldExists = false
for i, v in pairs(character:GetChildren()) do
if v:IsA("ForceField") then
ForceFieldExists = true
end
end
if not ForceFieldExists then
if Projectile then
local HitFadeSound = Projectile:FindFirstChild(Sounds.HitFade.Name)
local torso = humanoid.Torso
if HitFadeSound and torso then
HitFadeSound.Parent = torso
HitFadeSound:Play()
end
end
Dematerialize(character, humanoid, Hit)
end
if Projectile and Projectile.Parent then
Projectile:Destroy()
end
end
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
if not Player or not Humanoid or Humanoid.Health == 0 then
return
end
end
function Activated(target)
if Tool.Enabled and Humanoid.Health > 0 then
Tool.Enabled = false
InvokeClient("PlaySound", Sounds.Fire)
local HandleCFrame = Handle.CFrame
local FiringPoint = HandleCFrame.p + HandleCFrame:vectorToWorldSpace(NozzleOffset)
local ShotCFrame = CFrame.new(FiringPoint, target)
local LaserShotClone = BaseShot:Clone()
LaserShotClone.CFrame = ShotCFrame + (ShotCFrame.lookVector * (BaseShot.Size.Z / 2))
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.velocity = ShotCFrame.lookVector * Speed
BodyVelocity.Parent = LaserShotClone
LaserShotClone.Touched:connect(function(Hit)
if not Hit or not Hit.Parent then
return
end
Touched(LaserShotClone, Hit)
end)
Debris:AddItem(LaserShotClone, Duration)
LaserShotClone.Parent = game:GetService("Workspace")
wait(0.6) -- FireSound length
InvokeClient("PlaySound", Sounds.Reload)
wait(0.75) -- ReloadSound length
Tool.Enabled = true
end
end
function Unequipped()
end
BaseShot = Instance.new("Part")
BaseShot.Name = "Effect"
BaseShot.BrickColor = BrickColor.new("Really red")
BaseShot.Material = Enum.Material.Plastic
BaseShot.Shape = Enum.PartType.Block
BaseShot.TopSurface = Enum.SurfaceType.Smooth
BaseShot.BottomSurface = Enum.SurfaceType.Smooth
BaseShot.FormFactor = Enum.FormFactor.Custom
BaseShot.Size = Vector3.new(0.2, 0.2, 3)
BaseShot.CanCollide = false
BaseShot.Locked = true
SelectionBoxify(BaseShot)
Light(BaseShot)
BaseShotSound = Sounds.HitFade:Clone()
BaseShotSound.Parent = BaseShot
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
-- Management of which options appear on the Roblox User Settings screen |
do
local PlayerScripts = Players.LocalPlayer:WaitForChild("PlayerScripts")
PlayerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Default)
PlayerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Follow)
PlayerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Classic)
PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Default)
PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Follow)
PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Classic)
PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.CameraToggle)
end
function CameraModule.new()
local self = setmetatable({},CameraModule)
-- Current active controller instances
self.activeCameraController = nil
self.activeOcclusionModule = nil
self.activeTransparencyController = nil
self.activeMouseLockController = nil
self.currentComputerCameraMovementMode = nil
-- Connections to events
self.cameraSubjectChangedConn = nil
self.cameraTypeChangedConn = nil
-- Adds CharacterAdded and CharacterRemoving event handlers for all current players
for _,player in pairs(Players:GetPlayers()) do
self:OnPlayerAdded(player)
end
-- Adds CharacterAdded and CharacterRemoving event handlers for all players who join in the future
Players.PlayerAdded:Connect(function(player)
self:OnPlayerAdded(player)
end)
self.activeTransparencyController = TransparencyController.new()
self.activeTransparencyController:Enable(true)
if not UserInputService.TouchEnabled then
self.activeMouseLockController = MouseLockController.new()
local toggleEvent = self.activeMouseLockController:GetBindableToggleEvent()
if toggleEvent then
toggleEvent:Connect(function()
self:OnMouseLockToggled()
end)
end
end
self:ActivateCameraController(self:GetCameraControlChoice())
self:ActivateOcclusionModule(Players.LocalPlayer.DevCameraOcclusionMode)
self:OnCurrentCameraChanged() -- Does initializations and makes first camera controller
RunService:BindToRenderStep("cameraRenderUpdate", Enum.RenderPriority.Camera.Value, function(dt) self:Update(dt) end)
-- Connect listeners to camera-related properties
for _, propertyName in pairs(PLAYER_CAMERA_PROPERTIES) do
Players.LocalPlayer:GetPropertyChangedSignal(propertyName):Connect(function()
self:OnLocalPlayerCameraPropertyChanged(propertyName)
end)
end
for _, propertyName in pairs(USER_GAME_SETTINGS_PROPERTIES) do
UserGameSettings:GetPropertyChangedSignal(propertyName):Connect(function()
self:OnUserGameSettingsPropertyChanged(propertyName)
end)
end
game.Workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function()
self:OnCurrentCameraChanged()
end)
self.lastInputType = UserInputService:GetLastInputType()
UserInputService.LastInputTypeChanged:Connect(function(newLastInputType)
self.lastInputType = newLastInputType
end)
return self
end
function CameraModule:GetCameraMovementModeFromSettings()
local cameraMode = Players.LocalPlayer.CameraMode
-- Lock First Person trumps all other settings and forces ClassicCamera
if cameraMode == Enum.CameraMode.LockFirstPerson then
return CameraUtils.ConvertCameraModeEnumToStandard(Enum.ComputerCameraMovementMode.Classic)
end
local devMode, userMode
if UserInputService.TouchEnabled then
devMode = CameraUtils.ConvertCameraModeEnumToStandard(Players.LocalPlayer.DevTouchCameraMode)
userMode = CameraUtils.ConvertCameraModeEnumToStandard(UserGameSettings.TouchCameraMovementMode)
else
devMode = CameraUtils.ConvertCameraModeEnumToStandard(Players.LocalPlayer.DevComputerCameraMode)
userMode = CameraUtils.ConvertCameraModeEnumToStandard(UserGameSettings.ComputerCameraMovementMode)
end
if devMode == Enum.DevComputerCameraMovementMode.UserChoice then
-- Developer is allowing user choice, so user setting is respected
return userMode
end
return devMode
end
function CameraModule:ActivateOcclusionModule( occlusionMode )
local newModuleCreator
if occlusionMode == Enum.DevCameraOcclusionMode.Zoom then
newModuleCreator = Poppercam
elseif occlusionMode == Enum.DevCameraOcclusionMode.Invisicam then
newModuleCreator = Invisicam
else
warn("CameraScript ActivateOcclusionModule called with unsupported mode")
return
end
self.occlusionMode = occlusionMode
-- First check to see if there is actually a change. If the module being requested is already
-- the currently-active solution then just make sure it's enabled and exit early
if self.activeOcclusionModule and self.activeOcclusionModule:GetOcclusionMode() == occlusionMode then
if not self.activeOcclusionModule:GetEnabled() then
self.activeOcclusionModule:Enable(true)
end
return
end
-- Save a reference to the current active module (may be nil) so that we can disable it if
-- we are successful in activating its replacement
local prevOcclusionModule = self.activeOcclusionModule
-- If there is no active module, see if the one we need has already been instantiated
self.activeOcclusionModule = instantiatedOcclusionModules[newModuleCreator]
-- If the module was not already instantiated and selected above, instantiate it
if not self.activeOcclusionModule then
self.activeOcclusionModule = newModuleCreator.new()
if self.activeOcclusionModule then
instantiatedOcclusionModules[newModuleCreator] = self.activeOcclusionModule
end
end
-- If we were successful in either selecting or instantiating the module,
-- enable it if it's not already the currently-active enabled module
if self.activeOcclusionModule then
local newModuleOcclusionMode = self.activeOcclusionModule:GetOcclusionMode()
-- Sanity check that the module we selected or instantiated actually supports the desired occlusionMode
if newModuleOcclusionMode ~= occlusionMode then
warn("CameraScript ActivateOcclusionModule mismatch: ",self.activeOcclusionModule:GetOcclusionMode(),"~=",occlusionMode)
end
-- Deactivate current module if there is one
if prevOcclusionModule then
-- Sanity check that current module is not being replaced by itself (that should have been handled above)
if prevOcclusionModule ~= self.activeOcclusionModule then
prevOcclusionModule:Enable(false)
else
warn("CameraScript ActivateOcclusionModule failure to detect already running correct module")
end
end
-- Occlusion modules need to be initialized with information about characters and cameraSubject
-- Invisicam needs the LocalPlayer's character
-- Poppercam needs all player characters and the camera subject
if occlusionMode == Enum.DevCameraOcclusionMode.Invisicam then
-- Optimization to only send Invisicam what we know it needs
if Players.LocalPlayer.Character then
self.activeOcclusionModule:CharacterAdded(Players.LocalPlayer.Character, Players.LocalPlayer )
end
else
-- When Poppercam is enabled, we send it all existing player characters for its raycast ignore list
for _, player in pairs(Players:GetPlayers()) do
if player and player.Character then
self.activeOcclusionModule:CharacterAdded(player.Character, player)
end
end
self.activeOcclusionModule:OnCameraSubjectChanged(game.Workspace.CurrentCamera.CameraSubject)
end
-- Activate new choice
self.activeOcclusionModule:Enable(true)
end
end
function CameraModule:ShouldUseVehicleCamera()
local camera = workspace.CurrentCamera
if not camera then
return false
end
local cameraType = camera.CameraType
local cameraSubject = camera.CameraSubject
local isEligibleType = cameraType == Enum.CameraType.Custom or cameraType == Enum.CameraType.Follow
local isEligibleSubject = cameraSubject and cameraSubject:IsA("VehicleSeat") or false
local isEligibleOcclusionMode = self.occlusionMode ~= Enum.DevCameraOcclusionMode.Invisicam
return isEligibleSubject and isEligibleType and isEligibleOcclusionMode
end
|
-- LIGHT SETTINGS
--[[
LIGHT TYPES:
- Halogen
- LED
]] | --
local Low_Beam_Brightness = 2.25
local High_Beam_Brightness = 3.15
local Fog_Light_Brightness = 0.7
local Rear_Light_Brightness = 1.5
local Brake_Light_Brightness = 2.5
local Reverse_Light_Brightness = 1
local Headlight_Type = "Halogen"
local Indicator_Type = "Halogen"
local Fog_Light_Type = "Halogen"
local Plate_Light_Type = "Halogen"
local Rear_Light_Type = "Halogen"
local Reverse_Light_Type = "Halogen"
local Running_Light_Location = "Custom DRL" -- Where your running lights will luminate. ("Low Beam / Indicators" and "Low Beam". LED DRLS or any DRL in a differnet position go in the Running model, change the string to "Custom DRL")
local CustomDRL_Type = "LED"
local Fade_Time = 0.35 -- How long it takes for the light to fully turn on. (works only with Halogen, default is 0.35 seconds)
local Indicator_Flash_Rate = 0.3 -- Rate of change between each indicator state. (in seconds)
local Popup_Hinge_Angle = -0.75 -- Changes the angle of your popup headlights. (only use if your car has popups)
|
--Basic setup |
local ViewPort = script.Parent.ViewportFrame
|
------------------------------------------------------------------------ |
local PlayerState = {} do
local mouseBehavior
local mouseIconEnabled
local cameraType
local cameraFocus
local cameraCFrame
local cameraFieldOfView
local screenGuis = {}
local coreGuis = {
Backpack = true,
Chat = true,
Health = true,
PlayerList = true,
}
local setCores = {
BadgesNotificationsActive = true,
PointsNotificationsActive = true,
}
-- Save state and set up for freecam
function PlayerState.Push()
--for name in pairs(coreGuis) do
-- coreGuis[name] = StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType[name])
-- StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType[name], false)
--end
--for name in pairs(setCores) do
-- setCores[name] = StarterGui:GetCore(name)
-- StarterGui:SetCore(name, false)
--end
--local playergui = LocalPlayer:FindFirstChildOfClass("PlayerGui")
--if playergui then
-- for _, gui in pairs(playergui:GetChildren()) do
-- if gui:IsA("ScreenGui") and gui.Enabled then
-- screenGuis[#screenGuis + 1] = gui
-- gui.Enabled = false
-- end
-- end
--end
cameraFieldOfView = Camera.FieldOfView
Camera.FieldOfView = 70
cameraType = Camera.CameraType
Camera.CameraType = Enum.CameraType.Custom
cameraCFrame = Camera.CFrame
cameraFocus = Camera.Focus
mouseIconEnabled = UserInputService.MouseIconEnabled
UserInputService.MouseIconEnabled = true
mouseBehavior = UserInputService.MouseBehavior
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
-- Restore state
function PlayerState.Pop()
for name, isEnabled in pairs(coreGuis) do
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType[name], isEnabled)
end
for name, isEnabled in pairs(setCores) do
StarterGui:SetCore(name, isEnabled)
end
for _, gui in pairs(screenGuis) do
if gui.Parent then
gui.Enabled = true
end
end
Camera.FieldOfView = cameraFieldOfView
cameraFieldOfView = nil
Camera.CameraType = cameraType
cameraType = nil
Camera.CFrame = cameraCFrame
cameraCFrame = nil
Camera.Focus = cameraFocus
cameraFocus = nil
UserInputService.MouseIconEnabled = mouseIconEnabled
mouseIconEnabled = nil
UserInputService.MouseBehavior = mouseBehavior
mouseBehavior = nil
end
end
local function StartFreecam()
local cameraCFrame = Camera.CFrame
cameraRot = Vector2.new(cameraCFrame:toEulerAnglesYXZ())
cameraPos = cameraCFrame.p
cameraFov = Camera.FieldOfView
velSpring:Reset(Vector3.new())
panSpring:Reset(Vector2.new())
fovSpring:Reset(0)
PlayerState.Push()
RunService:BindToRenderStep("Freecam", Enum.RenderPriority.Camera.Value, StepFreecam)
Input.StartCapture()
end
local function StopFreecam()
Input.StopCapture()
RunService:UnbindFromRenderStep("Freecam")
PlayerState.Pop()
end
|
--[[
LOWGames Studios
Date: 27 October 2022
by Elder
]] | --
local v1 = require(game.ReplicatedStorage:WaitForChild("Framework"):WaitForChild("Library"));
while not v1.Loaded do
game:GetService("RunService").Heartbeat:Wait();
end;
return function(p1, p2, ...)
local v2, v3 = ...;
local v4 = v3 or Color3.fromRGB(111, 111, 111);
p1.title.Text = v2;
if v4 == "Dark Matter" then
coroutine.wrap(function()
while not p1.Parent do
v1.RenderStepped();
end;
local v5 = os.clock();
while p1 and p1.Parent do
p1.title.back.BackgroundColor3 = Color3.fromRGB(57, 8, 70):Lerp(Color3.fromRGB(0, 0, 0), math.sin((os.clock() - v5) * 50) / 2 + 0.5);
v1.RenderStepped();
end;
end)();
return;
end;
if v4 == "Rainbow" then
coroutine.wrap(function()
while not p1.Parent do
v1.RenderStepped();
end;
v1.GUIFX.Rainbow(p1.title.back, "BackgroundColor3", 3);
end)();
return;
end;
if v4 == "Golden" then
coroutine.wrap(function()
while not p1.Parent do
v1.RenderStepped();
end;
local v6 = os.clock();
while p1 and p1.Parent do
p1.title.back.BackgroundColor3 = Color3.fromRGB(255, 253, 184):Lerp(Color3.fromRGB(255, 213, 61), math.sin((os.clock() - v6) * 4) / 2 + 0.5);
v1.RenderStepped();
end;
end)();
return;
end;
p1.title.back.BackgroundColor3 = v4;
end;
|
--- Parses all of the command arguments into ArgumentContexts
-- Called by the command dispatcher automatically
-- allowIncompleteArguments: if true, will not throw an error for missing arguments |
function Command:Parse (allowIncompleteArguments)
local hadOptional = false
for i, definition in ipairs(self.ArgumentDefinitions) do
if type(definition) == "function" then
definition = definition(self)
if definition == nil then
break
end
end
local required = (definition.Default == nil and definition.Optional ~= true)
if required and hadOptional then
error(("Command %q: Required arguments cannot occur after optional arguments."):format(self.Name))
elseif not required then
hadOptional = true
end
if self.RawArguments[i] == nil and required and allowIncompleteArguments ~= true then
return false, ("Required argument #%d %s is missing."):format(i, definition.Name)
elseif self.RawArguments[i] or allowIncompleteArguments then
self.Arguments[i] = Argument.new(self, definition, self.RawArguments[i] or "")
end
end
return true
end
|
-- Services |
local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
|
--[[ -------------------------------------------- ]] | --
local lplr = game:getService("Players").LocalPlayer
local r = game:service("RunService")
local mouse = lplr:GetMouse()
local sp = script.Parent
local running = false
function waitForChild(parent, childName)
while true do
local child = parent:findFirstChild(childName)
if child then
return child
end
parent.ChildAdded:wait()
end
end |
--- RUNTIME --- |
UserInputService.InputBegan:Connect(Input)
UserInputService.InputEnded:Connect(Input)
|
--[[Run]] |
--Print Version
local ver=require(car["A-Chassis Tune"].README)
print("//INSPARE: AC6 Loaded - Build "..ver)
--Runtime Loop
while wait() do
--Steering
Steering()
--Powertrain
Engine()
--Flip
if _Tune.AutoFlip then Flip() end
--Update External Values
_IsOn = script.Parent.IsOn.Value
_InControls = script.Parent.ControlsOpen.Value
script.Parent.Values.Gear.Value = _CGear
script.Parent.Values.RPM.Value = _RPM
script.Parent.Values.Horsepower.Value = _HP
script.Parent.Values.Torque.Value = _HP * 5250 / _RPM
script.Parent.Values.TransmissionMode.Value = _TMode
script.Parent.Values.Throttle.Value = _GThrot
script.Parent.Values.Brake.Value = _GBrake
script.Parent.Values.SteerC.Value = _GSteerC*(1-math.min(car.DriveSeat.Velocity.Magnitude/_Tune.SteerDecay,1-(_Tune.MinSteer/100)))
script.Parent.Values.SteerT.Value = _GSteerT
script.Parent.Values.PBrake.Value = _PBrake
script.Parent.Values.TCS.Value = _TCS
script.Parent.Values.TCSActive.Value = _TCSActive
script.Parent.Values.ABS.Value = _ABS
script.Parent.Values.ABSActive.Value = _ABSActive
script.Parent.Values.MouseSteerOn.Value = _MSteer
script.Parent.Values.Velocity.Value = car.DriveSeat.Velocity
--Vehicleseat Speedometer
if _PGear~=_CGear then
_PGear=_CGear
car.DriveSeat.MaxSpeed = car.DriveSeat.Velocity.Magnitude*(_Tune.Redline/_RPM)
end
end
|
--[[**
<description>
Run this once to combine all keys provided into one "main key".
Internally, this means that data will be stored in a table with the key mainKey.
This is used to get around the 2-DataStore2 reliability caveat.
</description>
<parameter name = "mainKey">
The key that will be used to house the table.
</parameter>
<parameter name = "...">
All the keys to combine under one table.
</parameter>
**--]] |
function DataStore2.Combine(mainKey, ...)
for _, name in pairs({...}) do
combinedDataStoreInfo[name] = mainKey
end
end
function DataStore2.ClearCache()
DataStoreCache = {}
end
function DataStore2.SaveAll(player)
if DataStoreCache[player] then
for _, dataStore in pairs(DataStoreCache[player]) do
if dataStore.combinedStore == nil then
dataStore:Save()
end
end
end
end
function DataStore2.PatchGlobalSettings(patch)
for key, value in pairs(patch) do
assert(Settings[key] ~= nil, "No such key exists: " .. key)
-- TODO: Implement type checking with this when osyris' t is in
Settings[key] = value
end
end
function DataStore2.__call(_, dataStoreName, player)
assert(
typeof(dataStoreName) == "string" and typeof(player) == "Instance",
("DataStore2() API call expected {string dataStoreName, Instance player}, got {%s, %s}")
:format(
typeof(dataStoreName),
typeof(player)
)
)
if DataStoreCache[player] and DataStoreCache[player][dataStoreName] then
return DataStoreCache[player][dataStoreName]
elseif combinedDataStoreInfo[dataStoreName] then
local dataStore = DataStore2(combinedDataStoreInfo[dataStoreName], player)
dataStore:BeforeSave(function(combinedData)
for key in pairs(combinedData) do
if combinedDataStoreInfo[key] then
local combinedStore = DataStore2(key, player)
local value = combinedStore:Get(nil, true)
if value ~= nil then
if combinedStore.combinedBeforeSave then
value = combinedStore.combinedBeforeSave(clone(value))
end
combinedData[key] = value
end
end
end
return combinedData
end)
local combinedStore = setmetatable({
combinedName = dataStoreName,
combinedStore = dataStore,
}, {
__index = function(_, key)
return CombinedDataStore[key] or dataStore[key]
end
})
if not DataStoreCache[player] then
DataStoreCache[player] = {}
end
DataStoreCache[player][dataStoreName] = combinedStore
return combinedStore
end
local dataStore = {}
dataStore.Name = dataStoreName
dataStore.UserId = player.UserId
dataStore.callbacks = {}
dataStore.beforeInitialGet = {}
dataStore.afterSave = {}
dataStore.bindToClose = {}
dataStore.savingMethod = SavingMethods[Settings.SavingMethod].new(dataStore)
setmetatable(dataStore, DataStoreMetatable)
local event, fired = Instance.new("BindableEvent"), false
game:BindToClose(function()
--if not fired then
-- --spawn(function()
-- -- player.Parent = nil -- Forces AncestryChanged to fire and save the data
-- --end)
-- event.Event:wait()
--end
local value = dataStore:Get(nil, true)
for _, bindToClose in pairs(dataStore.bindToClose) do
bindToClose(player, value)
end
end)
local playerLeavingConnection
playerLeavingConnection = player.AncestryChanged:Connect(function()
if player:IsDescendantOf(game) then return end
playerLeavingConnection:Disconnect()
dataStore:SaveAsync():andThen(function()
print("player left, saved " .. dataStoreName)
end):catch(function(error)
-- TODO: Something more elegant
warn("error when player left! " .. error)
end):finally(function()
event:Fire()
fired = true
end)
delay(40, function() --Give a long delay for people who haven't figured out the cache :^(
DataStoreCache[player] = nil
end)
end)
if not DataStoreCache[player] then
DataStoreCache[player] = {}
end
DataStoreCache[player][dataStoreName] = dataStore
return dataStore
end
DataStore2.Constants = Constants
return setmetatable(DataStore2, DataStore2)
|
--Adds a rocket to the buffer. |
local function AddBufferRocket()
local NewRocket = RocketCreator:CreateRocket(true)
CurrentRocket = NewRocket
RocketBuffer:AddItem(NewRocket)
end
AddBufferRocket()
|
-- map a value from one range to another |
local function map(x: number, inMin: number, inMax: number, outMin: number, outMax: number): number
return (x - inMin)*(outMax - outMin)/(inMax - inMin) + outMin
end
local function playSound(sound)
sound.TimePosition = 0
sound.Playing = true
end
local function stopSound(sound)
sound.Playing = false
sound.TimePosition = 0
end
local function initializeSoundSystem(player, humanoid: Humanoid, rootPart: BasePart)
local sounds: { [string]: Sound } = {}
-- 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.RollOffMinDistance = 5
sound.RollOffMaxDistance = 150
sound.RollOffMode = Enum.RollOffMode.Linear
sound.Volume = 0.65
for propName, propValue in pairs(props) do
sound[propName] = propValue
end
sound.Parent = rootPart
sounds[name] = sound
end
local playingLoopedSounds = {}
local function stopPlayingLoopedSounds(except: Sound?)
for sound in pairs(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.AssemblyLinearVelocity.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.AssemblyLinearVelocity.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.AssemblyLinearVelocity.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(delta: any, sound: any, velocity)
if velocity.Magnitude > 75 then
sound.Volume = math.clamp(sound.Volume + .9 * delta, 0, 1)
else
sound.Volume = 0
end
end,
[sounds.Running] = function(dt, sound: any, vel)
--sound.Playing = vel.Magnitude > 0.5 and humanoid.MoveDirection.Magnitude > 0.5
sound.SoundId = FootstepsSoundGroup:WaitForChild(humanoid.FloorMaterial).SoundId
sound.PlaybackSpeed = FootstepsSoundGroup:WaitForChild(humanoid.FloorMaterial).PlaybackSpeed * (vel.Magnitude/20)
sound.Volume = FootstepsSoundGroup:WaitForChild(humanoid.FloorMaterial).Volume * (vel.Magnitude/12) * 1
sound.EmitterSize = FootstepsSoundGroup:WaitForChild(humanoid.FloorMaterial).Volume * (vel.Magnitude/12) * 50 * 1
if FootstepsSoundGroup:FindFirstChild(humanoid.FloorMaterial) == nil then
sound.SoundId = FootstepsSoundGroup:WaitForChild("nil Sound").SoundId
sound.PlaybackSpeed = FootstepsSoundGroup:WaitForChild("nil Sound").PlaybackSpeed
sound.EmitterSize = FootstepsSoundGroup:WaitForChild("nil Sound").Volume
sound.Volume = FootstepsSoundGroup:WaitForChild("nil Sound").Volume
end
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 activeConnections = {}
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.AssemblyLinearVelocity)
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
local Character = Players.LocalPlayer.Character or Players.LocalPlayer.CharacterAppearanceLoaded:Wait()
local Head = Character.PrimaryPart
local RunningSound = Head:WaitForChild("Running")
local Humanoid = Character:FindFirstChildOfClass('Humanoid')
local lastspeed = 0
Humanoid.Running:Connect(function(speed: number)
RunningSound.PlaybackSpeed = FootstepsSoundGroup:WaitForChild(Humanoid.FloorMaterial).PlaybackSpeed * (speed/20) * (math.random(30,50)/40)
RunningSound.Volume = FootstepsSoundGroup:WaitForChild(Humanoid.FloorMaterial).Volume * (lastspeed/12)
RunningSound.EmitterSize = FootstepsSoundGroup:WaitForChild(Humanoid.FloorMaterial).Volume * (lastspeed/12) * 50
lastspeed = speed
end)
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 610 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 5000 -- Use sliders to manipulate values
Tune.Redline = 6800 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 2 -- 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)
|
--[[
Module that can be used to ragdoll arbitrary R6/R15 rigs or set whether players ragdoll or fall to pieces by default
--]] |
local EVENT_NAME = "Event"
local RAGDOLLED_TAG = "__Ragdoll_Active"
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local CollectionService = game:GetService("CollectionService")
local StarterGui = game:GetService("StarterGui")
local RigTypes = require(script:WaitForChild("RigTypes"))
if RunService:IsServer() then
-- Used for telling the client to set their own character to Physics mode:
local event = Instance.new("RemoteEvent")
event.Name = EVENT_NAME
event.Parent = script
-- Whether players ragdoll by default: (true = ragdoll, false = fall into pieces)
local playerDefault = false
-- Activating ragdoll on an arbitrary model with a Humanoid:
local function activateRagdoll(model, humanoid)
assert(humanoid:IsDescendantOf(model))
if CollectionService:HasTag(model, RAGDOLLED_TAG) then
return
end
CollectionService:AddTag(model, RAGDOLLED_TAG)
local attachments = RigTypes:GetAttachments(model, humanoid)
-- Propagate to player if applicable:
local player = Players:GetPlayerFromCharacter(model)
if player then
event:FireClient(player, true, model, humanoid)
elseif model.PrimaryPart then
event:FireAllClients(false, model, humanoid)
end
-- Turn into loose body:
humanoid:ChangeState(Enum.HumanoidStateType.Physics)
-- Instantiate BallSocketConstraints:
for name, objects in pairs(attachments) do
local parent = model:FindFirstChild(name)
if parent then
local constraint = Instance.new("BallSocketConstraint")
constraint.Attachment0 = objects[1]
constraint.Attachment1 = objects[2]
if parent.Name == "Head" then
constraint.LimitsEnabled = true
constraint.UpperAngle = 60
constraint.TwistLimitsEnabled = true
constraint.TwistLowerAngle = -60
constraint.TwistUpperAngle = 60
end
constraint.Parent = parent
end
end
-- Destroy all regular joints:
for _, motor in pairs(model:GetDescendants()) do
if motor:IsA("Motor6D") then
motor:Destroy()
end
end
end
-- Set player Humanoid properties:
local function onHumanoidAdded(character, humanoid)
humanoid.BreakJointsOnDeath = not playerDefault
humanoid.Died:Connect(
function()
if playerDefault then
-- Ragdoll them:
humanoid.BreakJointsOnDeath = false
activateRagdoll(character, humanoid)
end
end
)
end
-- Track existing and new player Humanoids:
local function onCharacterAdded(character)
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
onHumanoidAdded(character, humanoid)
else
character.ChildAdded:Connect(
function(child)
if child:IsA("Humanoid") then
onHumanoidAdded(character, child)
end
end
)
end
end
-- Track existing and new player characters:
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterAdded)
if player.Character then
onCharacterAdded(player.Character)
end
end
-- Track all players:
Players.PlayerAdded:Connect(onPlayerAdded)
for _, player in pairs(Players:GetPlayers()) do
onPlayerAdded(player)
end
-- Activating the ragdoll on a specific model
function Ragdoll:Activate(model)
if typeof(model) ~= "Instance" or not model:IsA("Model") then
error("bad argument #1 to 'Activate' (Model expected, got " .. typeof(model) .. ")", 2)
end
-- Model must have a humanoid:
local humanoid = model:FindFirstChildOfClass("Humanoid")
if not humanoid then
return warn("[Ragdoll] Could not ragdoll " .. model:GetFullName() .. " because it has no Humanoid")
end
activateRagdoll(model, humanoid)
end
-- Setting whether players ragdoll when dying by default: (true = ragdoll, false = fall into pieces)
function Ragdoll:SetPlayerDefault(enabled)
if enabled ~= nil and typeof(enabled) ~= "boolean" then
error("bad argument #1 to 'SetPlayerDefault' (boolean expected, got " .. typeof(enabled) .. ")", 2)
end
playerDefault = enabled
-- Update BreakJointsOnDeath for all alive characters:
for _, player in pairs(Players:GetPlayers()) do
if player.Character then
local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid.BreakJointsOnDeath = not playerDefault
end
end
end
end
else -- Client
-- Client sets their own character to Physics mode when told to:
script:WaitForChild(EVENT_NAME).OnClientEvent:Connect(
function(isSelf, model, humanoid)
if isSelf then
local head = model:FindFirstChild("Head")
if head then
workspace.CurrentCamera.CameraSubject = head
end
end
humanoid:ChangeState(Enum.HumanoidStateType.Physics)
end
)
-- Other API not available from client-side:
function Ragdoll:Activate()
error("Ragdoll::Activate cannot be used from the client", 2)
end
function Ragdoll:SetPlayerDefault()
error("Ragdoll::SetPlayerDefault cannot be used from the client", 2)
end
end
return Ragdoll
|
--- Alias of self:SendEvent(self.Executor, "AddLine", text) |
function Command:Reply(...)
return self:SendEvent(self.Executor, "AddLine", ...)
end
|
-- << FUNCTIONS >> |
function module:ToggleBar(keyCode)
if keyCode == Enum.KeyCode.Quote then
local cmdBar = main.gui.CmdBar
if cmdBar.Visible then
main:GetModule("CmdBar"):CloseCmdBar()
else
main:GetModule("CmdBar"):OpenCmdBar()
end
elseif keyCode == Enum.KeyCode.Semicolon then
local requiredRank = main.settings.Cmdbar2
if main.pdata.Rank > 0 or requiredRank <= 0 then
if main.pdata.Rank < requiredRank then
local notice = main:GetModule("cf"):FormatNotice("CommandBarLocked", "2", main:GetModule("cf"):GetRankName(requiredRank))
main:GetModule("Notices"):Notice("Error", notice[1], notice[2])
else
local props = currentProps["cmdbar2"]
if not props then
main:GetModule("ClientCommands")["cmdbar2"].Function()
else
if props.mainParent.Visible then
props.mainParent.Visible = false
else
props.mainParent.Visible = true
end
end
end
end
end
end
function module:OpenCmdBar()
local props = mainProps
local requiredRank = main.settings.Cmdbar
if (main.pdata.Rank > 0 or requiredRank <= 0) and not isOpen then
isOpen = true
if main.pdata.Rank < requiredRank then
local notice = main:GetModule("cf"):FormatNotice("CommandBarLocked", "", main:GetModule("cf"):GetRankName(requiredRank))
main:GetModule("Notices"):Notice("Error", notice[1], notice[2])
else
props.textBox:CaptureFocus()
for _,coreName in pairs(coreToHide) do
local originalState = main.starterGui:GetCoreGuiEnabled(coreName)
originalCoreStates[coreName] = originalState
main.starterGui:SetCoreGuiEnabled(Enum.CoreGuiType[coreName], false)
end
--main:GetModule("TopBar"):CoreGUIsChanged()
topBar.BackgroundColor3 = Color3.fromRGB(50,50,50)
originalTopBarTransparency = topBar.BackgroundTransparency
originalTopBarVisibility = topBar.Visible
topBar.BackgroundTransparency = 0
topBar.Visible = true
props.textBox.Text = ""
cmdBar.Visible = true
wait()
props.textBox.Text = main.pdata.Prefix
props.textBox.CursorPosition = 3
end
end
end
function module:CloseCmdBar()
if not isOpen then return end
isOpen = false
local props = mainProps
cmdBar.Visible = false
for _,coreName in pairs(coreToHide) do
local originalState = originalCoreStates[coreName]
if originalState then
main.starterGui:SetCoreGuiEnabled(Enum.CoreGuiType[coreName], originalState)
end
end
--main:GetModule("TopBar"):CoreGUIsChanged()
topBar.BackgroundColor3 = Color3.fromRGB(31,31,31)
topBar.BackgroundTransparency = originalTopBarTransparency
topBar.Visible = originalTopBarVisibility
coroutine.wrap(function()
for i = 1,10 do
props.textBox:ReleaseFocus()
wait()
end
end)()
end
function module:PressedArrowKey(key)
for i, props in pairs(currentProps) do
if props.mainParent.Visible and props.textBox:IsFocused() then
local originalLabel = props.rframe:FindFirstChild("Label"..props.suggestionPos)
if key == Enum.KeyCode.Down then
props.suggestionPos = props.suggestionPos + 1
if props.suggestionPos > props.suggestionDisplayed then
props.suggestionPos = 1
end
elseif key == Enum.KeyCode.Up then
props.suggestionPos = props.suggestionPos - 1
if props.suggestionPos < 1 then
props.suggestionPos = props.suggestionDisplayed
end
elseif key == Enum.KeyCode.Right then
selectSuggestion(props)
end
local newLabel = props.rframe["Label"..props.suggestionPos]
if newLabel ~= originalLabel then
originalLabel.BackgroundColor3 = props.otherColor
newLabel.BackgroundColor3 = props.highlightColor
end
end
end
end
return module
|
--[=[
@within Shake
@prop Sustain boolean
If `true`, the shake will sustain itself indefinitely once it fades
in. If `StopSustain()` is called, the sustain will end and the shake
will fade out based on the `FadeOutTime`.
Defaults to `false`.
]=] | |
-- The optional property of matcher context is true if undefined. |
function isExpand(expand: boolean?)
return expand ~= false
end
local PRINT_LIMIT = 3
local NO_ARGUMENTS = "called with 0 arguments"
function printExpectedArgs(expected: Array<any>): string
if #expected == 0 then
return NO_ARGUMENTS
else
return Array.join(
Array.map(expected, function(arg)
return printExpected(arg)
end),
", "
)
end
end
function printReceivedArgs(received: Array<any>, expected: Array<any>): string
if #received == 0 then
return NO_ARGUMENTS
else
return Array.join(
Array.map(received, function(arg, i)
if Array.isArray(expected) and i <= #expected and isEqualValue(expected[i], arg) then
return printCommon(arg)
else
return printReceived(arg)
end
end),
", "
)
end
end
function printCommon(val: any)
return DIM_COLOR(stringify(val))
end
function isEqualValue(expected: any, received: any): boolean
return equals(expected, received, { iterableEquality })
end
function isEqualCall(expected: Array<any>, received: Array<any>): boolean
return isEqualValue(expected, received)
end
function isEqualReturn(expected, result): boolean
return result.type == "return" and isEqualValue(expected, result.value)
end
function countReturns(results: Array<any>): number
return Array.reduce(results, function(n: number, result: any)
if result.type == "return" then
return n + 1
else
return n
end
end, 0)
end
function printNumberOfReturns(countReturns_: number, countCalls: number): string
local retval = string.format("\nNumber of returns: %s", printReceived(countReturns_))
if countCalls ~= countReturns_ then
retval = retval .. string.format("\nNumber of calls: %s", printReceived(countCalls))
end
return retval
end
type PrintLabel = (string, boolean) -> string
|
--[[ Functions overridden from BaseCamera ]] | --
function LegacyCamera:SetCameraToSubjectDistance(desiredSubjectDistance)
return BaseCamera.SetCameraToSubjectDistance(self,desiredSubjectDistance)
end
function LegacyCamera:Update(dt: number): (CFrame?, CFrame?)
-- Cannot update until cameraType has been set
if not self.cameraType then
return nil, nil
end
local now = tick()
local timeDelta = (now - self.lastUpdate)
local camera = workspace.CurrentCamera
local newCameraCFrame = camera.CFrame
local newCameraFocus = camera.Focus
local player = PlayersService.LocalPlayer
if self.lastUpdate == nil or timeDelta > 1 then
self.lastDistanceToSubject = nil
end
local subjectPosition: Vector3 = self:GetSubjectPosition()
if self.cameraType == Enum.CameraType.Fixed then
if subjectPosition and player and camera then
local distanceToSubject = self:GetCameraToSubjectDistance()
local newLookVector = self:CalculateNewLookVectorFromArg(nil, CameraInput.getRotation())
newCameraFocus = camera.Focus -- Fixed camera does not change focus
newCameraCFrame = CFrame.new(camera.CFrame.p, camera.CFrame.p + (distanceToSubject * newLookVector))
end
elseif self.cameraType == Enum.CameraType.Attach then
local subjectCFrame = self:GetSubjectCFrame()
local cameraPitch = camera.CFrame:ToEulerAnglesYXZ()
local _, subjectYaw = subjectCFrame:ToEulerAnglesYXZ()
cameraPitch = math.clamp(cameraPitch - CameraInput.getRotation().Y, -PITCH_LIMIT, PITCH_LIMIT)
newCameraFocus = CFrame.new(subjectCFrame.p)*CFrame.fromEulerAnglesYXZ(cameraPitch, subjectYaw, 0)
newCameraCFrame = newCameraFocus*CFrame.new(0, 0, self:StepZoom())
elseif self.cameraType == Enum.CameraType.Watch then
if subjectPosition and player and camera then
local cameraLook = nil
if subjectPosition == camera.CFrame.p then
warn("Camera cannot watch subject in same position as itself")
return camera.CFrame, camera.Focus
end
local humanoid = self:GetHumanoid()
if humanoid and humanoid.RootPart then
local diffVector = subjectPosition - camera.CFrame.p
cameraLook = diffVector.unit
if self.lastDistanceToSubject and self.lastDistanceToSubject == self:GetCameraToSubjectDistance() then
-- Don't clobber the zoom if they zoomed the camera
local newDistanceToSubject = diffVector.magnitude
self:SetCameraToSubjectDistance(newDistanceToSubject)
end
end
local distanceToSubject: number = self:GetCameraToSubjectDistance()
local newLookVector: Vector3 = self:CalculateNewLookVectorFromArg(cameraLook, CameraInput.getRotation())
newCameraFocus = CFrame.new(subjectPosition)
newCameraCFrame = CFrame.new(subjectPosition - (distanceToSubject * newLookVector), subjectPosition)
self.lastDistanceToSubject = distanceToSubject
end
else
-- Unsupported type, return current values unchanged
return camera.CFrame, camera.Focus
end
self.lastUpdate = now
return newCameraCFrame, newCameraFocus
end
return LegacyCamera
|
-- A unique symbolic value. |
export type Symbol = {
type: string, -- replace with "Symbol" when Luau supports singleton types
name: string
}
|
--- |
script.Parent.Values.Gear.Changed:connect(function()
if script.Parent.Values.Gear.Value == -1 then
for index, child in pairs(car.Body.Lights.Rev:GetChildren()) do
child.BrickColor = BrickColor.new("White")
child.Material = Enum.Material.Neon
car.DriveSeat.Reverse:Play()
end
else
for index, child in pairs(car.Body.Lights.Rev:GetChildren()) do
child.BrickColor = BrickColor.new("Black")
child.Material = Enum.Material.SmoothPlastic
car.DriveSeat.Reverse:Stop()
end
end
end)
while wait() do
if (car.DriveSeat.Velocity.magnitude/40)+0.300 < 1.3 then
car.DriveSeat.Reverse.Pitch = (car.DriveSeat.Velocity.magnitude/40)+0.300
car.DriveSeat.Reverse.Volume = (car.DriveSeat.Velocity.magnitude/150)
else
car.DriveSeat.Reverse.Pitch = 1.3
car.DriveSeat.Reverse.Volume = .2
end
end
|
--[[
Constructs a new state object which can listen for updates on another state
object.
FIXME: enabling strict types here causes free types to leak
]] |
local Dependencies = require(script.Parent.Parent.Dependencies)
type Set<T> = {[T]: any}
local class = {}
local CLASS_METATABLE = {__index = class}
|
--// bolekinds |
script.Parent.MouseButton1Click:Connect(function()
local plr = script.Parent.Parent.Parent.Parent.Parent
game.ServerStorage.ServerData.HasKeys.Value = true
script.Parent.Parent:Destroy()
end)
|
-- no touchy |
local path
local waypoint
local oldpoints
local isWandering = 0
if canWander then
spawn(function()
while isWandering == 0 do
isWandering = 1
local desgx, desgz = hroot.Position.x + math.random(-WanderX, WanderX), hroot.Position.z + math.random(-WanderZ, WanderZ)
human:MoveTo( Vector3.new(desgx, 0, desgz) )
wait(math.random(4, 6))
isWandering = 0
end
end)
end
while wait() do
local enemytorso = GetTorso(hroot.Position)
if enemytorso ~= nil and enemytorso.Parent:FindFirstChildOfClass("Humanoid").Health > 0 and enemytorso.Parent:FindFirstChildOfClass("Humanoid") then -- if player detected
isWandering = 1
local function checkw(t)
local ci = 3
if ci > #t then
ci = 3
end
if t[ci] == nil and ci < #t then
repeat
ci = ci + 1
wait()
until t[ci] ~= nil
return Vector3.new(1, 0, 0) + t[ci]
else
ci = 3
return t[ci]
end
end
path = pfs:FindPathAsync(hroot.Position, enemytorso.Position)
waypoint = path:GetWaypoints()
oldpoints = waypoint
local connection;
local direct = Vector3.FromNormalId(Enum.NormalId.Front)
local ncf = hroot.CFrame * CFrame.new(direct)
direct = ncf.p.unit
local rootr = Ray.new(hroot.Position, direct)
local phit, ppos = game.Workspace:FindPartOnRay(rootr, hroot)
if path and waypoint or checkw(waypoint) and enemytorso.Parent:FindFirstChildOfClass("Humanoid").Health > 0 then
if checkw(waypoint) ~= nil and checkw(waypoint).Action == Enum.PathWaypointAction.Walk then
human:MoveTo( checkw(waypoint).Position )
human.Jump = false
end
-- CANNOT LET BALDI JUMPS --
--[[if checkw(waypoint) ~= nil and checkw(waypoint).Action == Enum.PathWaypointAction.Jump then
human.Jump = true
connection = human.Changed:connect(function()
human.Jump = true
end)
human:MoveTo( checkw(waypoint).Position )
else
human.Jump = false
end]]
--[[hroot.Touched:connect(function(p)
local bodypartnames = GetPlayersBodyParts(enemytorso)
if p:IsA'Part' and not p.Name == bodypartnames and phit and phit.Name ~= bodypartnames and phit:IsA'Part' and rootr:Distance(phit.Position) < 5 then
connection = human.Changed:connect(function()
human.Jump = true
end)
else
human.Jump = false
end
end)]]
if connection then
connection:Disconnect()
end
else
for i = 3, #oldpoints do
human:MoveTo( oldpoints[i].Position )
end
end
elseif enemytorso == nil and canWander then -- if player not detected
isWandering = 0
path = nil
waypoint = nil
wait()
end
end
|
-- Local Functions |
local function StartIntermission()
-- Default to circle center of map
local possiblePoints = {}
table.insert(possiblePoints, Vector3.new(0,50,0))
local focalPoint = possiblePoints[math.random(#possiblePoints)]
Camera.CameraType = Enum.CameraType.Scriptable
Camera.Focus = CFrame.new(focalPoint)
-- Stream in the area around the focal point.
Player:RequestStreamAroundAsync(focalPoint)
local angle = 0
game.Lighting.Blur.Enabled = true
RunService:BindToRenderStep('IntermissionRotate', Enum.RenderPriority.Camera.Value, function()
local cameraPosition = focalPoint + Vector3.new(50 * math.cos(angle), 20, 50 * math.sin(angle))
Camera.CoordinateFrame = CFrame.new(cameraPosition, focalPoint)
angle = angle + math.rad(.25)
if BlurBlock then
BlurBlock.CFrame = Camera.CoordinateFrame +
Camera.CoordinateFrame:vectorToWorldSpace(Vector3.new(0,0,-2))
end
end)
ScreenGui.ScoreFrame["Bright blue"].Visible = false
ScreenGui.ScoreFrame["Bright red"].Visible = false
end
local function StopIntermission()
game.Lighting.Blur.Enabled = false
RunService:UnbindFromRenderStep('IntermissionRotate')
Camera.CameraType = Enum.CameraType.Custom
if IsTeams then
ScreenGui.ScoreFrame["Bright blue"].Visible = true
ScreenGui.ScoreFrame["Bright red"].Visible = true
end
end
local function OnDisplayIntermission(display)
if display and not InIntermission then
InIntermission = true
StartIntermission()
end
if not display and InIntermission then
InIntermission = false
StopIntermission()
end
end
local function OnSetBlurBlock(block)
BlurBlock = block
BlurBlock.LocalTransparencyModifier = 0
end
local function OnFetchConfiguration(configFetched, configValue)
if configFetched == "TEAMS" then
IsTeams = configValue
ScreenGui.ScoreFrame["Bright blue"].Visible = IsTeams
ScreenGui.ScoreFrame["Bright red"].Visible = IsTeams
end
end
|
--[=[
Set the value of the property for specific players. This just
loops through the players given and calls `SetFor`.
```lua
local players = {player1, player2, player3}
remoteProperty:SetForList(players, "CustomData")
```
]=] |
function RemoteProperty:SetForList(players: { Player }, value: any)
for _, player in ipairs(players) do
self:SetFor(player, value)
end
end
|
-- Compiled with roblox-ts v2.0.4 |
local default = function(className)
local _exp = string.split(className, " ")
local _arg0 = function(s)
return #s > 0
end
-- ▼ ReadonlyArray.filter ▼
local _newValue = {}
local _length = 0
for _k, _v in _exp do
if _arg0(_v, _k - 1, _exp) == true then
_length += 1
_newValue[_length] = _v
end
end
-- ▲ ReadonlyArray.filter ▲
table.sort(_newValue)
local split = _newValue
return table.concat(split, " ")
end
return {
default = default,
}
|
-- detection |
character:FindFirstChild("RightUpperArm").LocalTransparencyModifier = 0
character:FindFirstChild("RightLowerArm").LocalTransparencyModifier = 0
character:FindFirstChild("RightHand").LocalTransparencyModifier = 0 |
--- Sets a list of keyboard keys (Enum.KeyCode) that can be used to open the commands menu |
function Cmdr:SetActivationKeys(keysArray)
self.ActivationKeys = Util.MakeDictionary(keysArray)
end
|
--[=[
Fires the subscription
@param ... any
]=] |
function Subscription:Fire(...)
if self._state == stateTypes.PENDING then
if self._fireCallback then
self._fireCallback(...)
end
elseif self._state == stateTypes.CANCELLED then
warn("[Subscription.Fire] - We are cancelled, but events are still being pushed")
if ENABLE_STACK_TRACING then
print(debug.traceback())
print(self._source)
end
end
end
|
--[[
The Ownership-class
--]] |
local Players = game:GetService("Players")
local Owners = {}
local Ownership = {}
Ownership.__index = Ownership
function Ownership.new(Model)
assert(Model and Model.PrimaryPart, "Ownership.new(Model) requires a Model with a PrimaryPart!")
local Data = {
Model = Model,
Owner = nil,
_OwnerChangedEvent = nil,
OwnerChanged = nil
}
local self = setmetatable(Data, Ownership)
self._OwnerChangedEvent = Instance.new("BindableEvent")
self.OwnerChanged = self._OwnerChangedEvent.Event
return self
end
|
-- If you want the sound to be heard in one spot, put it in a brick
-- |
music.Pitch = 1 -- Pitch manages the Pitch and Speed of the Sound. Pitch 1 is the normal sound, although some sounds have a problem that they are slow, increase this |
--[[return function()
--- Create seed based on tick and RNG
local seed = os.time()
local seed2 = rng:NextNumber() * 1
local comp = (seed * seed2)
--- Format seed to hex
local str = string.format("%x", comp * 256)
--
return str
end ]] |
return function()
local UUID4 = _L.Services.HttpService:GenerateGUID(false)
UUID4 = string.gsub(UUID4, "-", "")
return UUID4
end
|
-------------Cannon Properties--------------------------------------------------------------------------------------------------------------- |
local targetRange = 40--max range +/- 5
local power = 350 -- cannon Force , Bullet speed
local cannonAcc = 20 --The less = better , if theres acc = 20 then the miss range is between -20 and 20 |
--Make the part spin around the humanoid player |
while true do
mainPart.CFrame = Humanoid.CFrame * CFrame.Angles(0, math.rad(1), 0)
wait(1)
end
|
--F.updateSound = function(Sound, Pitch, Volume)
-- if Sound then
-- if Pitch then
-- Sound.Pitch = Pitch
-- end
-- if Volume then
-- Sound.Volume = Volume
-- end
-- end
--end |
F.updateWindows = function(Window, Toggle)
if script.Parent.Parent.Windows:findFirstChild(Window) then
script.Parent.Parent.Windows:findFirstChild(Window).Value = Toggle
end
end
F.updateSong = function(Song)
carSeat.Parent.Body.MP.Sound:Stop()
wait()
carSeat.Parent.Body.MP.Sound.SoundId = "rbxassetid://"..Song
wait()
carSeat.Parent.Body.MP.Sound:Play()
end
F.updateVolume = function(Vol)
carSeat.Parent.Body.MP.Sound.Volume = carSeat.Parent.Body.MP.Sound.Volume + Vol
end
F.updateValue = function(Val, Value)
if Val then
Val.Value = Value
end
end
|
-- Local Variables |
local Configurations = require(game.ServerStorage.Configurations)
local Events = game.ReplicatedStorage.Events
local DisplayIntermission = Events.DisplayIntermission
local DisplayTimerInfo = Events.DisplayTimerInfo
local DisplayVictory = Events.DisplayVictory
local DisplayScore = Events.DisplayScore
local StarterGui = game.StarterGui
|
-- child.C0 = CFrame.new(0,-0.6,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0) --// Reposition player |
if child.Part1.Name == "HumanoidRootPart" then
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and (not player.PlayerGui:FindFirstChild("Screen")) then --// The part after the "and" prevents multiple GUI's to be copied over.
GUI.CarSeat.Value = script.Parent --// Puts a reference of the seat in this ObjectValue, now you can use this ObjectValue's value to find the car directly.
GUI:Clone().Parent = player.PlayerGui --// Compact version
if script.Parent.SingleMode.Value == true then
wait()
script.Parent.Disabled = true
wait()
script.Parent.Disabled = false
else
script.Parent.Occupied.Value = true
end
end
end
end
end)
script.Parent.ChildRemoved:connect(function(child)
if child:IsA("Weld") then
if child.Part1.Name == "HumanoidRootPart" then
game.Workspace.CurrentCamera.FieldOfView = 70
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and player.PlayerGui:FindFirstChild("SS3") then
player.PlayerGui:FindFirstChild("SS3"):Destroy()
script.Parent.Occupied.Value = false
end
end
end
end)
|
--put in ServerScriptService |
local Teams = game:GetService("Teams"):GetChildren()
game.Players.PlayerAdded:Connect(function(player)
for i,player in pairs(game.Players:GetPlayers()) do
if player then
if player.Team == nil then
local randomTeam = Teams[math.random(1, #Teams)]
player.Team = randomTeam
print(player.Name.. " is a "..randomTeam.Name)
end
end
end
end)
|
-- To avoid using .Activated for each slot we do this
-- better for optimization |
local function onInputBegan(input: InputObject, processed)
if not ScreenGui.Enabled then
return
end
if input.UserInputType == Enum.UserInputType.MouseButton1 then
for _, obj in ScreenGui.Parent:GetGuiObjectsAtPosition(input.Position.X, input.Position.Y) do
if IsSlot(obj) then
ChangeToolHold(obj)
return
end
end
end
if processed then
return
end
if input.KeyCode == Enum.KeyCode.Backquote then
local tween = TweenService:Create(Backpack, TweenInfo.new(), {
Size = if IsBackpackOpen
then UDim2.fromScale(1, 0)
else BackpackSize
})
IsBackpackOpen = not IsBackpackOpen
Backpack.List.ScrollBarThickness = if IsBackpackOpen then 12 else 0
tween:Destroy()
tween:Play()
elseif input.UserInputType == Enum.UserInputType.Keyboard then
local value = input.KeyCode.Value - Enum.KeyCode.Zero.Value
if value < 0 or value > 9 then
return
end
local slot = HandleBar["Slot" .. value]
ChangeToolHold(slot)
end
end
for _, v in LocalPlayer.Backpack:GetChildren() do
AddSlotObject(v)
end
LocalPlayer.Backpack.ChildAdded:Connect(doCheckAndReplaceTools)
LocalPlayer.Backpack.ChildRemoved:Connect(doCheckAndReplaceTools)
LocalPlayer.CharacterAdded:Connect(HandleCharacter)
UserInputService.InputBegan:Connect(onInputBegan)
|
------CruisinWithMyHomies ^--- |
winfob.FL.Lock.MouseButton1Click:connect(function() --Window
if carSeat.WindowFL.Value == false then
carSeat.WindowFL.Value = true
carSeat.Parent.Parent.DoorLD.Window.SS.Motor.DesiredAngle = -0.25
else carSeat.WindowFL.Value = false
carSeat.Parent.Parent.DoorLD.Window.SS.Motor.DesiredAngle = 0
end
end)
winfob.FR.Lock.MouseButton1Click:connect(function() --Window
if carSeat.WindowFR.Value == false then
carSeat.WindowFR.Value = true
carSeat.Parent.Parent.DoorRD.Window.SS.Motor.DesiredAngle = 0.25
else carSeat.WindowFR.Value = false
carSeat.Parent.Parent.DoorRD.Window.SS.Motor.DesiredAngle = 0
end
end)
winfob.RL.Lock.MouseButton1Click:connect(function() --Window
if carSeat.WindowRL.Value == false then
carSeat.WindowRL.Value = true
carSeat.Parent.Parent.DoorL.W.SS.Motor.DesiredAngle = 0.25
else carSeat.WindowRL.Value = false
carSeat.Parent.Parent.DoorL.W.SS.Motor.DesiredAngle = 0
end
end)
winfob.RR.Lock.MouseButton1Click:connect(function() --Window
if carSeat.WindowRR.Value == false then
carSeat.WindowRR.Value = true
carSeat.Parent.Parent.DoorR.W.SS.Motor.DesiredAngle = 0.25
else carSeat.WindowRR.Value = false
carSeat.Parent.Parent.DoorR.W.SS.Motor.DesiredAngle = 0
end
end)
while true do --Loop
wait()
if gear == -1 then
HUB.Parent.Gauges.Circle.Zero.Gear.Text = "R"
carSeat.Parent.Parent.Trunk.R1.Material = "Neon"
carSeat.Parent.Parent.Trunk.R2.Material = "Neon"
carSeat.Parent.R1.Material = "Neon"
carSeat.Parent.R2.Material = "Neon"
carSeat.Parent.Parent.Trunk.R1.Transparency = 0
carSeat.Parent.Parent.Trunk.R2.Transparency = 0
carSeat.Parent.R1.Transparency = 0
carSeat.Parent.R2.Transparency = 0
carSeat.Parent.Runners.O.Disp.One.Visible = false
carSeat.Parent.Runners.O.Disp.Two.Visible = true
elseif gear == 0 then
HUB.Parent.Gauges.Circle.Zero.Gear.Text = "N"
carSeat.Parent.Parent.Trunk.R1.Material = "SmoothPlastic"
carSeat.Parent.Parent.Trunk.R2.Material = "SmoothPlastic"
carSeat.Parent.R1.Material = "SmoothPlastic"
carSeat.Parent.R2.Material = "SmoothPlastic"
carSeat.Parent.Parent.Trunk.R1.Transparency = 0.9
carSeat.Parent.Parent.Trunk.R2.Transparency = 0.9
carSeat.Parent.R1.Transparency = 0.9
carSeat.Parent.Runners.O.Disp.One.Visible = true
carSeat.Parent.Runners.O.Disp.Two.Visible = false
carSeat.Parent.R2.Transparency = 0.9
elseif gear == 1 then
HUB.Parent.Gauges.Circle.Zero.Gear.Text = "D"
end
if carSeat.Throttle == 1 and gear >= 1 or gear == -1 and carSeat.Throttle == 1 then
if carSeat.InsaneMode.Value == true and carSeat.Power.Value < 60 then
carSeat.Power.Value = carSeat.Power.Value + 3
elseif carSeat.InsaneMode.Value == false and carSeat.Power.Value < 40 then
carSeat.Power.Value = carSeat.Power.Value +2
end
else
carSeat.Power.Value = 0
end
limitButton.Parent.Time.Text = game.Lighting.TimeOfDay
end
|
--[=[
Use to test that the top padding between the given GuiObject or Rect and
the other GuiObject or Rect.
The last argument is optional. If nil, the matcher will pass only if the
difference **top** edge of the given GuiObject or Rect and the **top** edge
of the other GuiObject or Rect is zero or positive.
```lua
-- Jest
expect(instanceA).toBeInsideBelow(instanceB)
expect(instanceA).toBeInsideBelow(instanceB, 10)
expect(instanceA).toBeInsideBelow(instanceB, NumberRange.new(0, 10))
```
```lua
-- TestEZ
expect(instanceA).to.be.insideBelow(instanceB)
expect(instanceA).to.be.insideBelow(instanceB, 10)
expect(instanceA).to.be.insideBelow(instanceB, NumberRange.new(0, 10))
```
@tag inside
@within CollisionMatchers2D
]=] |
local function insideBelow(a: GuiObject | Rect, b: GuiObject | Rect, distance: number | NumberRange)
local aRect = toRect(a)
local bRect = toRect(b)
local distanceFromSide = (aRect.Min - bRect.Min)
if distance then
if typeof(distance) == "number" then
distance = NumberRange.new(distance)
end
return returnValue(
distance.Min <= distanceFromSide.Y and distance.Max >= distanceFromSide.Y,
"Was within range",
"Was not within range ( " .. tostring(distance) .. ")"
)
else
return returnValue(distanceFromSide.Y >= 0, "Was not above the element", "Was too far above the element")
end
end
return insideBelow
|
-- Tips |
DEFAULT_FORCED_GROUP_VALUES["tip"] = 1
function Icon:setTip(text)
assert(typeof(text) == "string" or text == nil, "Expected string, got "..typeof(text))
local realText = text or ""
local isVisible = realText ~= ""
local iconContentText = self:_getContentText(realText)
local textSize = textService:GetTextSize(iconContentText, 12, Enum.Font.GothamSemibold, Vector2.new(1000, 20-6))
self.instances.tipLabel.Text = realText
self.instances.tipFrame.Size = (isVisible and UDim2.new(0, textSize.X+6, 0, 20)) or UDim2.new(0, 0, 0, 0)
self.instances.tipFrame.Parent = (isVisible and activeItems) or self.instances.iconContainer
self._maid.tipFrame = self.instances.tipFrame
self.tipText = text
local tipMaid = Maid.new()
self._maid.tipMaid = tipMaid
if isVisible then
tipMaid:give(self.hoverStarted:Connect(function()
if not self.isSelected then
self:displayTip(true)
end
end))
tipMaid:give(self.hoverEnded:Connect(function()
self:displayTip(false)
end))
tipMaid:give(self.selected:Connect(function()
if self.hovering then
self:displayTip(false)
end
end))
end
self:displayTip(self.hovering and isVisible)
return self
end
function Icon:displayTip(bool)
if userInputService.TouchEnabled and not self._draggingFinger then return end
-- Determine caption visibility
local isVisible = self.tipVisible or false
if typeof(bool) == "boolean" then
isVisible = bool
end
self.tipVisible = isVisible
-- Have tip position track mouse or finger
local tipFrame = self.instances.tipFrame
if isVisible then
-- When the user moves their cursor/finger, update tip to match the position
local function updateTipPositon(x, y)
local newX = x
local newY = y
local camera = workspace.CurrentCamera
local viewportSize = camera and camera.ViewportSize
if userInputService.TouchEnabled then
--tipFrame.AnchorPoint = Vector2.new(0.5, 0.5)
local desiredX = newX - tipFrame.Size.X.Offset/2
local minX = 0
local maxX = viewportSize.X - tipFrame.Size.X.Offset
local desiredY = newY + THUMB_OFFSET + 60
local minY = tipFrame.AbsoluteSize.Y + THUMB_OFFSET + 64 + 3
local maxY = viewportSize.Y - tipFrame.Size.Y.Offset
newX = math.clamp(desiredX, minX, maxX)
newY = math.clamp(desiredY, minY, maxY)
elseif IconController.controllerModeEnabled then
local indicator = TopbarPlusGui.Indicator
local newPos = indicator.AbsolutePosition
newX = newPos.X - tipFrame.Size.X.Offset/2 + indicator.AbsoluteSize.X/2
newY = newPos.Y + 90
else
local desiredX = newX
local minX = 0
local maxX = viewportSize.X - tipFrame.Size.X.Offset - 48
local desiredY = newY
local minY = tipFrame.Size.Y.Offset+3
local maxY = viewportSize.Y
newX = math.clamp(desiredX, minX, maxX)
newY = math.clamp(desiredY, minY, maxY)
end
--local difX = tipFrame.AbsolutePosition.X - tipFrame.Position.X.Offset
--local difY = tipFrame.AbsolutePosition.Y - tipFrame.Position.Y.Offset
--local globalX = newX - difX
--local globalY = newY - difY
--tipFrame.Position = UDim2.new(0, globalX, 0, globalY-55)
tipFrame.Position = UDim2.new(0, newX, 0, newY-20)
end
local cursorLocation = userInputService:GetMouseLocation()
if cursorLocation then
updateTipPositon(cursorLocation.X, cursorLocation.Y)
end
self._hoveringMaid:give(self.instances.iconButton.MouseMoved:Connect(updateTipPositon))
end
-- Change transparency of relavent tip instances
for _, settingName in pairs(self._groupSettings.tip) do
local settingDetail = self._settingsDictionary[settingName]
settingDetail.useForcedGroupValue = not isVisible
self:_update(settingName)
end
end
|
--[[local localPlayer = game:GetService("Players").LocalPlayer;
local arrestEvent = game:GetService("ReplicatedStorage").arrestEvent;
local mouse = game:GetService("Players").LocalPlayer:GetMouse();
local handCuffs = script.Parent;
local workspace = workspace;
local findPartOnRay = workspace.FindPartOnRay;
local newRay = Ray.new;
handCuffs.Activated:Connect(function()
local hit = findPartOnRay(workspace, newRay(mouse.UnitRay.Origin, mouse.UnitRay.Direction * 5000), localPlayer.Character);
arrestEvent:FireServer("Cuff", hit);
end);]] | |
-- Creates a viewport with a given object, has 1,1 size and is positioned in middle of parent element. |
VC.CreateViewport = function(parent,Object,Rotation, distanceOverride)
local Viewport =Instance.new("ViewportFrame")
if parent:FindFirstChild("ViewportFrame") then
parent:FindFirstChild("ViewportFrame"):Destroy()
end
Viewport.LightDirection = Vector3.new(0, -1, 0)
Viewport.LightColor = Color3.fromRGB(255, 167, 43)
Viewport.Ambient = Color3.fromRGB(255,255,255)
local OriginalObj = Object
|
--humanoid.AutoRotate = false |
local root = chr:WaitForChild("HumanoidRootPart")
local torso = chr:WaitForChild("Torso")
local head = chr:WaitForChild("Head")
local rj = root:WaitForChild("RootJoint")
local rh, lh = torso:WaitForChild("Right Hip"), torso:WaitForChild("Left Hip")
local rs, ls = torso:WaitForChild("Right Shoulder"), torso:WaitForChild("Left Shoulder")
local nk = torso:WaitForChild("Neck")
rj, nk, rs, ls, rh, lh = rj:Clone(), nk:Clone(), rs:Clone(), ls:Clone(), rh:Clone(), lh:Clone()
rj.Parent, nk.Parent, rs.Parent, ls.Parent, rh.Parent, lh.Parent =
root, torso, torso, torso, torso, torso
local rjc0, nkc0, rsc0, lsc0, rhc0, lhc0 = rj.C0, nk.C0, rs.C0, ls.C0, rh.C0, lh.C0
local transfer = script.Parent:WaitForChild("transfer")
local aiming = false
local crouch = false
local conn; conn = runService.Heartbeat:Connect(function()
local mouseHit = mse.Hit
local dist = (head.Position - cam.CFrame.p).Magnitude
local diff = head.CFrame.Y - cam.CFrame.Y
local ang = aiming and -math.rad(18) or 0
nk.C0 = nk.C0:Lerp(nkc0 * CFrame.Angles(-math.atan(diff / dist), ang, 0), 0.2)
-- repost if you hate manipulating r6 joints
rs.C0 = rs.C0:Lerp(rsc0 * CFrame.Angles(0, 0, math.atan(diff / dist) * 0.9), 0.2)
ls.C0 = ls.C0:Lerp(lsc0 * CFrame.Angles(0, 0, -math.atan(diff / dist) * 0.9), 0.2)
--root.CFrame = CFrame.lookAt(root.Position, Vector3.new(mouseHit.X, root.Position.Y, mouseHit.Z))
if crouch then
humanoid.CameraOffset = humanoid.CameraOffset:Lerp(Vector3.new(0, -2, 0), 0.2)
rj.C0 = rj.C0:Lerp(rjc0 * CFrame.new(0, 0, -1.7) * CFrame.Angles(math.rad(20), 0, 0), 0.2)
rh.C0 = rh.C0:Lerp(rhc0 * CFrame.Angles(0, 0, -math.rad(30)) * CFrame.new(0.25, 1.7, 0), 0.2)
lh.C0 = lh.C0:Lerp(lhc0 * CFrame.Angles(0, 0, math.rad(30)) * CFrame.new(-0.25, 1.7, 0), 0.2)
else
humanoid.CameraOffset = humanoid.CameraOffset:Lerp(Vector3.new(), 0.25)
rj.C0 = rj.C0:Lerp(rjc0, 0.25)
rh.C0 = rh.C0:Lerp(rhc0, 0.25)
lh.C0 = lh.C0:Lerp(lhc0, 0.25)
end
transfer:FireServer(rj.C0, nk.C0, rs.C0, ls.C0, rh.C0, lh.C0)
if humanoid:GetState() == Enum.HumanoidStateType.Dead then
conn:Disconnect()
return
end
end)
UIS.InputBegan:Connect(function(inp, gp)
if not gp then
if inp.KeyCode == Enum.KeyCode.LeftControl and humanoid.Sit == false and humanoid.PlatformStand == false then
crouch = true
humanoid.WalkSpeed = 10
end
end
end)
UIS.InputEnded:Connect(function(inp, gp) -- i hate typing out UIS functions
if not gp then
if inp.KeyCode == Enum.KeyCode.LeftControl then
crouch = false
humanoid.WalkSpeed = 16
end
end
end)
script.aimEvent.Event:Connect(function(bool)
if type(bool) == "boolean" then
aiming = bool
end
end)
humanoid:GetPropertyChangedSignal("Sit"):Connect(function()
if humanoid.Sit == true then
crouch = false
humanoid.WalkSpeed = 16
end
end)
|
-- Local Functions |
local function StartIntermission()
-- Default to circle center of map
local possiblePoints = {}
table.insert(possiblePoints, Vector3.new(0,50,0))
local focalPoint = possiblePoints[math.random(#possiblePoints)]
Camera.CameraType = Enum.CameraType.Scriptable
Camera.Focus = CFrame.new(focalPoint)
local angle = 0
game.Lighting.Blur.Enabled = true
RunService:BindToRenderStep('IntermissionRotate', Enum.RenderPriority.Camera.Value, function()
local cameraPosition = focalPoint + Vector3.new(50 * math.cos(angle), 20, 50 * math.sin(angle))
Camera.CoordinateFrame = CFrame.new(cameraPosition, focalPoint)
angle = angle + math.rad(.25)
if BlurBlock then
BlurBlock.CFrame = Camera.CoordinateFrame +
Camera.CoordinateFrame:vectorToWorldSpace(Vector3.new(0,0,-2))
end
end)
ScreenGui.ScoreFrame["Bright blue"].Visible = false
ScreenGui.ScoreFrame["Bright red"].Visible = false
end
local function StopIntermission()
game.Lighting.Blur.Enabled = false
RunService:UnbindFromRenderStep('IntermissionRotate')
Camera.CameraType = Enum.CameraType.Custom
if IsTeams then
ScreenGui.ScoreFrame["Bright blue"].Visible = true
ScreenGui.ScoreFrame["Bright red"].Visible = true
end
end
local function OnDisplayIntermission(display)
if display and not InIntermission then
InIntermission = true
StartIntermission()
end
if not display and InIntermission then
InIntermission = false
StopIntermission()
end
end
local function OnSetBlurBlock(block)
BlurBlock = block
BlurBlock.LocalTransparencyModifier = 0
end
local function OnFetchConfiguration(configFetched, configValue)
if configFetched == "TEAMS" then
IsTeams = configValue
ScreenGui.ScoreFrame["Bright blue"].Visible = IsTeams
ScreenGui.ScoreFrame["Bright red"].Visible = IsTeams
end
end
|
-- Public Constructors |
function CubicSpline.Natural(points)
local self = setmetatable({}, CubicSpline)
self.Points = points
self.Coefficients = {naturalCubicSpline(points)}
local lengths = {}
local total = 0
for k = 1, #points - 1 do
lengths[k] = integrate(self, k, 1)
total = total + lengths[k]
end
self.Lengths = lengths
self.TotalLength = total
return self
end
function CubicSpline.Clamped(points, fpo, fpn)
local self = setmetatable({}, CubicSpline)
self.Points = points
self.Coefficients = {clampedCubicSpline(points, fpo, fpn)}
local lengths = {}
local total = 0
for k = 1, #points - 1 do
lengths[k] = integrate(self, k, 1)
total = total + lengths[k]
end
self.Lengths = lengths
self.TotalLength = total
return self
end
|
--// Bullet Physics |
BulletPhysics = Vector3.new(0,55,0); -- Drop fixation: Lower number = more drop
BulletSpeed = 1500; -- Bullet Speed
BulletSpread = 0; -- How much spread the bullet has
ExploPhysics = Vector3.new(0,20,0); -- Drop for explosive rounds
ExploSpeed = 600; -- Speed for explosive rounds
BulletDecay = 10000; -- How far the bullet travels before slowing down and being deleted (BUGGY)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.