prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
----------------------------------------------------------------------------------------------- |
ItemID = 8426083 -- The ID of the Gamepass/T-Shirt.
OpenTime = 0 -- The time the door is open for.
OpenTrans = 1 -- The transparency of the door when it is open.
CloseTrans = 1 -- The transparency of the door when it is closed.
BuyGUI = true -- Set to false to stop the BuyGUI appearing.
KillOnTouch = false -- Set to false to stop players being killed when they touch it.
|
--------------------[ MATH FUNCTIONS ]------------------------------------------------ |
function NumLerp(A, B, Alpha)
return (A + ((B - A) * Alpha))
end
function RAND(Min, Max, Accuracy)
local Inverse = 1 / (Accuracy or 1)
return (math.random(Min * Inverse, Max * Inverse) / Inverse)
end
|
--------------------------------------------------- |
This = script.Parent
Elevator = This.Parent.Parent.Parent.Parent.Parent
Characters = require(script.Characters)
CustomLabel = require(Elevator.CustomLabel)
CustomText = CustomLabel["CUSTOMFLOORLABEL"]
This.Parent.Parent.Parent.Parent.Parent:WaitForChild("Floor").Changed:connect(function(floor)
--custom indicator code--
ChangeFloor(tostring(floor))
end)
function ChangeFloor(SF)
if CustomText[tonumber(SF)] then
SF = CustomText[tonumber(SF)]
end
SetDisplay(1,(string.len(SF) == 2 and SF:sub(1,1) or "NIL"))
SetDisplay(2,(string.len(SF) == 2 and SF:sub(2,2) or SF))
end
function SetDisplay(ID,CHAR)
if This.Display:FindFirstChild("Matrix"..ID) and Characters[CHAR] ~= nil then
for i,l in pairs(Characters[CHAR]) do
for r=1,5 do
This.Display["Matrix"..ID]["Row"..i]["D"..r].Visible = (l:sub(r,r) == "1" and true or false)
end
end
end
end
for M = 1, Displays do
for R = 1, 7 do
for D = 1, 5 do
This.Display["Matrix"..M]["Row"..R]["D"..D].BackgroundColor3 = DisplayColor
end
end
end
|
-------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------- |
function onSwimming(speed)
if speed > 1.00 then
local scale = 10.0
playAnimation("swim", 0.4, Humanoid)
setAnimationSpeed(speed / scale)
pose = "Swimming"
else
playAnimation("swimidle", 0.4, Humanoid)
pose = "Standing"
end
end
function animateTool()
if (toolAnim == "None") then
playToolAnimation("toolnone", toolTransitionTime, Humanoid, Enum.AnimationPriority.Idle)
return
end
if (toolAnim == "Slash") then
playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action)
return
end
if (toolAnim == "Lunge") then
playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action)
return
end
end
function getToolAnim(tool)
for _, c in ipairs(tool:GetChildren()) do
if c.Name == "toolanim" and c.className == "StringValue" then
return c
end
end
return nil
end
local lastTick = 0
function stepAnimate(currentTime)
local amplitude = 1
local frequency = 1
local deltaTime = currentTime - lastTick
lastTick = currentTime
local climbFudge = 0
local setAngles = false
if (jumpAnimTime > 0) then
jumpAnimTime = jumpAnimTime - deltaTime
end
if (pose == "FreeFall" and jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
elseif (pose == "Seated") then
playAnimation("sit", 0.5, Humanoid)
return
elseif (pose == "Running") then
playAnimation("walk", 0.2, Humanoid)
elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
stopAllAnimations()
amplitude = 0.1
frequency = 1
setAngles = true
end
-- Tool Animation handling
local tool = Character:FindFirstChildOfClass("Tool")
if tool and tool:FindFirstChild("Handle") then
local animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = currentTime + .3
end
if currentTime > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
stopToolAnimations()
toolAnim = "None"
toolAnimInstance = nil
toolAnimTime = 0
end
end
|
--A simple function to check if the car is grounded |
local function IsGrounded()
local hit, position = Raycast.new((car.Chassis.CFrame * CFrame.new(0, 0, (car.Chassis.Size.Z / 2) - 1)).p, car.Chassis.CFrame:vectorToWorldSpace(Vector3.new(0, -1, 0)) * (stats.Height.Value + 0.2))
if hit and hit.CanCollide then
return(true)
end
return(false)
end
|
--//Varaibles |
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local oriJumpPower = hum.JumpPower
local settings = require(game.ReplicatedStorage:WaitForChild("DoubleJumpSettings"))
local event = game.ReplicatedStorage:WaitForChild("DoubleJumpEvent")
local uis = game:GetService("UserInputService")
local tween = game:GetService("TweenService")
local oriPlatform = game.ReplicatedStorage:WaitForChild("JumpPlatform")
|
--!strict |
local None = require(script.Parent.None)
type Object = { [any]: any }
|
------------------------- |
function onClicked()
script.Parent.Parent.Call.ClickDetector.MaxActivationDistance = 0
script.Parent.Click:Play()
script.Parent.ClickDetector.MaxActivationDistance = 0
script.Parent.Parent.Up.ClickDetector.MaxActivationDistance = 0
wait(2)
script.Parent.Parent.DoorOutside2.CanCollide = true
script.Parent.Parent.DoorOutside2.Transparency = 0
script.Parent.Parent.DoorInside.Transparency = 0
script.Parent.Parent.DoorInside.CanCollide = true
script.Parent.Parent.DoorInside.Close:Play()
wait(3)
script.Parent.Parent.Screen.SurfaceGui.Frame.Down.Visible = true
Car.Start:Play()
Car.Run:Play()
LiftDown:Play()
wait(12)
script.Parent.Parent.Screen.SurfaceGui.Frame.TextLabel.Text = "SECRET BASE"
script.Parent.Parent.Screen.SurfaceGui.Frame.Down.Visible = false
Car.Start:Stop()
Car.Run:Stop()
Car.Stop:Play()
wait(2)
door.Transparency = 1
door.CanCollide = false
script.Parent.Parent.DoorOutside.CanCollide = false
script.Parent.Parent.DoorOutside.Transparency = 1
Car.Ding:Play()
wait(5)
script.Parent.Parent.Call2.ClickDetector.MaxActivationDistance = 12
script.Parent.Parent.Up.ClickDetector.MaxActivationDistance = 12
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
-- Rotates the arms, waist, and neck to make the aiming for more realistic |
RE_UpdateSpine.OnServerEvent:Connect(function(player, theta)
if player.Character then
local humanoid = player.Character.Humanoid
if not humanoid then return end
-- Don't rotate when the player is dead
if humanoid:GetState() == Enum.HumanoidStateType.Dead then return end
local neck = player.Character.Head.Neck
local waist = player.Character.UpperTorso.Waist
local leftArm = player.Character.LeftUpperArm.LeftShoulder
local rightArm = player.Character.RightUpperArm.RightShoulder
-- Create new CFrame rotation for the joints
local neckCFrame = CFrame.fromEulerAnglesYXZ(theta*0.5,0,0)
local waistCFrame = CFrame.fromEulerAnglesYXZ(theta*0.5,0,0)
local leftArmCFrame = CFrame.fromEulerAnglesYXZ(theta*0.25,0,0)
local rightArmArmCFrame = CFrame.fromEulerAnglesYXZ(theta*0.25,0,0)
-- Apply rotations
neck.C0 = Neck_CFrame * neckCFrame
waist.C0 = Waist_CFrame * waistCFrame
leftArm.C0 = Left_Upper_Arm_CFrame * leftArmCFrame
rightArm.C0 = Right_Upper_Arm_CFrame * rightArmArmCFrame
end
end)
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]] |
local autoscaling = false --Estimates top speed
local UNITS = { --Click on speed to change units
--First unit is default
{
units = "MPH" ,
scaling = (10/12) * (60/88) , -- 1 stud : 10 inches | ft/s to MPH
maxSpeed = 140 ,
spInc = 20 , -- Increment between labelled notches
},
{
units = "KM/H" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 240 ,
spInc = 20 , -- Increment between labelled notches
},
{
units = "SPS" ,
scaling = 1 , -- Roblox standard
maxSpeed = 300 ,
spInc = 60 , -- Increment between labelled notches
}
}
|
--[[Steering]] |
function Steering(dt)
local deltaTime = (60/(1/dt))
--Mouse Steer
if _MSteer then
local msWidth = math.max(1,mouse.ViewSizeX*_Tune.Peripherals.MSteerWidth/200)
local mdZone = _Tune.Peripherals.MSteerDZone/100
local mST = ((mouse.X-mouse.ViewSizeX/2)/msWidth)
if math.abs(mST)<=mdZone then
_GSteerT = 0
else
_GSteerT = (math.max(math.min((math.abs(mST)-mdZone),(1-mdZone)),0)/(1-mdZone))^_Tune.MSteerExp * (mST / math.abs(mST))
end
end
_GSteerC = (_GSteerC+((_GSteerT-_GSteerC)*(_Tune.LeanSpeed*deltaTime)))
--Apply Steering
bike.Body.bal.LeanGyro.cframe = CFrame.new(bike.Body.bal.CFrame.p,bike.Body.bal.CFrame.p+bike.Body.bal.CFrame.lookVector)*CFrame.Angles(0,0,((_GSteerC*_Tune.LeanProgressiveness)*(math.rad(_Tune.MaxLean)/(bike.DriveSeat.Velocity.Magnitude+_Tune.LeanProgressiveness))-(_GSteerC*math.rad(_Tune.MaxLean))))
--Apply Low Speed Steering
bike.FrontSection.TripleTreeHinge.SteeringGyro.CFrame=bike.Body.SteeringHinge.CFrame*CFrame.Angles(math.rad(_GSteerT*_Tune.SteerAngle),0,0)
bike.FrontSection.TripleTreeHinge.SteeringGyro.MaxTorque = Vector3.new(_Tune.SteerMaxTorque*((math.max((_Tune.LowSpeedCut-bike.DriveSeat.Velocity.Magnitude)/_Tune.LowSpeedCut,0))^2),0,0)
end
|
-- ====================
-- LIMITED CLIP
-- Make a gun has a limit clip
-- ==================== |
LimitedClipEnabled = false;
Clips = 10;
MaxClip = 10; --Put "math.huge" to allow user to carry unlimited clip
|
--local root = shark:WaitForChild("HumanoidRootPart") |
local root = shark.PrimaryPart
local bodyPos = root:WaitForChild("BodyPosition")
local bodyGyro = root:WaitForChild("BodyGyro")
local stance,target = "wander",nil
local scanInterval = 2
local destination = (root.CFrame*CFrame.new(0,0,5)).p
local orientation = root.CFrame
local holdDuration = 5
local holdOrder = 0
local lastAdjustment,nextAdjustment = 0,25 |
--Made by Superluck, Uploaded by FederalSignal_QCB.
--Made by Superluck, Uploaded by FederalSignal_QCB.
--Made by Superluck, Uploaded by FederalSignal_QCB. | |
-- korblox |
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
player.Chatted:Connect(function(msg)
local loweredv = string.lower(msg)
if loweredv == "/korblox" then
local Humanoid = char:WaitForChild("Humanoid",1)
local descriptionClone = Humanoid:GetAppliedDescription()
descriptionClone.RightLeg = 139607718
Humanoid:ApplyDescription(descriptionClone)
end
end)
end)
end) |
--// Functions |
function MakeFakeArms()
Arms = Instance.new("Model")
Arms.Name = "Arms"
Arms.Parent = L_5_
local L_123_ = Instance.new("Humanoid")
L_123_.MaxHealth = 0
L_123_.Health = 0
L_123_.Name = ""
L_123_.Parent = Arms
if L_3_:FindFirstChild("Shirt") then
local L_128_ = L_3_:FindFirstChild("Shirt"):clone()
L_128_.Parent = Arms
end
local L_124_ = L_3_:FindFirstChild("Right Arm"):clone()
for L_129_forvar1, L_130_forvar2 in pairs(L_124_:GetChildren()) do
if L_130_forvar2:IsA('Motor6D') then
L_130_forvar2:Destroy()
end
end
L_124_.Name = "Right Arm"
L_124_.FormFactor = "Custom"
L_124_.Size = Vector3.new(0.8, 2.5, 0.8)
L_124_.Transparency = 0.0
local L_125_ = Instance.new("Motor6D")
L_125_.Part0 = L_124_
L_125_.Part1 = L_3_:FindFirstChild("Right Arm")
L_125_.C0 = CFrame.new()
L_125_.C1 = CFrame.new()
L_125_.Parent = L_124_
L_124_.Parent = Arms
local L_126_ = L_3_:FindFirstChild("Left Arm"):clone()
L_126_.Name = "Left Arm"
L_126_.FormFactor = "Custom"
L_126_.Size = Vector3.new(0.8, 2.5, 0.8)
L_126_.Transparency = 0.0
local L_127_ = Instance.new("Motor6D")
L_127_.Part0 = L_126_
L_127_.Part1 = L_3_:FindFirstChild("Left Arm")
L_127_.C0 = CFrame.new()
L_127_.C1 = CFrame.new()
L_127_.Parent = L_126_
L_126_.Parent = Arms
end
function RemoveArmModel()
if Arms then
Arms:Destroy()
Arms = nil
end
end
local L_93_
function CreateShell()
L_93_ = time()
local L_131_ = L_1_.Shell:clone()
if L_131_:FindFirstChild('Shell') then
L_131_.Shell:Destroy()
end
L_131_.CFrame = L_1_.Chamber.CFrame
L_131_.Velocity = L_1_.Chamber.CFrame.lookVector * 30 + Vector3.new(0, 4, 0)
--shell.RotVelocity = Vector3.new(-10,40,30)
L_131_.Parent = L_66_
L_131_.CanCollide = false
game:GetService("Debris"):addItem(L_131_, 1)
end
|
--!nocheck
-- ^ change to strict to crash studio c:
-- ActiveCast class type.
-- The ActiveCast type represents a currently running cast. | |
-- returns the Vector3 point at the given t value (t must be between 0 and 1 to return an excpected value)
-- does not work if the bezier does not have any points attached to it |
function Bezier:CalculatePositionAt(t: number): Vector3
-- check if t is between 0 and 1
if type(t) ~= "number" then
error("Bezier:CalculatePositionAt() only accepts a number, got " .. tostring(t) .. "!")
end
-- start algorithm to calculate position in bezier
local points = self.Points
local numPoints = #points
-- check if there is at least 1 point
if numPoints > 0 then
-- important values
local points = self:GetAllPoints()
local n = #points
-- get position at t
local c_t do
c_t = Vector3.new()
for i = 1, n do
local p_i = points[i]
local B_nit = B(n - 1, i - 1, t)
c_t += B_nit * p_i
end
end
-- return position
return c_t
else
-- not enough points to get position
error("Bezier:CalculatePositionAt() only works if there is at least 1 BezierPoint!")
end
end
|
-- make the part change color every 3s |
while wait(3) do
part.Color = Color3.fromRGB(math.random(0,255),math.random(0,255),math.random(0,255))
end
|
--- |
stopcall()
sbros()
end)
script.Parent.B.ClickDetector.MouseClick:Connect(function(player)
if sys.KVEnter.Value == true and folder.KV.Value.Value ~= config.AllCode.Value then
huh.ButtonSound:Play()
enter() |
-- RemoteSignal
-- Stephen Leitnick
-- January 07, 2021 | |
-- loop to handle timed state transitions and tool animations |
while Character.Parent ~= nil do
local _, currentGameTime = wait(0.1)
stepAnimate(currentGameTime)
end
|
-----------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------- |
script.Parent.MedicineAberto.TratarFeridasAberto.PainKiller.MouseButton1Down:Connect(function()
if Saude.Variaveis.Doer.Value == false then
if Target.Value == "N/A" then
Functions.PainKiller:FireServer()
Timer.Barra.Size = UDim2.new(0,0,1,0)
TS:Create(Timer.Barra, TweenInfo.new(2), {Size = UDim2.new(1,0,1,0)}):Play()
else
--FunctionsMulti.Energetic:FireServer()
end
end
end)
script.Parent.MedicineAberto.TratarFeridasAberto.Energy.MouseButton1Down:Connect(function()
if Saude.Variaveis.Doer.Value == false then
if Target.Value == "N/A" then
Functions.Energetic:FireServer()
Timer.Barra.Size = UDim2.new(0,0,1,0)
TS:Create(Timer.Barra, TweenInfo.new(2), {Size = UDim2.new(1,0,1,0)}):Play()
else
--FunctionsMulti.Energetic:FireServer()
end
end
end)
script.Parent.MedicineAberto.TratarFeridasAberto.Morphine.MouseButton1Down:Connect(function()
if Saude.Variaveis.Doer.Value == false then
if Target.Value == "N/A" then
--Functions.PainKiller:FireServer()
else
FunctionsMulti.Morphine:FireServer()
Timer.Barra.Size = UDim2.new(0,0,1,0)
TS:Create(Timer.Barra, TweenInfo.new(2), {Size = UDim2.new(1,0,1,0)}):Play()
end
end
end)
script.Parent.MedicineAberto.TratarFeridasAberto.Epinephrine.MouseButton1Down:Connect(function()
if Saude.Variaveis.Doer.Value == false then
if Target.Value == "N/A" then
--Functions.PainKiller:FireServer()
else
FunctionsMulti.Epinephrine:FireServer()
Timer.Barra.Size = UDim2.new(0,0,1,0)
TS:Create(Timer.Barra, TweenInfo.new(2), {Size = UDim2.new(1,0,1,0)}):Play()
end
end
end) |
--// # key, ManOff |
mouse.KeyUp:connect(function(key)
if key=="u" then
veh.Lightbar.middle.Man:Stop()
veh.Lightbar.middle.Wail.Volume = 1
veh.Lightbar.middle.Yelp.Volume = 1
veh.Lightbar.middle.Priority.Volume = 1
script.Parent.Parent.Sirens.Man.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
end
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 = 4.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
------------------------- |
function onClicked()
R.Function1.Disabled = false
R.Function2.Disabled = true
R.BrickColor = BrickColor.new("Really black")
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
--[[
Ser is a serialization/deserialization utility module that is used
by Knit to automatically serialize/deserialize values passing
through remote functions and remote events.
Ser.Classes = {
[ClassName] = {
Serialize = (value) -> serializedValue
Deserialize = (value) => deserializedValue
}
}
Ser.SerializeArgs(...) -> table
Ser.SerializeArgsAndUnpack(...) -> Tuple
Ser.DeserializeArgs(...) -> table
Ser.DeserializeArgsAndUnpack(...) -> Tuple
Ser.Serialize(value: any) -> any
Ser.Deserialize(value: any) -> any
Ser.UnpackArgs(args: table) -> Tuple
--]] |
type Args = {
n: number,
[any]: any,
}
local Option = require(script.Parent.Option)
|
-----------------------------------------------------Raycasting functions |
function raycursive(start,dir,ignore)
newdir = (start+dir)-start
local a,b = workspace:findPartOnRay(Ray.new(start,newdir.unit*999.999),ignore)
if a then
if not a.CanCollide and (a.Name ~= "Left Arm" and a.Name ~= "Left Leg" and a.Name ~= "Right Arm" and a.Name ~= "Right Leg") then
return raycursive(b,dir,a)
else
return a,b
end
else
return a,b
end
end
|
-- Variables |
local footstepsModule = require(replicatedStorage:WaitForChild("FootstepModule"))
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local rootPart = character:WaitForChild("HumanoidRootPart")
|
-- CONSTANT VARIABLES |
local THIS = script
local SLING = THIS.Parent
|
--<< FUNCTIONS >>
--Change value |
function module:ChangeStat(player, statName, changeValue)
local pdata = main.pd[player]
if pdata then
local newValue = pdata[statName]
--[[
if type(changeValue) == "number" and tonumber(newValue) then
if changeValue == "reset" then
newValue = 0
else
newValue = newValue + changeValue
end
else--]]
newValue = changeValue
--end
main.pd[player][statName] = newValue
main.pd[player].DataToUpdate = true
main.signals.ChangeStat:FireClient(player, {statName, newValue})
if statName == "Rank" then
main.signals.RankChanged:FireClient(player)
end
end
end
|
-- connect events |
Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Jumping:connect(onJumping)
Humanoid.Climbing:connect(onClimbing)
Humanoid.GettingUp:connect(onGettingUp)
Humanoid.FreeFalling:connect(onFreeFall)
Humanoid.FallingDown:connect(onFallingDown)
Humanoid.Seated:connect(onSeated)
Humanoid.PlatformStanding:connect(onPlatformStanding)
Humanoid.Swimming:connect(onSwimming)
if Character.Parent ~= nil then
-- initialize to idle
playAnimation("idle", 0.1, Humanoid)
pose = "Standing"
end
|
--[==[
if you want to make longer comments
you can surround them with the double dashes and double square brackets "--[[" and "--]]"
and you can surround those by ones with equals signs in them too
so you don't have to type the "--" every single line
--]==] | |
--[=[
@param player Player -- The target client
@param ... any -- Arguments passed to the client
Fires the signal at the specified client with any arguments.
:::note Outbound Middleware
All arguments pass through any outbound middleware before being
sent to the client.
:::
]=] |
function RemoteSignal:Fire(player: Player, ...: any)
self._re:FireClient(player, self:_processOutboundMiddleware(player, ...))
end
|
-- print("2!!!",hum.Health) |
if hum.Health<1 then return end
end
if bullet.DamageType.Value == 2 then
-- AoE
local position = bullet.Position
local radius = bullet.DamageRadius.Value
local maxDamage = bullet.cfgDamage.Value
bullet.Velocity = Vector3.new(0,0,0) -- остановить снаряд
customExplosion(position, radius, maxDamage)
--explosion = Instance.new("Explosion")
--explosion.Position = bullet.Position
--explosion.ExplosionType = ("NoCraters")
-- find instigator tag
--local creator = script.Parent:findFirstChild("creator")
--if creator ~= nil then
-- explosion.Hit:connect(function(part, distance) onPlayerBlownUp(part, distance, creator) end)
--end
--explosion.Parent = game.Workspace --- Обязательно свю фунцкию взрыва!!!
else -- SINGLE
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum~= nil then
-- hum:TakeDamage(damage)
Damage:Take(human, hum, damage) -- from, to, damage
end
end
connection:disconnect()
wait(.1)
bullet:Destroy()
end
connection = bullet.Touched:connect(blow)
wait(5) -- 5 секунд без попадания = самоуничтожиться
bullet:Destroy()
|
--[[Drivetrain]] |
Tune.Config = "AWD" --"FWD" , "RWD" , "AWD"
--Differential Settings
Tune.FDiffSlipThres = 45 -- 1 - 100% (Max threshold of applying full lock determined by deviation from avg speed)
Tune.FDiffLockThres = 45 -- 0 - 100% (0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
Tune.RDiffSlipThres = 45 -- 1 - 100%
Tune.RDiffLockThres = 45 -- 0 - 100%
Tune.CDiffSlipThres = 45 -- 1 - 100% [AWD Only]
Tune.CDiffLockThres = 45 -- 0 - 100% [AWD Only]
--Traction Control Settings
Tune.TCSEnabled = true -- Implements TCS
Tune.TCSThreshold = 20 -- Slip speed allowed before TCS starts working (in SPS)
Tune.TCSGradient = 20 -- Slip speed gradient between 0 to max reduction (in SPS)
Tune.TCSLimit = 10 -- Minimum amount of torque at max reduction (in percent)
|
--I M P O R T A N T--
------------------------------------------------------------------------
--Don't change any of this, this is what makes the GUI apear and work.
------------------------------------------------------------------------ |
function onClick(click)
for i,v in pairs (script.Parent:GetChildren()) do
if v.ClassName == "ScreenGui" then
c = v:Clone()
c.Parent = click.PlayerGui
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClick)
|
--[[**
<description>
The same as :Get only it'll check to make sure all keys in the default data provided
exist. If not, will pass in the default value only for that key.
This is recommended for tables in case you want to add new entries to the table.
Note this is not required for tables, it only provides an extra functionality.
</description>
<parameter name = "defaultValue">
A table that will have its keys compared to that of the actual data received.
</parameter>
<returns>
The value in the data store will all keys from the default value provided.
</returns>
**--]] |
function DataStore:GetTable(default, ...)
assert(default ~= nil, "You must provide a default value with :GetTable.")
local result = self:Get(default, ...)
local changed = false
assert(typeof(result) == "table", ":GetTable was used when the value in the data store isn't a table.")
for defaultKey, defaultValue in pairs(default) do
if result[defaultKey] == nil then
result[defaultKey] = defaultValue
changed = true
end
end
if changed then
self:Set(result)
end
return result
end
|
--[[**
<description>
Adds a backup to the data store if :Get() fails a specified amount of times.
Will return the value provided (if the value is nil, then the default value of :Get() will be returned)
and mark the data store as a backup store, and attempts to :Save() will not truly save.
</description>
<parameter name = "retries">
Number of retries before the backup will be used.
</parameter>
<parameter name = "value">
The value to return to :Get() in the case of a failure.
You can keep this blank and the default value you provided with :Get() will be used instead.
</parameter>
**--]] |
function DataStore:SetBackup(retries, value)
self.backupRetries = retries
self.backupValue = value
end
|
--WARNING!
--DO NOT MODIFY THE CODE BELOW! (Unless you know what you're doing, in that case: Go nuts!) |
local motor = script.Parent.Base.HingeConstraint
local display = script.Parent.Display.SurfaceGui.TextLabel
local current_mode = 0
function Mode_Up()
if current_mode < max_mode then
current_mode = current_mode + 1
motor.AngularVelocity = motor.AngularVelocity + increment_speed
display.Text = current_mode
end
end
function Mode_Down()
if current_mode > min_mode then
current_mode = current_mode - 1
motor.AngularVelocity = motor.AngularVelocity - increment_speed
display.Text = current_mode
end
end
script.Parent.Button_Up.ClickDetector.mouseClick:connect(Mode_Up)
script.Parent.Button_Down.ClickDetector.mouseClick:connect(Mode_Down)
|
-- debug.profilebegin("NEW_CREATE_DROPLET") |
CreateDroplet() |
-- TextLabel default properties |
defaults.Font = "SourceSans"
defaults.TextColor3 = "White"
defaults.TextStrokeColor3 = "Black"
defaults.TextTransparency = 0
defaults.TextStrokeTransparency = 1
defaults.BackgroundTransparency = 1
defaults.BorderSizePixel = 0
|
-- Movement mode standardized to Enum.ComputerCameraMovementMode values |
function BaseCamera:SetCameraMovementMode( cameraMovementMode )
self.cameraMovementMode = cameraMovementMode
end
function BaseCamera:GetCameraMovementMode()
return self.cameraMovementMode
end
function BaseCamera:SetIsMouseLocked(mouseLocked)
self.inMouseLockedMode = mouseLocked
end
function BaseCamera:GetIsMouseLocked()
return self.inMouseLockedMode
end
function BaseCamera:SetMouseLockOffset(offsetVector)
self.mouseLockOffset = offsetVector
end
function BaseCamera:GetMouseLockOffset()
return self.mouseLockOffset
end
function BaseCamera:InFirstPerson()
return self.inFirstPerson
end
function BaseCamera:EnterFirstPerson()
-- Overridden in ClassicCamera, the only module which supports FirstPerson
end
function BaseCamera:LeaveFirstPerson()
-- Overridden in ClassicCamera, the only module which supports FirstPerson
end
|
-- Management of which options appear on the Roblox User Settings screen |
do
local PlayerScripts = Players.LocalPlayer:WaitForChild("PlayerScripts")
PlayerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Default)
PlayerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Follow)
PlayerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Classic)
PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Default)
PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Follow)
PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Classic)
PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.CameraToggle)
end
function CameraModule.new()
local self = setmetatable({},CameraModule)
-- Current active controller instances
self.activeCameraController = nil
self.activeOcclusionModule = nil
self.activeTransparencyController = nil
self.activeMouseLockController = nil
self.currentComputerCameraMovementMode = nil
-- Connections to events
self.cameraSubjectChangedConn = nil
self.cameraTypeChangedConn = nil
-- Adds CharacterAdded and CharacterRemoving event handlers for all current players
for _,player in pairs(Players:GetPlayers()) do
self:OnPlayerAdded(player)
end
-- Adds CharacterAdded and CharacterRemoving event handlers for all players who join in the future
Players.PlayerAdded:Connect(function(player)
self:OnPlayerAdded(player)
end)
self.activeTransparencyController = TransparencyController.new()
self.activeTransparencyController:Enable(true)
if not UserInputService.TouchEnabled then
self.activeMouseLockController = MouseLockController.new()
local toggleEvent = self.activeMouseLockController:GetBindableToggleEvent()
if toggleEvent then
toggleEvent:Connect(function()
self:OnMouseLockToggled()
end)
end
end
self:ActivateCameraController(self:GetCameraControlChoice())
self:ActivateOcclusionModule(Players.LocalPlayer.DevCameraOcclusionMode)
self:OnCurrentCameraChanged() -- Does initializations and makes first camera controller
RunService:BindToRenderStep("cameraRenderUpdate", Enum.RenderPriority.Camera.Value, function(dt) self:Update(dt) end)
-- Connect listeners to camera-related properties
for _, propertyName in pairs(PLAYER_CAMERA_PROPERTIES) do
Players.LocalPlayer:GetPropertyChangedSignal(propertyName):Connect(function()
self:OnLocalPlayerCameraPropertyChanged(propertyName)
end)
end
for _, propertyName in pairs(USER_GAME_SETTINGS_PROPERTIES) do
UserGameSettings:GetPropertyChangedSignal(propertyName):Connect(function()
self:OnUserGameSettingsPropertyChanged(propertyName)
end)
end
game.Workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function()
self:OnCurrentCameraChanged()
end)
self.lastInputType = UserInputService:GetLastInputType()
UserInputService.LastInputTypeChanged:Connect(function(newLastInputType)
self.lastInputType = newLastInputType
end)
return self
end
function CameraModule:GetCameraMovementModeFromSettings()
local cameraMode = Players.LocalPlayer.CameraMode
-- Lock First Person trumps all other settings and forces ClassicCamera
if cameraMode == Enum.CameraMode.LockFirstPerson then
return CameraUtils.ConvertCameraModeEnumToStandard(Enum.ComputerCameraMovementMode.Classic)
end
local devMode, userMode
if UserInputService.TouchEnabled then
devMode = CameraUtils.ConvertCameraModeEnumToStandard(Players.LocalPlayer.DevTouchCameraMode)
userMode = CameraUtils.ConvertCameraModeEnumToStandard(UserGameSettings.TouchCameraMovementMode)
else
devMode = CameraUtils.ConvertCameraModeEnumToStandard(Players.LocalPlayer.DevComputerCameraMode)
userMode = CameraUtils.ConvertCameraModeEnumToStandard(UserGameSettings.ComputerCameraMovementMode)
end
if devMode == Enum.DevComputerCameraMovementMode.UserChoice then
-- Developer is allowing user choice, so user setting is respected
return userMode
end
return devMode
end
function CameraModule:ActivateOcclusionModule(occlusionMode: Enum.DevCameraOcclusionMode)
local newModuleCreator
if occlusionMode == Enum.DevCameraOcclusionMode.Zoom then
newModuleCreator = Poppercam
elseif occlusionMode == Enum.DevCameraOcclusionMode.Invisicam then
newModuleCreator = Invisicam
else
warn("CameraScript ActivateOcclusionModule called with unsupported mode")
return
end
self.occlusionMode = occlusionMode
-- First check to see if there is actually a change. If the module being requested is already
-- the currently-active solution then just make sure it's enabled and exit early
if self.activeOcclusionModule and self.activeOcclusionModule:GetOcclusionMode() == occlusionMode then
if not self.activeOcclusionModule:GetEnabled() then
self.activeOcclusionModule:Enable(true)
end
return
end
-- Save a reference to the current active module (may be nil) so that we can disable it if
-- we are successful in activating its replacement
local prevOcclusionModule = self.activeOcclusionModule
-- If there is no active module, see if the one we need has already been instantiated
self.activeOcclusionModule = instantiatedOcclusionModules[newModuleCreator]
-- If the module was not already instantiated and selected above, instantiate it
if not self.activeOcclusionModule then
self.activeOcclusionModule = newModuleCreator.new()
if self.activeOcclusionModule then
instantiatedOcclusionModules[newModuleCreator] = self.activeOcclusionModule
end
end
-- If we were successful in either selecting or instantiating the module,
-- enable it if it's not already the currently-active enabled module
if self.activeOcclusionModule then
local newModuleOcclusionMode = self.activeOcclusionModule:GetOcclusionMode()
-- Sanity check that the module we selected or instantiated actually supports the desired occlusionMode
if newModuleOcclusionMode ~= occlusionMode then
warn("CameraScript ActivateOcclusionModule mismatch: ",self.activeOcclusionModule:GetOcclusionMode(),"~=",occlusionMode)
end
-- Deactivate current module if there is one
if prevOcclusionModule then
-- Sanity check that current module is not being replaced by itself (that should have been handled above)
if prevOcclusionModule ~= self.activeOcclusionModule then
prevOcclusionModule:Enable(false)
else
warn("CameraScript ActivateOcclusionModule failure to detect already running correct module")
end
end
-- Occlusion modules need to be initialized with information about characters and cameraSubject
-- Invisicam needs the LocalPlayer's character
-- Poppercam needs all player characters and the camera subject
if occlusionMode == Enum.DevCameraOcclusionMode.Invisicam then
-- Optimization to only send Invisicam what we know it needs
if Players.LocalPlayer.Character then
self.activeOcclusionModule:CharacterAdded(Players.LocalPlayer.Character, Players.LocalPlayer )
end
else
-- When Poppercam is enabled, we send it all existing player characters for its raycast ignore list
for _, player in pairs(Players:GetPlayers()) do
if player and player.Character then
self.activeOcclusionModule:CharacterAdded(player.Character, player)
end
end
self.activeOcclusionModule:OnCameraSubjectChanged(game.Workspace.CurrentCamera.CameraSubject)
end
-- Activate new choice
self.activeOcclusionModule:Enable(true)
end
end
function CameraModule:ShouldUseVehicleCamera()
local camera = workspace.CurrentCamera
if not camera then
return false
end
local cameraType = camera.CameraType
local cameraSubject = camera.CameraSubject
local isEligibleType = cameraType == Enum.CameraType.Custom or cameraType == Enum.CameraType.Follow
local isEligibleSubject = cameraSubject and cameraSubject:IsA("VehicleSeat") or false
local isEligibleOcclusionMode = self.occlusionMode ~= Enum.DevCameraOcclusionMode.Invisicam
return isEligibleSubject and isEligibleType and isEligibleOcclusionMode
end
|
--[[
Instance references
]] |
local maid = Maid.new()
maid.instance = script.Parent
maid.humanoid = maid.instance:WaitForChild("Humanoid")
maid.head = maid.instance:WaitForChild("Head")
maid.humanoidRootPart = maid.instance:FindFirstChild("HumanoidRootPart")
maid.alignOrientation = maid.humanoidRootPart:FindFirstChild("AlignOrientation")
|
--[=[
Returns true if cancelled
@return boolean
]=] |
function CancelToken:IsCancelled()
return self.PromiseCancelled:IsFulfilled()
end
function CancelToken:_cancel()
self.PromiseCancelled:Resolve()
end
return CancelToken
|
--[=[
Observes an instance's ancestry
@param instance Instance
@param className string
@return Observable<Instance>
]=] |
function RxInstanceUtils.observeFirstAncestorBrio(instance, className)
assert(typeof(instance) == "Instance", "Bad instance")
assert(type(className) == "string", "Bad className")
return Observable.new(function(sub)
local maid = Maid.new()
local lastFound = nil
local function handleAncestryChanged()
local found = instance:FindFirstAncestorWhichIsA(className)
if found then
if found ~= lastFound then
lastFound = found
local brio = Brio.new(found)
maid._current = brio
sub:Fire(brio)
end
elseif lastFound then
maid._current = nil
lastFound = nil
end
end
maid:GiveTask(instance.AncestryChanged:Connect(handleAncestryChanged))
handleAncestryChanged()
return maid
end)
end
|
--[[Brakes]] |
Tune.ABSEnabled = false -- Implements ABS
Tune.ABSThreshold = 20 -- Slip speed allowed before ABS starts working (in SPS)
Tune.FBrakeForce = 1200 -- Front brake force
Tune.RBrakeForce = 1600 -- Rear brake force
Tune.PBrakeForce = 6000 -- Handbrake force
Tune.FLgcyBForce = 15000 -- Front brake force [PGS OFF]
Tune.RLgcyBForce = 10000 -- Rear brake force [PGS OFF]
Tune.LgcyPBForce = 25000 -- Handbrake force [PGS OFF]
|
--// Connections |
L_105_.OnClientEvent:connect(function(L_188_arg1, L_189_arg2, L_190_arg3, L_191_arg4, L_192_arg5, L_193_arg6, L_194_arg7)
if L_188_arg1 and not L_15_ then
MakeFakeArms()
L_42_ = L_2_.PlayerGui.MainGui
L_26_ = L_42_:WaitForChild('Others')
L_27_ = L_26_:WaitForChild('Kill')
L_28_ = L_42_:WaitForChild('GameGui'):WaitForChild('AmmoFrame')
L_29_ = L_28_:WaitForChild('Ammo')
L_30_ = L_28_:WaitForChild('AmmoBackground')
L_31_ = L_28_:WaitForChild('MagCount')
L_32_ = L_28_:WaitForChild('MagCountBackground')
L_33_ = L_28_:WaitForChild('DistDisp')
L_34_ = L_28_:WaitForChild('Title')
L_35_ = L_28_:WaitForChild('Mode1')
L_36_ = L_28_:WaitForChild('Mode2')
L_37_ = L_28_:WaitForChild('Mode3')
L_38_ = L_28_:WaitForChild('Mode4')
L_39_ = L_28_:WaitForChild('Mode5')
L_40_ = L_28_:WaitForChild('Stances')
L_41_ = L_42_:WaitForChild('Shading')
L_41_.Visible = false
L_34_.Text = L_1_.Name
UpdateAmmo()
L_43_ = L_189_arg2
L_44_ = L_190_arg3
L_45_ = L_191_arg4
L_46_ = L_192_arg5
L_47_ = L_193_arg6
L_48_ = L_194_arg7
L_49_ = L_59_.Bolt
L_84_ = L_48_.C1
L_85_ = L_48_.C0
if L_1_:FindFirstChild('AimPart2') then
L_54_ = L_1_:WaitForChild('AimPart2')
end
if L_1_:FindFirstChild('FirePart2') then
L_57_ = L_1_.FirePart2
end
if L_24_.FirstPersonOnly then
L_2_.CameraMode = Enum.CameraMode.LockFirstPerson
end
--uis.MouseIconEnabled = false
L_5_.FieldOfView = 70
L_15_ = true
elseif L_15_ then
if L_3_ and L_3_.Humanoid and L_3_.Humanoid.Health > 0 and L_9_ then
Stand()
Unlean()
end
L_90_ = 0
L_77_ = false
L_78_ = false
L_79_ = false
L_61_ = false
L_64_ = false
L_63_ = false
Shooting = false
L_94_ = 70
RemoveArmModel()
L_42_:Destroy()
for L_195_forvar1, L_196_forvar2 in pairs(IgnoreList) do
if L_196_forvar2 ~= L_3_ and L_196_forvar2 ~= L_5_ and L_196_forvar2 ~= L_98_ then
table.remove(IgnoreList, L_195_forvar1)
end
end
if L_3_:FindFirstChild('Right Arm') and L_3_:FindFirstChild('Left Arm') then
L_3_['Right Arm'].LocalTransparencyModifier = 0
L_3_['Left Arm'].LocalTransparencyModifier = 0
end
L_75_ = false
L_66_ = true
L_2_.CameraMode = Enum.CameraMode.Classic
L_104_.MouseIconEnabled = true
L_5_.FieldOfView = 70
L_15_ = false
L_104_.MouseDeltaSensitivity = L_52_
L_15_ = false
end
end)
|
--//Remote Functions\\-- |
fire.OnServerEvent:Connect(function(player, mouseHit)
local character = player.Character
local humanoid = character:FindFirstChild("Humanoid")
local weaponAccuracy = Vector3.new(math.random(-accuracy.Value * 2, accuracy.Value * 2), math.random(-accuracy.Value * 2, accuracy.Value * 2), math.random(-accuracy.Value * 2, accuracy.Value * 2))
if humanoid and humanoid ~= 0 then
local projectile = Instance.new("Part", workspace)
local trail = Instance.new("Trail", projectile)
trail.FaceCamera = true
trail.Lifetime = 0.3
trail.MinLength = 0.15
trail.LightEmission = 0.25
local attachment0 = Instance.new("Attachment", projectile)
attachment0.Position = Vector3.new(0.35, 0, 0)
attachment0.Name = "Attachment1"
local attachment1 = Instance.new("Attachment", projectile)
attachment1.Position = Vector3.new(-0.35, 0, 0)
attachment1.Name = "Attachment1"
trail.Attachment0 = attachment0
trail.Attachment1 = attachment1
projectile.Name = "Bullet"
projectile.BrickColor = BrickColor.new("Smoky gray")
projectile.Shape = "Ball"
projectile.Material = Enum.Material.Metal
projectile.TopSurface = 0
projectile.BottomSurface = 0
projectile.Size = Vector3.new(1, 1, 1)
projectile.Transparency = 1
projectile.CFrame = CFrame.new(muzzle.CFrame.p, mouseHit.p)
projectile.CanCollide = false
local transparencyPoints = {}
local startColor = Color3.new(255, 255, 0)
local endColor = Color3.new(213, 115, 61)
table.insert(transparencyPoints, NumberSequenceKeypoint.new(0, 1))
table.insert(transparencyPoints, NumberSequenceKeypoint.new(0.25, 0))
table.insert(transparencyPoints, NumberSequenceKeypoint.new(1, 1))
local determinedTransparency = NumberSequence.new(transparencyPoints)
local determinedColors = ColorSequence.new(startColor, endColor)
trail.Transparency = determinedTransparency
trail.Color = determinedColors
local bodyVelocity = Instance.new("BodyVelocity", projectile)
bodyVelocity.MaxForce = Vector3.new(9e9, 9e9, 9e9)
bodyVelocity.Velocity = (mouseHit.lookVector * velocity.Value) + weaponAccuracy
debris:AddItem(projectile, 20)
projectile.Touched:Connect(function(hit)
local eHumanoid = hit.Parent:FindFirstChild("Humanoid") or hit.Parent.Parent:FindFirstChild("Humanoid")
local damage = math.random(minDamage.Value, maxDamage.Value)
if not eHumanoid and not hit.Anchored and not hit:IsDescendantOf(character) then
projectile:Destroy()
elseif eHumanoid and eHumanoid ~= humanoid and eHumanoid.Health > 0 and hit ~= projectile then
if hit.Name == "Head" or hit:IsA("Hat") then
damage = damage * 1.5
end
local criticalPoint = maxDamage.Value
DamageAndTagHumanoid(player, eHumanoid, damage)
if showDamageText then
DynamicText(damage, criticalPoint, eHumanoid)
else
end
projectile:Destroy()
elseif hit.CanCollide == true and not hit:IsDescendantOf(player.Character) and hit.Anchored == true then
projectile:Destroy()
end
end)
handle.Fire:Play()
muzzleEffect.Visible = true
muzzleEffect.Rotation = math.random(-360, 360)
delay(0.1, function()
muzzleEffect.Visible = false
end)
end
end)
activateSpecial.OnServerEvent:Connect(function(player)
accuracy.Value, fireRate.Value = accuracy.Value / 2, fireRate.Value / 2
minDamage.Value, maxDamage.Value = minDamage.Value / 2, maxDamage.Value / 2
spawn(function()
local chargeSound = Instance.new("Sound", player.PlayerGui)
chargeSound.Name = "ChargeSound"
chargeSound.SoundId = "rbxassetid://163619849"
chargeSound:Play()
chargeSound.Ended:Connect(function() chargeSound:Destroy() end)
local sparkles = Instance.new("Sparkles", handle)
sparkles.SparkleColor = Color3.fromRGB(255, 236, 21)
local activatedGui = Instance.new("ScreenGui", player.PlayerGui)
activatedGui.Name = "SpecialActivated"
local textLabel = Instance.new("TextLabel", activatedGui)
textLabel.TextColor3 = Color3.fromRGB(0, 180, 30)
textLabel.Text = "Trigger Happy activated!"
textLabel.Font = Enum.Font.SourceSans
textLabel.TextScaled = true
textLabel.TextStrokeTransparency = 0
textLabel.Size = UDim2.new(0, 300, 0, 50)
textLabel.Position = UDim2.new(2.5, 0, 0.15, -10)
textLabel.BackgroundTransparency = 1
textLabel:TweenPosition(UDim2.new(0.5, -(textLabel.Size.X.Offset / 2), 0.1, -10), Enum.EasingDirection.Out, Enum.EasingStyle.Back, 1)
debris:AddItem(sparkles, specialDuration.Value)
debris:AddItem(chargeSound, 3)
wait(3)
TextEffects(textLabel, 200, Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 1)
end)
for i = specialDuration.Value, 0, -1 do
wait(1)
print("Special activated: "..i)
end
accuracy.Value, fireRate.Value = accuracy.Value * 2, fireRate.Value * 2
minDamage.Value, maxDamage.Value = minDamage.Value * 2, maxDamage.Value * 2
activateSpecial:FireClient(player)
end)
|
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = {};
local v2 = require(game.ReplicatedStorage.Modules.Xeno);
local v3 = require(game.ReplicatedStorage.Modules.CameraShaker);
local l__TweenService__4 = game.TweenService;
local l__Debris__5 = game.Debris;
local u1 = require(game.ReplicatedStorage.Modules.Lightning);
local l__ReplicatedStorage__2 = game.ReplicatedStorage;
function v1.RunStompFx(p1, p2, p3, p4)
task.delay(0, function()
local v6 = u1.Bolt((CFrame.new(p2.CFrame.p) * CFrame.new(0, 250, 0) * CFrame.new(math.random(-1, 1), math.random(-1, 1), math.random(-1, 1))).Position, (p2.CFrame * CFrame.new(math.random(-2, 2), math.random(-1, 1), math.random(-1, 1))).Position, 10, 0.25, false);
v6.PulseSpeed = 12;
v6.PulseLength = 5;
v6.MinRadius = 0;
v6.MaxRadius = 5;
v6.FadeLength = 0.1;
v6.Thickness = 3;
v6.MinTransparency = 0.25;
v6.MaxTransparency = 0.3;
v6.Color = Color3.fromRGB(251, 255, 16);
end);
local v7 = l__ReplicatedStorage__2.KillFX[p1].Stomp:Clone();
v7.Parent = p2.Parent.UpperTorso and p2;
v7:Play();
game.Debris:AddItem(v7, 4);
local v8 = l__ReplicatedStorage__2.KillFX[p1].HitPart:Clone();
v8.Parent = workspace.Ignored.Animations;
v8.CFrame = CFrame.new(p2.CFrame.Position);
task.delay(0.25, function()
for v9, v10 in pairs(v8.Attachment:GetChildren()) do
v10.Enabled = false;
end;
end);
task.delay(0.1, function()
l__ReplicatedStorage__2.KillFX[p1].FireEffect:Clone().Parent = p2.Parent.UpperTorso;
for v11, v12 in pairs(p2.Parent:GetDescendants()) do
if v12:IsA("Basepart") and not v12:IsA("MeshPart") then
v12.Color = Color3.fromRGB(0, 0, 0);
elseif v12:IsA("Shirt") or v12:IsA("Pants") then
v12.Color3 = Color3.fromRGB(0, 0, 0);
elseif v12:IsA("Mesh") then
v12.VertexColor = Color3.fromRGB(0, 0, 0);
elseif v12:IsA("MeshPart") then
v12.TextureID = "";
v12.Color = Color3.fromRGB(0, 0, 0);
end;
end;
end);
game.Debris:AddItem(v8, 4);
return nil;
end;
return v1;
|
-- References to reduce indexing time |
local GetConnectedParts = Instance.new('Part').GetConnectedParts;
local GetChildren = script.GetChildren;
function GetPartJoints(Part, Whitelist)
-- Returns any manual joints involving `Part`
local Joints = {};
-- Get joints stored inside `Part`
for Joint, JointParent in pairs(SearchJoints(Part, Part, Whitelist)) do
Joints[Joint] = JointParent;
end;
-- Get joints stored inside connected parts
for _, ConnectedPart in pairs(GetConnectedParts(Part)) do
for Joint, JointParent in pairs(SearchJoints(ConnectedPart, Part, Whitelist)) do
Joints[Joint] = JointParent;
end;
end;
-- Return all found joints
return Joints;
end;
|
--Steer Gyro Tuning |
Tune.SteerD = 1000 -- Steering Dampening
Tune.SteerMaxTorque = 50000 -- Steering Force
Tune.SteerP = 100000 -- Steering Aggressiveness
|
-- loop to handle timed state transitions and tool animations |
while Character.Parent ~= nil do
local _, currentGameTime = wait(0.1)
stepAnimate(currentGameTime)
end
--[[ ]]
--[[ ]]
|
--[=[
Accepts an array of Promises and returns a new Promise that resolves with an array of in-place Statuses when all input Promises have settled. This is equivalent to mapping `promise:finally` over the array of Promises.
```lua
local promises = {
returnsAPromise("example 1"),
returnsAPromise("example 2"),
returnsAPromise("example 3"),
}
return Promise.allSettled(promises)
```
@param promises {Promise<T>}
@return Promise<{Status}>
]=] |
function Promise.allSettled(promises)
if type(promises) ~= "table" then
error(string.format(ERROR_NON_LIST, "Promise.allSettled"), 2)
end
-- We need to check that each value is a promise here so that we can produce
-- a proper error rather than a rejected promise with our error.
for i, promise in pairs(promises) do
if not Promise.is(promise) then
error(string.format(ERROR_NON_PROMISE_IN_LIST, "Promise.allSettled", tostring(i)), 2)
end
end
-- If there are no values then return an already resolved promise.
if #promises == 0 then
return Promise.resolve({})
end
return Promise._new(debug.traceback(nil, 2), function(resolve, _, onCancel)
-- An array to contain our resolved values from the given promises.
local fates = {}
local newPromises = {}
-- Keep a count of resolved promises because just checking the resolved
-- values length wouldn't account for promises that resolve with nil.
local finishedCount = 0
-- Called when a single value is resolved and resolves if all are done.
local function resolveOne(i, ...)
finishedCount = finishedCount + 1
fates[i] = ...
if finishedCount >= #promises then
resolve(fates)
end
end
onCancel(function()
for _, promise in ipairs(newPromises) do
promise:cancel()
end
end)
-- We can assume the values inside `promises` are all promises since we
-- checked above.
for i, promise in ipairs(promises) do
newPromises[i] = promise:finally(function(...)
resolveOne(i, ...)
end)
end
end)
end
|
--Auto welding script (anchors so the tree doesnt fall apart) |
for i,v in pairs(script.Parent:GetDescendants()) do
if v.Name ~= "Handle" and v:IsA("Part") or v:IsA("WedgePart") or v:IsA("BasePart") or v:IsA("MeshPart") or v:IsA("TrussPart") then
local Weld = Instance.new("WeldConstraint",v)
Weld.Part0 = script.Parent.Handle
Weld.Part1 = v
end
end
|
-- << RETRIEVE FRAMEWORK >> |
local main = require(game:GetService("ReplicatedStorage"):WaitForChild("HDAdminSetup")):GetMain(true)
main:Initialize("Client")
|
--Place me in StarterCharacterScripts located in StarterPlayer |
local character = script.Parent
local timesby = 1 --Multiplyer
local DamageVelocity = 200 --How fast you go to take damage
local humanoid = script.Parent:WaitForChild("Humanoid")
local humanoidRP = script.Parent:WaitForChild("HumanoidRootPart")
local stateType = Enum.HumanoidStateType
local speed = 0
local fell = false
while true do
wait()
if humanoidRP.Velocity.Y < -DamageVelocity then
speed = speed + timesby
fell = false
humanoid:SetStateEnabled(stateType.GettingUp, false)
humanoid:ChangeState(stateType.FallingDown)
humanoid.Parent.Head.RotVelocity = Vector3.new(0,10,20)
end
if humanoid.FloorMaterial ~= nil and humanoid.FloorMaterial ~= Enum.Material.Air and humanoid.FloorMaterial ~= Enum.Material.Rock and humanoid.FloorMaterial ~= Enum.Material.Water and fell then
fell = false
humanoid:ChangeState(stateType.FallingDown)
humanoid.Health = humanoid.Health - speed
speed = 0
humanoid.Parent.UpperTorso.RotVelocity = Vector3.new(0,-10,20)
elseif humanoidRP.Velocity.Y > -DamageVelocity then
wait()
speed = 0
humanoid:SetStateEnabled(stateType.GettingUp, true)
end
end
|
-- character.Humanoid.Died:Connect(function()
-- playerDiedCallFunction(player)
-- end) | |
-- Updated 10/14/2014 - Updated to 1.0.2
--- Fixed bug fix. | |
-- for key,value in pairs(Objects) do
-- print("Name of object: ",key)
-- if sessionData[playerUserId][key] == nil then
-- print("Adding new version objects "..key)
-- sessionData[playerUserId][key] = false
-- end
-- end
-- for key,value in pairs(Objects) do
-- --print("Adding object "..key)
-- sessionData[playerUserId][key] = false
-- end |
--Investigate
--local purchaseHandlerNew = waitForTycoonsPurchaseHandlerNew()
--local Objects = require(purchaseHandlerNew)
--local Objects = require(tycoons[1]:WaitForChild("PurchaseHandlerNew"))
|
--"False" = Not Acceptable Keycard To Open. "True" = Acceptable Keycard To Open.-- |
local door = script.Parent
local bool = false
local CanOpen1 = true
local CanClose1 = false
local AccessDenied = script.Parent.AccessDenied
local AccessGranted = script.Parent.AccessGranted
local clearance = {
["[SCP] Card-Omni"] = true,
["[SCP] Card-L5"] = false,
["[SCP] Card-L4"] = false,
["[SCP] Card-L3"] = false,
["[SCP] Card-L2"] = false,
["[SCP] Card-L1"] = false
}
--DO NOT EDIT PAST THIS LINE--
function openDoor()
script.Parent.DoorOpen:play()
for i = 3,(door.Size.z / 0.15) do
wait()
door.CFrame = door.CFrame - (door.CFrame.lookVector * 0.15)
end
end
function closeDoor()
script.Parent.DoorClose:play()
for i = 3,(door.Size.z / 0.15) do
wait()
door.CFrame = door.CFrame + (door.CFrame.lookVector * 0.15)
end
end
script.Parent.Parent.KeycardReader1.touched:connect(function(touch)
if touch.Name == "Handle" and clearance[touch.Parent.Name] and CanOpen1 == true then
CanOpen1 = false
AccessGranted:Play()
wait(0.75)
openDoor()
wait(1)
CanClose1 = true
elseif touch.Name == "Handle" and clearance[touch.Parent.Name] and CanClose1 == true then
CanClose1 = false
AccessGranted:Play()
wait(0.75)
closeDoor()
wait(1)
CanOpen1 = true
elseif touch.Name == "Handle" and clearance[touch.Parent.Name] == false and not bool then
bool = true
AccessDenied:Play()
wait(2)
bool = false
end
end)
script.Parent.Parent.KeycardReader2.touched:connect(function(touch)
if touch.Name == "Handle" and clearance[touch.Parent.Name] and CanOpen1 == true then
CanOpen1 = false
AccessGranted:Play()
wait(0.75)
openDoor()
wait(1)
CanClose1 = true
elseif touch.Name == "Handle" and clearance[touch.Parent.Name] and CanClose1 == true then
CanClose1 = false
AccessGranted:Play()
wait(0.75)
closeDoor()
wait(1)
CanOpen1 = true
elseif touch.Name == "Handle" and clearance[touch.Parent.Name] == false and not bool then
bool = true
AccessDenied:Play()
wait(2)
bool = false
end
end)
|
--------RIGHT DOOR -------- |
game.Workspace.doorright.l11.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l12.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l21.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l13.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(106)
game.Workspace.doorright.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.Lighting.flashcurrent.Value = "11" |
-- Time it takes to reload weapon |
local ReloadTime = 3 |
-- How fast a player must fall down to avoid triggering the
-- anti-flight system. I recommend keeping this above 50
-- to curtail gliding exploits. |
config.FlightHeatCooldownRequiredFallSpeed = 50
|
--end
----if TurnValues.TurnSignal2.Value == 2 then |
TurnValues.TurnSignal2.Value = 3 |
--////////////////////////////////////////////////////////////////////////////////////////////
--////////////////////////////////////////////////////////////// Code to do chat window fading
--//////////////////////////////////////////////////////////////////////////////////////////// |
function CheckIfPointIsInSquare(checkPos, topLeft, bottomRight)
return (topLeft.X <= checkPos.X and checkPos.X <= bottomRight.X and
topLeft.Y <= checkPos.Y and checkPos.Y <= bottomRight.Y)
end
local backgroundIsFaded = false
local textIsFaded = false
local lastTextFadeTime = 0
local lastBackgroundFadeTime = 0
local fadedChanged = Instance.new("BindableEvent")
local mouseStateChanged = Instance.new("BindableEvent")
local chatBarFocusChanged = Instance.new("BindableEvent")
function DoBackgroundFadeIn(setFadingTime)
lastBackgroundFadeTime = tick()
backgroundIsFaded = false
fadedChanged:Fire()
ChatWindow:FadeInBackground((setFadingTime or ChatSettings.ChatDefaultFadeDuration))
local currentChannelObject = ChatWindow:GetCurrentChannel()
if (currentChannelObject) then
local Scroller = MessageLogDisplay.Scroller
Scroller.ScrollingEnabled = true
Scroller.ScrollBarThickness = moduleMessageLogDisplay.ScrollBarThickness
end
end
function DoBackgroundFadeOut(setFadingTime)
lastBackgroundFadeTime = tick()
backgroundIsFaded = true
fadedChanged:Fire()
ChatWindow:FadeOutBackground((setFadingTime or ChatSettings.ChatDefaultFadeDuration))
local currentChannelObject = ChatWindow:GetCurrentChannel()
if (currentChannelObject) then
local Scroller = MessageLogDisplay.Scroller
Scroller.ScrollingEnabled = false
Scroller.ScrollBarThickness = 0
end
end
function DoTextFadeIn(setFadingTime)
lastTextFadeTime = tick()
textIsFaded = false
fadedChanged:Fire()
ChatWindow:FadeInText((setFadingTime or ChatSettings.ChatDefaultFadeDuration) * 0)
end
function DoTextFadeOut(setFadingTime)
lastTextFadeTime = tick()
textIsFaded = true
fadedChanged:Fire()
ChatWindow:FadeOutText((setFadingTime or ChatSettings.ChatDefaultFadeDuration))
end
function DoFadeInFromNewInformation()
DoTextFadeIn()
if ChatSettings.ChatShouldFadeInFromNewInformation then
DoBackgroundFadeIn()
end
end
function InstantFadeIn()
DoBackgroundFadeIn(0)
DoTextFadeIn(0)
end
function InstantFadeOut()
DoBackgroundFadeOut(0)
DoTextFadeOut(0)
end
local mouseIsInWindow = nil
function UpdateFadingForMouseState(mouseState)
mouseIsInWindow = mouseState
mouseStateChanged:Fire()
if (ChatBar:IsFocused()) then return end
if (mouseState) then
DoBackgroundFadeIn()
DoTextFadeIn()
else
DoBackgroundFadeIn()
end
end
spawn(function()
while true do
RunService.RenderStepped:wait()
while (mouseIsInWindow or ChatBar:IsFocused()) do
if (mouseIsInWindow) then
mouseStateChanged.Event:wait()
end
if (ChatBar:IsFocused()) then
chatBarFocusChanged.Event:wait()
end
end
if (not backgroundIsFaded) then
local timeDiff = tick() - lastBackgroundFadeTime
if (timeDiff > ChatSettings.ChatWindowBackgroundFadeOutTime) then
DoBackgroundFadeOut()
end
elseif (not textIsFaded) then
local timeDiff = tick() - lastTextFadeTime
if (timeDiff > ChatSettings.ChatWindowTextFadeOutTime) then
DoTextFadeOut()
end
else
fadedChanged.Event:wait()
end
end
end)
function getClassicChatEnabled()
if ChatSettings.ClassicChatEnabled ~= nil then
return ChatSettings.ClassicChatEnabled
end
return Players.ClassicChat
end
function getBubbleChatEnabled()
if ChatSettings.BubbleChatEnabled ~= nil then
return ChatSettings.BubbleChatEnabled
end
return Players.BubbleChat
end
function bubbleChatOnly()
return not getClassicChatEnabled() and getBubbleChatEnabled()
end
function UpdateMousePosition(mousePos)
if not (moduleApiTable.Visible and moduleApiTable.IsCoreGuiEnabled and (moduleApiTable.TopbarEnabled or ChatSettings.ChatOnWithTopBarOff)) then return end
if bubbleChatOnly() then
return
end
local windowPos = ChatWindow.GuiObject.AbsolutePosition
local windowSize = ChatWindow.GuiObject.AbsoluteSize
local newMouseState = CheckIfPointIsInSquare(mousePos, windowPos, windowPos + windowSize)
if (newMouseState ~= mouseIsInWindow) then
UpdateFadingForMouseState(newMouseState)
end
end
UserInputService.InputChanged:connect(function(inputObject)
if (inputObject.UserInputType == Enum.UserInputType.MouseMovement) then
local mousePos = Vector2.new(inputObject.Position.X, inputObject.Position.Y)
UpdateMousePosition(mousePos)
end
end)
UserInputService.TouchTap:connect(function(tapPos, gameProcessedEvent)
UpdateMousePosition(tapPos[1])
end)
UserInputService.TouchMoved:connect(function(inputObject, gameProcessedEvent)
local tapPos = Vector2.new(inputObject.Position.X, inputObject.Position.Y)
UpdateMousePosition(tapPos)
end)
UserInputService.Changed:connect(function(prop)
if prop == "MouseBehavior" then
if UserInputService.MouseBehavior == Enum.MouseBehavior.LockCenter then
local windowPos = ChatWindow.GuiObject.AbsolutePosition
local windowSize = ChatWindow.GuiObject.AbsoluteSize
local screenSize = GuiParent.AbsoluteSize
local centerScreenIsInWindow = CheckIfPointIsInSquare(screenSize/2, windowPos, windowPos + windowSize)
if centerScreenIsInWindow then
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end
end
end)
|
--print("player is closer than structure") |
target = nearestPlayer
targetType = nearestPlayer.ClassName
lastLock = tick()
else
target = nearestBuilding
targetType = nearestBuilding.ClassName
lastLock = tick() |
--[[Controls]] |
local _CTRL = _Tune.Controls
local Controls = Instance.new("Folder",script.Parent)
Controls.Name = "Controls"
for i,v in pairs(_CTRL) do
local a=Instance.new("StringValue",Controls)
a.Name=i
a.Value=v.Name
a.Changed:connect(function()
if i=="MouseThrottle" or i=="MouseBrake" then
if a.Value == "MouseButton1" or a.Value == "MouseButton2" then
_CTRL[i]=Enum.UserInputType[a.Value]
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
end)
end
--Deadzone Adjust
local _PPH = _Tune.Peripherals
for i,v in pairs(_PPH) do
local a = Instance.new("IntValue",Controls)
a.Name = i
a.Value = v
a.Changed:connect(function()
a.Value=math.min(100,math.max(0,a.Value))
_PPH[i] = a.Value
end)
end
--Input Handler
function DealWithInput(input,IsRobloxFunction)
if (UserInputService:GetFocusedTextBox()==nil) and not _InControls then --Ignore when UI Focus
--Shift Down [Manual Transmission]
if _IsOn and (input.KeyCode ==_CTRL["ContlrShiftDown"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftDown"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftDown"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
_CGear = math.max(_CGear-1,-1)
--Shift Up [Manual Transmission]
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrShiftUp"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftUp"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftUp"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
_CGear = math.min(_CGear+1,#_Tune.Ratios-2)
--Toggle Clutch
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrClutch"] or (_MSteer and input.KeyCode==_CTRL["MouseClutch"]) or ((not _MSteer) and input.KeyCode==_CTRL["Clutch"])) and _TMode=="Manual" then
if input.UserInputState == Enum.UserInputState.Begin then
_ClutchOn = false
_ClPressing = true
elseif input.UserInputState == Enum.UserInputState.End then
_ClutchOn = true
_ClPressing = false
end
--Toggle PBrake
elseif _IsOn and input.KeyCode ==_CTRL["ContlrPBrake"] or (_MSteer and input.KeyCode==_CTRL["MousePBrake"]) or ((not _MSteer) and input.KeyCode==_CTRL["PBrake"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_PBrake = not _PBrake
elseif input.UserInputState == Enum.UserInputState.End then
if car.DriveSeat.Velocity.Magnitude>5 then
_PBrake = false
end
end
--Toggle Transmission Mode
elseif (input.KeyCode == _CTRL["ContlrToggleTMode"] or input.KeyCode==_CTRL["ToggleTransMode"]) and input.UserInputState == Enum.UserInputState.Begin then
local n=1
for i,v in pairs(_Tune.TransModes) do
if v==_TMode then n=i break end
end
n=n+1
if n>#_Tune.TransModes then n=1 end
_TMode = _Tune.TransModes[n]
--Throttle
elseif _IsOn and ((not _MSteer) and (input.KeyCode==_CTRL["Throttle"] or input.KeyCode == _CTRL["Throttle2"])) or ((((_CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseThrottle"]) or input.KeyCode == _CTRL["MouseThrottle"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GThrot = 1
else
_GThrot = _Tune.IdleThrottle/100
end
--Brake
elseif ((not _MSteer) and (input.KeyCode==_CTRL["Brake"] or input.KeyCode == _CTRL["Brake2"])) or ((((_CTRL["MouseBrake"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseBrake"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseBrake"]) or input.KeyCode == _CTRL["MouseBrake"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
print(FBrakeForce + RBrakeForce.. " Brake")
_GBrake = 1
else
_GBrake = 0
end
--Steer Left
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerLeft"] or input.KeyCode == _CTRL["SteerLeft2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = -1
_SteerL = true
else
if _SteerR then
_GSteerT = 1
else
_GSteerT = 0
end
_SteerL = false
end
--Steer Right
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerRight"] or input.KeyCode == _CTRL["SteerRight2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = 1
_SteerR = true
else
if _SteerL then
_GSteerT = -1
else
_GSteerT = 0
end
_SteerR = false
end
--Toggle Mouse Controls
elseif input.KeyCode ==_CTRL["ToggleMouseDrive"] then
if input.UserInputState == Enum.UserInputState.End then
_MSteer = not _MSteer
_GThrot = _Tune.IdleThrottle/100
_GBrake = 0
_GSteerT = 0
_ClutchOn = true
end
--Toggle TCS
elseif _Tune.TCSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleTCS"] or input.KeyCode == _CTRL["ContlrToggleTCS"] then
if input.UserInputState == Enum.UserInputState.End then
if script.Parent.DriveMode.Value ~= "SportPlus" then
_TCS = not _TCS
end
end
--Toggle ABS
elseif _Tune. ABSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleABS"] or input.KeyCode == _CTRL["ContlrToggleABS"] then
if input.UserInputState == Enum.UserInputState.End then
_ABS = not _ABS
end
end
--Variable Controls
if input.UserInputType.Name:find("Gamepad") then
--Gamepad Steering
if input.KeyCode == _CTRL["ContlrSteer"] then
if input.Position.X>= 0 then
local cDZone = math.min(.99,_Tune.Peripherals.ControlRDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X-cDZone)/(1-cDZone)
else
_GSteerT = 0
end
else
local cDZone = math.min(.99,_Tune.Peripherals.ControlLDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X+cDZone)/(1-cDZone)
else
_GSteerT = 0
end
end
--Gamepad Throttle
elseif _IsOn and input.KeyCode == _CTRL["ContlrThrottle"] then
_GThrot = math.max(_Tune.IdleThrottle/100,input.Position.Z)
--Gamepad Brake
elseif input.KeyCode == _CTRL["ContlrBrake"] then
_GBrake = input.Position.Z
end
end
else
_GThrot = _Tune.IdleThrottle/100
_GSteerT = 0
_GBrake = 0
if _CGear~=0 then _ClutchOn = true end
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)
UserInputService.InputEnded:connect(DealWithInput)
|
--[[ lua Function Cache ]] | --
local ATAN2 = math.atan2
local FLOOR = math.floor
local PI = math.pi
|
--edit the below function to execute code when this response is chosen OR this prompt is shown
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data |
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
plrData.Money.Gold.Value = plrData.Money.Gold.Value - 12
plrData.Character.Injuries.BrokenLeg.Value = false
end
|
--[[**
ensures Lua primitive callback type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]] |
t.callback = t.typeof("function")
t["function"] = t.callback
|
--[[
ROBLOX TODO: add default generic param when possible
original code:
export const getMatchers = <
State extends MatcherState = MatcherState,
>(): MatchersObject<State> => (global as any)[JEST_MATCHERS_OBJECT].matchers;
]] |
local function getMatchers<State>(): MatchersObject<State>
return _G[JEST_MATCHERS_OBJECT].matchers
end
|
--[=[
@param predicate (player: Player, value: any) -> boolean
@param value any -- Value to set for the clients (and to the predicate)
Sets the value for specific clients that pass the `predicate`
function test. This can be used to finely set the values
based on more control logic (e.g. setting certain values
per team).
```lua
-- Set the value of "NewValue" to players with a name longer than 10 characters:
remoteProperty:SetFilter(function(player)
return #player.Name > 10
end, "NewValue")
```
]=] |
function RemoteProperty:SetFilter(predicate: (Player, any) -> boolean, value: any)
for _,player in ipairs(Players:GetPlayers()) do
if predicate(player, value) then
self:SetFor(player, value)
end
end
end
|
------------------------------------ |
function onTouched(part)
if part.Parent ~= nil then
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
local teleportfrom=script.Parent.Enabled.Value
if teleportfrom~=0 then
if h==humanoid then
return
end
local teleportto=script.Parent.Parent:findFirstChild(modelname)
if teleportto~=nil then
local torso = h.Parent.Torso
local location = {teleportto.Position}
local i = 1
local x = location[i].x
local y = location[i].y
local z = location[i].z
x = x + math.random(-1, 1)
z = z + math.random(-1, 1)
y = y + math.random(2, 3)
local cf = torso.CFrame
local lx = 0
local ly = y
local lz = 0
script.Parent.Enabled.Value=0
teleportto.Enabled.Value=0
torso.CFrame = CFrame.new(Vector3.new(x,y,z), Vector3.new(lx,ly,lz))
wait(.1)
script.Parent.Enabled.Value=1
teleportto.Enabled.Value=1
else
print("Could not find teleporter!")
end
end
end
end
end
script.Parent.Touched:connect(onTouched)
|
-------------------------------------Gun info |
ToolName="M4"
ClipSize=999999999999999999999999999999999999999999999999999999999999999999
ReloadTime=6
Firerate=.12
MinSpread=.1
MaxSpread=.1
SpreadRate=9
BaseDamage=22.5
automatic=true
burst=false
shot=false --Semi Automatic
BarrlePos=Vector3.new(0.38,0.4,-3.4)
Cursors={"http://www.roblox.com/asset/?id=52812029"}
ReloadCursor="http://www.roblox.com/asset/?id=52812038" |
-- This file was @generated by Tarmac. It is not intended for manual editing. |
return {
Calendar = "rbxassetid://8915045287",
Caret = "rbxassetid://8915045496",
ChevronLeft = "rbxassetid://8982072482",
Close = "rbxassetid://8915045615",
Clothing = "rbxassetid://8915045766",
EmptyShop = "rbxassetid://9246449575",
Eye = "rbxassetid://8915045943",
Filter = "rbxassetid://8981626915",
Gamepad = {
ButtonA = "rbxassetid://8712691282",
ButtonB = "rbxassetid://8712691429",
ButtonL1 = "rbxassetid://8712691596",
ButtonL2 = "rbxassetid://8712691753",
ButtonR1 = "rbxassetid://8712691861",
ButtonR2 = "rbxassetid://8712691936",
ButtonX = "rbxassetid://8712692030",
ButtonY = "rbxassetid://8712692150",
DPadDown = "rbxassetid://8712692266",
DPadLeft = "rbxassetid://8712692372",
DPadRight = "rbxassetid://8712692480",
DPadUp = "rbxassetid://8712692563",
},
Info = "rbxassetid://8915046089",
KeyBacking = "rbxassetid://9186036717",
RadioButtonInner = "rbxassetid://8971710558",
RadioButtonOuter = "rbxassetid://8971710724",
Robux = "rbxassetid://8915046254",
Rotation = "rbxassetid://8915046440",
ShoppingCart = "rbxassetid://9133862231",
Sparkle = "rbxassetid://8915046721",
Timer = "rbxassetid://8915046889",
}
|
--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 Dematerialize(character, humanoid, FirstPart)
if not character or not humanoid then
return
end
humanoid.WalkSpeed = 0
local Parts = {}
for i, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
v.Anchored = true
table.insert(Parts, v)
end
end
local SelectionBoxes = {}
local FirstSelectionBox = SelectionBoxify(FirstPart)
Light(FirstPart)
wait(0.05)
for i, v in pairs(Parts) do
if v ~= FirstPart then
table.insert(SelectionBoxes, SelectionBoxify(v))
Light(v)
end
end
local ObjectsWithTransparency = GetTransparentsRecursive(character)
FadeOutObjects(ObjectsWithTransparency, 0.1)
wait(0.5)
character:BreakJoints()
humanoid.Health = 0
Debris:AddItem(character, 2)
local FadeIncrement = 0.05
Delay(0.2, function()
FadeOutObjects({FirstSelectionBox}, FadeIncrement)
if character and character.Parent then
character:Destroy()
end
end)
FadeOutObjects(SelectionBoxes, FadeIncrement)
end
function Touched(Projectile, Hit)
if not Hit or not Hit.Parent then
return
end
local character, humanoid = FindCharacterAncestor(Hit)
if character and humanoid and character ~= Character then
Hit:BreakJoints()
local ForceFieldExists = false
for i, v in pairs(character:GetChildren()) do
if v:IsA("ForceField") then
ForceFieldExists = true
end
end
if not ForceFieldExists then
if Projectile then
local HitFadeSound = Projectile:FindFirstChild(Sounds.HitFade.Name)
local torso = humanoid.Torso
if HitFadeSound and torso then
HitFadeSound.Parent = torso
HitFadeSound:Play()
end
end
end
if Projectile and Projectile.Parent then
Projectile:Destroy()
end
end
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
if not Player or not Humanoid or Humanoid.Health == 0 then
return
end
end
function Activated(target)
if Tool.Enabled and Humanoid.Health > 0 then
Tool.Enabled = false
InvokeClient("PlaySound", Sounds.Fire)
local HandleCFrame = Handle.CFrame
local FiringPoint = HandleCFrame.p + HandleCFrame:vectorToWorldSpace(NozzleOffset)
local ShotCFrame = CFrame.new(FiringPoint, target)
local LaserShotClone = BaseShot:Clone()
LaserShotClone.CFrame = ShotCFrame + (ShotCFrame.lookVector * (BaseShot.Size.Z / 2))
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.velocity = ShotCFrame.lookVector * 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.Shape = Enum.PartType.Block
BaseShot.TopSurface = Enum.SurfaceType.Smooth
BaseShot.BottomSurface = Enum.SurfaceType.Smooth
BaseShot.FormFactor = Enum.FormFactor.Custom
BaseShot.Size = Vector3.new(0.1, 0.1, 2)
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)
|
--[=[
@function removeValues
@within Array
@param array {T} -- The array to remove values from.
@param ... T -- The values to remove.
@return {T} -- The array with the values removed.
Removes values from an array.
```lua
local array = { "a", "b", "c", "c", "d", "e" }
local new = RemoveValues(array, "c", "d") -- { "a", "b", "e" }
```
]=] |
local function removeValues<T>(array: { T }, ...: T): { T }
local valueSet = ToSet({ ... })
local result = {}
for _, value in ipairs(array) do
if not valueSet[value] then
table.insert(result, value)
end
end
return result
end
return removeValues
|
-- Functions |
local function __tostring(self)
return self.ClassName
end
local function createClass(className, superClass)
local class = {}
class.__index = class
class.__tostring = __tostring
class.ClassName = className
function class.new(...)
local self = setmetatable({}, class)
if self.__init then
self:__init(...)
end
return self
end
if superClass then
class.Super = superClass
setmetatable(class, superClass)
for methodName, shouldInherit in pairs(INHERITED) do
if shouldInherit then
class[methodName] = superClass[methodName]
end
end
end
return class
end
|
--[=[
@param signal RBXScriptSignal
@param fn (...: any) -> ()
@return RBXScriptConnection
Connects the function to the signal, adds the connection
to the trove, and then returns the connection.
This is shorthand for `trove:Add(signal:Connect(fn))`.
```lua
trove:Connect(workspace.ChildAdded, function(instance)
print(instance.Name .. " added to workspace")
end)
```
]=] |
function Trove:Connect(signal, fn)
return self:Add(signal:Connect(fn))
end
|
--[[Wheel Alignment]] |
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
Tune.FCamber = 1
Tune.RCamber = 1
Tune.FCaster = 0
Tune.RCaster = 0
Tune.FToe = 0
Tune.RToe = 0
|
-------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------- |
local toolAnimName = ""
local toolAnimTrack = nil
local toolAnimInstance = nil
local currentToolAnimKeyframeHandler = nil
function toolKeyFrameReachedFunc(frameName)
if (frameName == "End") then
playToolAnimation(toolAnimName, 0.0, Humanoid)
end
end
function playToolAnimation(animName, transitionTime, humanoid, priority)
local idx = rollAnimation(animName)
local anim = animTable[animName][idx].anim
if (toolAnimInstance ~= anim) then
if (toolAnimTrack ~= nil) then
toolAnimTrack:Stop()
toolAnimTrack:Destroy()
transitionTime = 0
end
-- load it to the humanoid; get AnimationTrack
toolAnimTrack = humanoid:LoadAnimation(anim)
if priority then
toolAnimTrack.Priority = priority
end
-- play the animation
toolAnimTrack:Play(transitionTime)
toolAnimName = animName
toolAnimInstance = anim
currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
end
end
function stopToolAnimations()
local oldAnim = toolAnimName
if (currentToolAnimKeyframeHandler ~= nil) then
currentToolAnimKeyframeHandler:disconnect()
end
toolAnimName = ""
toolAnimInstance = nil
if (toolAnimTrack ~= nil) then
toolAnimTrack:Stop()
toolAnimTrack:Destroy()
toolAnimTrack = nil
end
return oldAnim
end
|
-- Gradually regenerates the Kars' Health over time. |
local REGEN_RATE = 1/70 -- Regenerate this fraction of MaxHealth per second.
local REGEN_STEP = 0.5 -- Wait this long between each regeneration step.
|
--// WIP |
local function LoadPackage(package, folder, runNow)
--// runNow - Run immediately after unpacking (default behavior is to just unpack (((only needed if loading after startup))))
--// runNow currently not used (limitations) so all packages must be present at server startup
local unpack; unpack = function(curFolder, unpackInto)
if unpackInto then
for i,obj in ipairs(curFolder:GetChildren()) do
local clone = obj:Clone();
if obj:IsA("Folder") then
local realFolder = unpackInto:FindFirstChild(obj.Name);
if not realFolder then
clone.Parent = unpackInto;
else
unpack(obj, realFolder);
end
else
clone.Parent = unpackInto;
end
end
else
warn("Missing parent to unpack into for ".. tostring(curFolder));
end
end;
unpack(package, folder);
end;
local function CleanUp()
--local env = getfenv(2)
--local ran,ret = pcall(function() return env.script:GetFullName() end)
warn("Beginning Adonis cleanup & shutdown process...")
--warn("CleanUp called from "..tostring((ran and ret) or "Unknown"))
--local loader = server.Core.ClientLoader
server.Model.Name = "Adonis_Loader"
server.Model.Parent = service.ServerScriptService
server.Running = false
pcall(service.Threads.StopAll)
pcall(function()
for i,v in pairs(RbxEvents) do
print("Disconnecting event")
v:Disconnect()
table.remove(RbxEvents, i)
end
end)
--loader.Archivable = false
--loader.Disabled = true
--loader:Destroy()
if server.Core and server.Core.RemoteEvent then
pcall(server.Core.DisconnectEvent);
end
--[[delay(0, function()
for i,v in next,server do
server[i] = nil; --// Try to break it to prevent any potential hanging issues; Not very graceful...
end
--end)--]]
warn("Unloading complete")
end;
server = {
Running = true;
Modules = {};
Pcall = Pcall;
cPcall = cPcall;
Routine = Routine;
LogError = logError;
ErrorLogs = ErrorLogs;
ServerStartTime = os.time();
CommandCache = {};
};
locals = {
server = server;
CodeName = "";
Settings = server.Settings;
HookedEvents = HookedEvents;
ErrorLogs = ErrorLogs;
logError = logError;
origEnv = origEnv;
Routine = Routine;
Folder = Folder;
GetEnv = GetEnv;
cPcall = cPcall;
Pcall = Pcall;
};
service = require(Folder.Shared.Service)(function(eType, msg, desc, ...)
local extra = {...}
if eType == "MethodError" then
if server and server.Logs and server.Logs.AddLog then
server.Logs.AddLog("Script", {
Text = "Cached method doesn't match found method: "..tostring(extra[1]);
Desc = "Method: "..tostring(extra[1])
})
end
elseif eType == "ServerError" then
--print("Server error")
logError("Server", msg)
elseif eType == "TaskError" then
--print("Task error")
logError("Task", msg)
end
end, function(c, parent, tab)
if not isModule(c) and c ~= server.Loader and c ~= server.Dropper and c ~= server.Runner and c ~= server.Model and c ~= script and c ~= Folder and parent == nil then
tab.UnHook()
end
end, ServiceSpecific, GetEnv(nil, {server = server}))
|
-- Returns the ancestor that contains a Humanoid, if it exists |
local function FindCharacterAncestor(subject)
if subject and subject ~= game.Workspace then
local humanoid = subject:FindFirstChild('Humanoid')
if humanoid then
return subject, humanoid
else
return FindCharacterAncestor(subject.Parent)
end
end
return nil
end
|
--[[Member functions]] |
function GunObject:Initialize()
self.Fire=WaitForChild(self.Handle, 'Fire')
self.Ammo = self.Tool:FindFirstChild("Ammo")
if self.Ammo ~= nil then
self.Ammo.Value = self.ClipSize
end
self.Clips = self.Tool:FindFirstChild("Clips")
if self.Clips ~= nil then
self.Clips.Value = self.StartingClips
end
self.Tool.Equipped:connect(function()
self.Tool.Handle.Fire:Stop()
self.Tool.Handle.Reload:Stop()
end)
self.Tool.Unequipped:connect(function()
self.Tool.Handle.Fire:Stop()
self.Tool.Handle.Reload:Stop()
end)
self.LaserObj = Instance.new("Part")
self.LaserObj.Name = "Bullet"
self.LaserObj.Anchored = true
self.LaserObj.CanCollide = false
self.LaserObj.Shape = "Block"
self.LaserObj.formFactor = "Custom"
self.LaserObj.Material = Enum.Material.Plastic
self.LaserObj.Locked = true
self.LaserObj.TopSurface = 0
self.LaserObj.BottomSurface = 0
--local tshellmesh=WaitForChild(script.Parent,'BulletMesh'):Clone()
--tshellmesh.Scale=Vector3.new(4,4,4)
--tshellmesh.Parent=self.LaserObj
local tSparkEffect = Instance.new("Part")
tSparkEffect.Name = "Effect"
tSparkEffect.Anchored = false
tSparkEffect.CanCollide = false
tSparkEffect.Shape = "Block"
tSparkEffect.formFactor = "Custom"
tSparkEffect.Material = Enum.Material.Plastic
tSparkEffect.Locked = true
tSparkEffect.TopSurface = 0
tSparkEffect.BottomSurface = 0
self.SparkEffect=tSparkEffect
local tshell = Instance.new('Part')
tshell.Name='effect'
tshell.FormFactor='Custom'
tshell.Size=Vector3.new(1, 0.4, 0.33)
tshell.BrickColor=BrickColor.new('Bright yellow')
tshellmesh=WaitForChild(script.Parent,'BulletMesh'):Clone()
tshellmesh.Parent=tshell
self.ShellPart = tshell
self.DownVal.Changed:connect(function()
while self.DownVal.Value and self.check and not self.Reloading do
self.check = false
local humanoid = self.Tool.Parent:FindFirstChild("Humanoid")
local plr1 = game.Players:GetPlayerFromCharacter(self.Tool.Parent)
if humanoid ~= nil and plr1 ~= nil then
if humanoid.Health > 0 then
local spos1 = (self.Tool.Handle.CFrame * self.BarrelPos).p
delay(0, function() self:SendBullet(spos1, self.AimVal.Value, self.Spread, self.SegmentLength, self.Tool.Parent, self.Colors[1], self.GunDamage, self.FadeDelayTime) end)
else
self.check = true
break
end
else
self.check = true
break
end
wait(self.FireRate)
self.check = true
if not self.Automatic then
break
end
end
end)
self.ReloadingVal.Changed:connect(function() if self.ReloadingVal.Value then self:Reload() end end)
end
function GunObject:Reload()
self.Reloading = true
self.ReloadingVal.Value = true
if self.Clips ~= nil then
if self.Clips.Value > 0 then
self.Clips.Value = Clips.Value - 1
else
self.Reloading = false
self.ReloadingVal.Value = false
return
end
end
self.Tool.Handle.Reload:Play()
for i = 1, self.ClipSize do
wait(self.ReloadTime/self.ClipSize)
self.Ammo.Value = i
end
self.Reloading = false
self.Tool.Reloading.Value = false
end
function GunObject:SpawnShell()
local tshell=self.ShellPart:Clone()
tshell.CFrame=self.Handle.CFrame
tshell.Parent= workspace
game.Debris:AddItem(tshell,2)
end
function KnockOffHats(tchar)
for _,i in pairs(tchar:GetChildren()) do
if i:IsA('Hat') then
i.Parent=game.Workspace
end
end
end
function KnockOffTool(tchar)
for _,i in pairs(tchar:GetChildren()) do
if i:IsA('Tool') then
i.Parent=game.Workspace
end
end
end
function GunObject:SendBullet(boltstart, targetpos, fuzzyness, SegmentLength, ignore, clr, damage, fadedelay)
if self.Ammo.Value <=0 then return end
self.Ammo.Value = self.Ammo.Value - 1
self:SpawnShell()
self.Fire.Pitch = (math.random() * .5) + .75
self.Fire:Play()
self.DoFireAni.Value = not self.DoFireAni.Value
print(self.Fire.Pitch)
local boltdist = self.Range
local clickdist = (boltstart - targetpos).magnitude
local targetpos = targetpos + (Vector3.new(math.random() - .5, math.random() - .5, math.random() - .5) * (clickdist/100))
local boltvec = (targetpos - boltstart).unit
local totalsegments = math.ceil(boltdist/SegmentLength)
local lastpos = boltstart
for i = 1, totalsegments do
local newpos = (boltstart + (boltvec * (boltdist * (i/totalsegments))))
local segvec = (newpos - lastpos).unit
local boltlength = (newpos - lastpos).magnitude
local bolthit, endpos = CastRay(lastpos, segvec, boltlength, ignore, false)
DrawBeam(lastpos, endpos, clr, fadedelay, self.LaserObj)
if bolthit ~= nil then
local h = bolthit.Parent:FindFirstChild("Humanoid")
if h ~= nil then
local plr = game.Players:GetPlayerFromCharacter(self.Tool.Parent)
if plr ~= nil then
local creator = Instance.new("ObjectValue")
creator.Name = "creator"
creator.Value = plr
creator.Parent = h
end
if hit.Parent:FindFirstChild("BlockShot") then
hit.Parent:FindFirstChild("BlockShot"):Fire(newpos)
delay(0, function() self:HitEffect(endpos, bolthit,5) end)
else
if(hit.Name=='Head') then
KnockOffHats(hit.Parent)
elseif hit.Name=='Left Leg' or hit.Name=='Right Leg' then
h.WalkSpeed=h.WalkSpeed/1.5
elseif hit.Name=='Left Arm' or hit.Name=='Right Arm' then
KnockOffTool(hit.Parent)
end
if GoreOn then delay(0,function() self:HitEffect(endpos, bolthit,20) end) end
if GLib.IsTeammate(GLib.GetPlayerFromPart(script), GLib.GetPlayerFromPart(h))~=true then
GLib.TagHumanoid(GLib.GetPlayerFromPart(script), h, 1)
h:TakeDamage(damage)
end
end
else
delay(0, function() self:HitEffect(endpos, bolthit,5) end)
end
break
end
lastpos = endpos
wait(Rate)
end
if self.Ammo.Value < 1 then
self:Reload()
end
end
function GunObject:MakeSpark(pos,part)
local effect=self.SparkEffect:Clone()
effect.BrickColor = part.BrickColor
effect.Material = part.Material
effect.Transparency = part.Transparency
effect.Reflectance = part.Reflectance
effect.CFrame = CFrame.new(pos)
effect.Parent = game.Workspace
local effectVel = Instance.new("BodyVelocity")
effectVel.maxForce = Vector3.new(99999, 99999, 99999)
effectVel.velocity = Vector3.new(math.random() * 15 * SigNum(math.random( - 10, 10)), math.random() * 15 * SigNum(math.random( - 10, 10)), math.random() * 15 * SigNum(math.random( - 10, 10)))
effectVel.Parent = effect
effect.Size = Vector3.new(math.abs(effectVel.velocity.x)/30, math.abs(effectVel.velocity.y)/30, math.abs(effectVel.velocity.z)/30)
wait()
effectVel:Destroy()
local effecttime = .5
game.Debris:AddItem(effect, effecttime * 2)
local startTime = time()
while time() - startTime < effecttime do
if effect ~= nil then
effect.Transparency = (time() - startTime)/effecttime
end
wait()
end
if effect ~= nil then
effect.Parent = nil
end
end
function GunObject:HitEffect(pos,part,numSparks)
for i = 0, numSparks, 1 do
spawn(function() self:MakeSpark(pos,part) end)
end
end
|
--[[Weld functions]] |
local JS = game:GetService("JointsService")
local PGS_ON = workspace:PGSIsEnabled()
function MakeWeld(x,y,type,s)
if type==nil then type="Weld" end
local W=Instance.new(type,JS)
W.Part0=x W.Part1=y
W.C0=x.CFrame:inverse()*x.CFrame
W.C1=y.CFrame:inverse()*x.CFrame
if type=="Motor" and s~=nil then
W.MaxVelocity=s
end
return W
end
function ModelWeld(a,b)
if a:IsA("BasePart") then
MakeWeld(b,a,"Weld")
elseif a:IsA("Model") then
for i,v in pairs(a:GetChildren()) do
ModelWeld(v,b)
end
end
end
function UnAnchor(a)
if a:IsA("BasePart") then a.Anchored=false end for _,v in ipairs(a:GetChildren()) do UnAnchor(v) end
end
|
-- functions |
function stopAllAnimations()
local oldAnim = currentAnim
-- return to idle if finishing an emote
if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
oldAnim = "idle"
end
currentAnim = ""
currentAnimInstance = nil
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop()
currentAnimTrack:Destroy()
currentAnimTrack = nil
end
-- clean up walk if there is one
if (runAnimKeyframeHandler ~= nil) then
runAnimKeyframeHandler:disconnect()
end
if (runAnimTrack ~= nil) then
runAnimTrack:Stop()
runAnimTrack:Destroy()
runAnimTrack = nil
end
return oldAnim
end
local smallButNotZero = 0.0001
function setRunSpeed(speed)
if speed < 0.33 then
currentAnimTrack:AdjustWeight(1.0)
runAnimTrack:AdjustWeight(smallButNotZero)
elseif speed < 0.66 then
local weight = ((speed - 0.33) / 0.33)
currentAnimTrack:AdjustWeight(1.0 - weight + smallButNotZero)
runAnimTrack:AdjustWeight(weight + smallButNotZero)
else
currentAnimTrack:AdjustWeight(smallButNotZero)
runAnimTrack:AdjustWeight(1.0)
end
local speedScaled = speed * 1.25
runAnimTrack:AdjustSpeed(speedScaled)
currentAnimTrack:AdjustSpeed(speedScaled)
end
function setAnimationSpeed(speed)
if speed ~= currentAnimSpeed then
currentAnimSpeed = speed
if currentAnim == "walk" then
setRunSpeed(speed)
else
currentAnimTrack:AdjustSpeed(currentAnimSpeed)
end
end
end
function keyFrameReachedFunc(frameName) |
-- // Triggers |
button.MouseButton1Click:Connect(toggleButton)
frame.MouseButton1Click:Connect(toggleButton)
|
--[[
Create a copy of a list with only values for which `callback` returns true
]] |
function Functional.Filter(list, callback)
local new = {}
for key = 1, #list do
local value = list[key]
if callback(value, key) then
table.insert(new, value)
end
end
return new
end
|
--[[ Roblox Services ]] | --
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local StarterGui = game:GetService("StarterGui")
local VRService = game:GetService("VRService")
local UserGameSettings = UserSettings():GetService("UserGameSettings")
local player = Players.LocalPlayer
|
-- Keep a container for state data |
Tools.NewPart.State = {
["Part"] = nil;
};
|
-- declarations |
local sGettingUp = newSound("GettingUp", "rbxasset://sounds/action_get_up.mp3")
local sDied = newSound("Died", "rbxasset://sounds/uuhhh.mp3")
local sFreeFalling = newSound("FreeFalling", "rbxasset://sounds/action_falling.mp3")
local sJumping = newSound("Jumping", "rbxasset://sounds/action_jump.mp3")
local sLanding = newSound("Landing", "rbxasset://sounds/action_jump_land.mp3")
local sSplash = newSound("Splash", "rbxasset://sounds/impact_water.mp3")
local sRunning = newSound("Running", "rbxasset://sounds/action_footsteps_plastic.mp3")
sRunning.Looped = true
local sSwimming = newSound("Swimming", "rbxasset://sounds/action_swim.mp3")
sSwimming.Looped = true
local sClimbing = newSound("Climbing", "rbxasset://sounds/action_footsteps_plastic.mp3")
sClimbing.Looped = true
local Figure = script.Parent
local Head = waitForChild(Figure, "Head")
local Humanoid;
for _,Child in pairs(Figure:GetChildren())do
if Child and Child.ClassName=="Humanoid"then
Humanoid=Child;
end;
end;
local hasPlayer = game.Players:GetPlayerFromCharacter(script.Parent)
local prevState = "None"
|
--[[
Implementation
]] |
local function isAlive()
return maid.humanoid.Health > 0 and maid.humanoid:GetState() ~= Enum.HumanoidStateType.Dead
end
local function destroy()
maid:destroy()
end
local function patrol()
while isAlive() do
if not attacking then
local position = getRandomPointInCircle(startPosition, PATROL_RADIUS)
maid.humanoid.WalkSpeed = PATROL_WALKSPEED
maid.humanoid:MoveTo(position)
end
wait(random:NextInteger(MIN_REPOSITION_TIME, MAX_REPOSITION_TIME))
end
end
local function isInstaceAttackable(targetInstance)
local targetHumanoid = targetInstance and targetInstance.Parent and targetInstance.Parent:FindFirstChild("Humanoid")
if not targetHumanoid then
return false
end
local isAttackable = false
local distance = (maid.humanoidRootPart.Position - targetInstance.Position).Magnitude
if distance <= ATTACK_RADIUS then
local ray = Ray.new(
maid.humanoidRootPart.Position,
(targetInstance.Parent.HumanoidRootPart.Position - maid.humanoidRootPart.Position).Unit * distance
)
local part = Workspace:FindPartOnRayWithIgnoreList(ray, {
targetInstance.Parent, maid.instance,
}, false, true)
if
targetInstance ~= maid.instance and
targetInstance:IsDescendantOf(Workspace) and
targetHumanoid.Health > 0 and
targetHumanoid:GetState() ~= Enum.HumanoidStateType.Dead and
not CollectionService:HasTag(targetInstance.Parent, "ZombieFriend") and
not part
then
isAttackable = true
end
end
return isAttackable
end
local function findTargets()
-- Do a new search region if we are not already searching through an existing search region
if not searchingForTargets and tick() - timeSearchEnded >= SEARCH_DELAY then
searchingForTargets = true
-- Create a new region
local centerPosition = maid.humanoidRootPart.Position
local topCornerPosition = centerPosition + Vector3.new(ATTACK_RADIUS, ATTACK_RADIUS, ATTACK_RADIUS)
local bottomCornerPosition = centerPosition + Vector3.new(-ATTACK_RADIUS, -ATTACK_RADIUS, -ATTACK_RADIUS)
searchRegion = Region3.new(bottomCornerPosition, topCornerPosition)
searchParts = Workspace:FindPartsInRegion3(searchRegion, maid.instance, math.huge)
newTarget = nil
newTargetDistance = nil
-- Reset to defaults
searchIndex = 1
end
if searchingForTargets then
-- Search through our list of parts and find attackable humanoids
local checkedParts = 0
while searchingForTargets and searchIndex <= #searchParts and checkedParts < MAX_PARTS_PER_HEARTBEAT do
local currentPart = searchParts[searchIndex]
if currentPart and isInstaceAttackable(currentPart) then
local character = currentPart.Parent
local distance = (character.HumanoidRootPart.Position - maid.humanoidRootPart.Position).magnitude
-- Determine if the charater is the closest
if not newTargetDistance or distance < newTargetDistance then
newTarget = character.HumanoidRootPart
newTargetDistance = distance
end
end
searchIndex = searchIndex + 1
checkedParts = checkedParts + 1
end
if searchIndex >= #searchParts then
target = newTarget
searchingForTargets = false
timeSearchEnded = tick()
end
end
end
local function runToTarget()
local targetPosition = (maid.humanoidRootPart.Position - target.Position).Unit * ATTACK_RANGE + target.Position
maid.humanoid:MoveTo(targetPosition)
if not movingToAttack then
maid.humanoid.WalkSpeed = random:NextInteger(ATTACK_MIN_WALKSPEED, ATTACK_MAX_WALKSPEED)
end
movingToAttack = true
-- Stop the attack animation
maid.attackAnimation:Stop()
end
local function attack()
attacking = true
lastAttackTime = tick()
local originalWalkSpeed = maid.humanoid.WalkSpeed
maid.humanoid.WalkSpeed = 0
-- Play the attack animation
maid.attackAnimation:Play()
-- Create a part and use it as a collider, to find humanoids in front of the zombie
-- This is not ideal, but it is the simplest way to achieve a hitbox
local hitPart = Instance.new("Part")
hitPart.Size = HITBOX_SIZE
hitPart.Transparency = 1
hitPart.CanCollide = true
hitPart.Anchored = true
hitPart.CFrame = maid.humanoidRootPart.CFrame * CFrame.new(0, -1, -3)
hitPart.Parent = Workspace
local hitTouchingParts = hitPart:GetTouchingParts()
-- Destroy the hitPart before it results in physics updates on touched parts
hitPart:Destroy()
-- Find humanoids to damage
local attackedHumanoids = {}
for _, part in pairs(hitTouchingParts) do
local parentModel = part:FindFirstAncestorOfClass("Model")
if isInstaceAttackable(part) and not attackedHumanoids[parentModel] then
attackedHumanoids[parentModel.Humanoid] = true
end
end
-- Damage the humanoids
for humanoid in pairs(attackedHumanoids) do
humanoid:TakeDamage(ATTACK_DAMAGE)
end
startPosition = maid.instance.PrimaryPart.Position
wait(ATTACK_STAND_TIME)
maid.humanoid.WalkSpeed = originalWalkSpeed
maid.attackAnimation:Stop()
attacking = false
end
|
--[=[
Destroys the RemoteSignal object.
]=] |
function RemoteSignal:Destroy()
self._re:Destroy()
if self._signal then
self._signal:Destroy()
end
end
return RemoteSignal
|
-- Decompiled with the Synapse X Luau decompiler. |
local l__LocalPlayer__1 = game.Players.LocalPlayer;
local l__Character__2 = l__LocalPlayer__1.Character;
local l__Humanoid__3 = l__Character__2:WaitForChild("Humanoid");
local l__PlayerGui__4 = l__LocalPlayer__1.PlayerGui;
local l__Infected__5 = l__Character__2:WaitForChild("Infected");
while true do
wait();
if l__Humanoid__3.Health <= 30 and l__Character__2.Human.Value == true then
script.HP.Volume = 0.6;
script.HP.PlaybackSpeed = 1.1;
elseif l__Humanoid__3.Health <= 45 and l__Character__2.Human.Value == true then
script.HP.Volume = 0.6;
script.HP.PlaybackSpeed = 1;
elseif l__Humanoid__3.Health >= 45 and l__Character__2.Human.Value == true then
script.HP.Volume = 0;
script.HP.PlaybackSpeed = 1;
elseif l__Character__2.Human.Value == false then
script.HP.Volume = 0;
workspace.CurrentCamera.FieldOfView = 70;
l__PlayerGui__4.Hurt:Destroy();
script.HP.PlaybackSpeed = 1;
script:Destroy();
end;
end;
|
--// INITIAL CHECK \\-----------------------------------------------
-- we are checking to see if they've locked first person view |
if (game.StarterPlayer.CameraMode == Enum.CameraMode.LockFirstPerson) or (game.StarterPlayer.CameraMaxZoomDistance <= 0.5) then
enableviewmodel() -- theyve locked first person, so enable viewmodel from the start
end |
--------RIGHT DOOR -------- |
game.Workspace.doorright.l11.BrickColor = BrickColor.new(194)
game.Workspace.doorright.l12.BrickColor = BrickColor.new(194)
game.Workspace.doorright.l13.BrickColor = BrickColor.new(194)
game.Workspace.doorright.l21.BrickColor = BrickColor.new(194)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(194)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(194)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(194)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(194)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(194)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(194)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(194)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(194)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(194)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(194)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(194)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(194)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(194)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(194)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(194)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(194)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(194)
game.Workspace.doorright.pillar.BrickColor = BrickColor.new(194) |
--- RUNTIME --- |
local Tool = {}
Tool.MouseButton1 = function(Character)
if Character:GetAttribute("Cooldown") == true then return end
Character:SetAttribute("Cooldown", true)
local Tool = Character[script.Name]
local Animation = Character.Humanoid:LoadAnimation(script["Animation"..AnimationStep])
AnimationStep += 1
if AnimationStep >= 3 then
AnimationStep = 1
end
Animation:Play()
local OGWalkSpeed = Character.Humanoid.WalkSpeed
Character.Humanoid.WalkSpeed = 0
Tool.Handle.Swing:Play()
task.wait(0.47)
local ConnectionA = nil
Tool.Handle.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= Character and not table.find(HitEntities, Hit.Parent) and Hit.Parent.Parent == workspace.Enemies then
table.insert(HitEntities, Hit.Parent)
Tool.Handle.Hit:Play()
Hit.Parent.Humanoid:TakeDamage(35)
local boopyve = Instance.new("BodyVelocity")
boopyve.Velocity = Character.Torso.CFrame.LookVector * 5
boopyve.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
boopyve.Parent = Hit.Parent.HumanoidRootPart
game.Debris:AddItem(boopyve, .15)
end
end)
task.wait(0.43)
Animation:Stop(.25)
Character.Humanoid.WalkSpeed = OGWalkSpeed
Character:SetAttribute("Cooldown", false)
table.clear(HitEntities)
end
return Tool
|
Subsets and Splits