prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--[[ Roblox Services ]] | --
local UserInputService = game:GetService("UserInputService")
local ContextActionService = game:GetService("ContextActionService")
local PathfindingService = game:GetService("PathfindingService")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local DebrisService = game:GetService('Debris')
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local TweenService = game:GetService("TweenService")
|
--[[
Function to call and retry a given function, up to maxAttempts times.
This function waits pauseConstant + (pauseExponent ^ numAttempts) between retries for progressive exponential backoff.
Calls are made with the functionCallHandler (default: pcall)
and the results of this (in the form of success, errorMessage or ...) are returned.
--]] |
type Function = (...any) -> ...any
export type FunctionHandler = (...any) -> (boolean, ...any)
local function retryAsync(
func: Function,
maxAttempts: number,
optionalPauseConstant: number?,
optionalPauseExponent: number?,
optionalFunctionCallHandler: ((Function) -> (boolean, ...any))?
): (boolean, ...any)
-- Using separate variables to satisfy the type checker
local pauseConstant: number = optionalPauseConstant or 0
local pauseExponent: number = optionalPauseExponent or 0
local functionCallHandler: FunctionHandler = optionalFunctionCallHandler or pcall
local attempts = 0
local success: boolean, result: { any }
while attempts < maxAttempts do
attempts = attempts + 1
local returnValues: { any }
returnValues = { functionCallHandler(func) }
success = table.remove(returnValues, 1) :: boolean
result = returnValues
if success then
break
end
local pauseTime = pauseConstant + (pauseExponent ^ attempts)
if attempts < maxAttempts then
task.wait(pauseTime)
end
end
if success then
return success, table.unpack(result)
else
local errorMessage = not success and result[1] :: any or nil
return success, errorMessage :: any
end
end
return retryAsync
|
--[[Engine]] |
local fFD = _Tune.FinalDrive
local fFDr = fFD*30/math.pi
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)
--Electric Only Setup
if not _Tune.Engine and _Tune.Electric then
_Tune.Redline = _Tune.E_Redline
_Tune.PeakRPM = _Tune.E_Trans2
_Tune.Turbochargers = 0
_Tune.Superchargers = 0
_Tune.Clutch = false
_Tune.IdleRPM = 0
_Tune.AutoShiftType = "DCT"
_Tune.ShiftUpTime = 0.1
_Tune.ShiftDnTime = 0.1
end
--Aspiration Setup
_TCount = _Tune.Turbochargers
_TPsi = _Tune.T_Boost*_Tune.Turbochargers
_SCount = _Tune.Superchargers
_SPsi = _Tune.S_Boost*_Tune.Superchargers
--Engine Curve
local HP_M = _Tune.Horsepower
local HP_T = HP_M*(((_TPsi*(_Tune.T_Efficiency/10))/7.5)/2)
local HP_S = HP_M*(((_SPsi*(_Tune.S_Efficiency/10))/7.5)/2)
local PK_H, PK_T = _Tune.PeakRPM, _Tune.MT_PeakRPM
local MC_H, MC_T = _Tune.MH_CurveMult, _Tune.MT_CurveMult
local TC_H, TC_T = _Tune.TH_CurveMult, _Tune.TT_CurveMult
local SC_H, SC_T = _Tune.SH_CurveMult, _Tune.ST_CurveMult
local MP_H, MP_T = _Tune.MH_PeakSharp, _Tune.MT_PeakSharp
local TP_H, TP_T = _Tune.TH_PeakSharp, _Tune.TT_PeakSharp
local SP_H, SP_T = _Tune.SH_PeakSharp, _Tune.ST_PeakSharp
local V_MT = {HP_M,PK_H,MC_H,MP_H,PK_T,MC_T,MP_T}
local V_TC = {HP_T,PK_H,TC_H,TP_H,PK_T,TC_T,TP_T}
local V_SC = {HP_S,PK_H,SC_H,SP_H,PK_T,SC_T,SP_T}
function getCurve(RPM,HP,Peak,CurveMult,Sharpness)
RPM=RPM/1000
HP=HP/100
Peak=Peak/1000
return ((-(RPM-Peak)^2)*math.min(HP/(Peak^2),CurveMult^(Peak/HP))+HP)*(RPM-((RPM^Sharpness)/(Sharpness*Peak^(Sharpness-1))))
end
function getPeak(V)
local HP,Peak_H,CurveMult_H,Sharpness_H,Peak_T,CurveMult_T,Sharpness_T=V[1]/100,V[2]/1000,V[3],V[4],V[5]/1000,V[6],V[7]
local hp=((-(Peak_H-Peak_H)^2)*math.min(HP/(Peak_H^2),CurveMult_H^(Peak_H/HP))+HP)*(Peak_H-((Peak_H^Sharpness_H)/(Sharpness_H*Peak_H^(Sharpness_H-1))))
local tq=((-(Peak_T-Peak_T)^2)*math.min(HP/(Peak_T^2),CurveMult_T^(Peak_T/HP))+HP)*(Peak_T-((Peak_T^Sharpness_T)/(Sharpness_T*Peak_T^(Sharpness_T-1))))
return hp, tq
end
local PeakHP_N, PeakTQ_N = getPeak(V_MT)
local PeakHP_T, PeakTQ_T = getPeak(V_TC)
local PeakHP_S, PeakTQ_S = getPeak(V_SC)
--Plot Current Horsepower
function EngineCurve(x,gear,V,eq,peakhp,peaktq)
local hp,peak_h,cm_h,sharp_h,peak_t,cm_t,sharp_t=V[1],V[2],V[3],V[4],V[5],V[6],V[7]
local hp_r=(math.max(getCurve(x,hp,peak_h,cm_h,sharp_h)/(peakhp/hp),0))
local tq_r=(math.max(getCurve(x,hp,peak_t,cm_t,sharp_t)/(peaktq/hp),0))
return hp_r,((tq_r*(eq/x))*_Tune.Ratios[gear+1]*fFD*hpScaling)
end
--Electric Curve
local EHP=_Tune.E_Horsepower/100
local ETQ=_Tune.E_Torque/100
local ETrans1=_Tune.E_Trans1/1000
local ETrans2=_Tune.E_Trans2/1000
local ELimit=_Tune.E_Redline/1000
function elecHP(RPM)
RPM=RPM/1000
local retVal=1e-9
if RPM<=ETrans1 then
retVal=((((RPM/ETrans1)^_Tune.EH_FrontMult)/(1/EHP))*(RPM/ETrans1))+((((RPM/ETrans1)^(1/_Tune.EH_FrontMult))/(1/EHP))*(1-(RPM/ETrans1)))
elseif ETrans1<RPM and RPM<ETrans2 then
retVal=EHP
elseif ETrans2<=RPM then
retVal=EHP-(((RPM-ETrans2)/(ELimit-ETrans2))^_Tune.EH_EndMult)/(1/(EHP*(_Tune.EH_EndPercent/100)))
else
error( "\n\t [NCT: M]: Drive initialization failed!"
.."\n\t An unknown error occured when initializing electric horsepower."
.."\n\t Please send a screenshot of this message to Avxnturador."
.."\n\t R: "..RPM..", T1: "..ETrans1", T2: "..ETrans2", L: "..ELimit".")
end
return retVal
end
function elecTQ(RPM)
RPM=RPM/1000
local retVal=1e-9
if RPM<ETrans1 then
retVal=ETQ
elseif ETrans1<=RPM then
retVal=ETQ-(((RPM-ETrans1)/(ELimit-ETrans1))^_Tune.ET_EndMult)/(1/(ETQ*(_Tune.ET_EndPercent/100)))
else
error( "\n\t [NCT: M]: Drive initialization failed!"
.."\n\t An unknown error occured when initializing electric torque."
.."\n\t Please send a screenshot of this message to Avxnturador."
.."\n\t R: "..RPM..", T1: "..ETrans1", T2: "..ETrans2", L: "..ELimit".")
end
return retVal
end
--Plot Current Electric Horsepower
function ElecCurve(x,gear)
local hp=(math.max(elecHP(x),0))*100
local tq=(math.max(elecTQ(x),0))*100
if gear~=0 then
return hp,math.max(tq*_Tune.Ratios[gear+1]*fFD*hpScaling,0)
else
return 0,0
end
end
--Output Cache
local NCache = {}
local ECache = {}
local TCache = {}
local SCache = {}
for gear,ratio in pairs(_Tune.Ratios) do
local nhpPlot = {}
local ehpPlot = {}
local thpPlot = {}
local shpPlot = {}
for rpm = 0, math.ceil((_Tune.Redline+100)/100) do
local ntqPlot = {}
local etqPlot = {}
local ttqPlot = {}
local stqPlot = {}
if rpm~=0 then
if _Tune.Engine then
ntqPlot.Horsepower,ntqPlot.Torque = EngineCurve(rpm*100,gear-1,V_MT,_Tune.M_EqPoint,PeakHP_N,PeakTQ_N)
if _TCount~=0 then
ttqPlot.Horsepower,ttqPlot.Torque = EngineCurve(rpm*100,gear-1,V_TC,_Tune.M_EqPoint,PeakHP_T,PeakTQ_T)
else
ttqPlot.Horsepower,ttqPlot.Torque = 0,0
end
if _SCount~=0 then
stqPlot.Horsepower,stqPlot.Torque = EngineCurve(rpm*100,gear-1,V_SC,_Tune.M_EqPoint,PeakHP_S,PeakTQ_S)
else
stqPlot.Horsepower,stqPlot.Torque = 0,0
end
else
ntqPlot.Horsepower,ntqPlot.Torque = 0,0
ttqPlot.Horsepower,ttqPlot.Torque = 0,0
stqPlot.Horsepower,stqPlot.Torque = 0,0
end
if _Tune.Electric then
etqPlot.Horsepower,etqPlot.Torque = ElecCurve(rpm*100,gear-1)
else
etqPlot.Horsepower,etqPlot.Torque = 0,0
end
else
ntqPlot.Horsepower,ntqPlot.Torque = 0,0
etqPlot.Horsepower,etqPlot.Torque = 0,0
ttqPlot.Horsepower,ttqPlot.Torque = 0,0
stqPlot.Horsepower,stqPlot.Torque = 0,0
end
if _Tune.Engine then
nhp,ntq = EngineCurve((rpm+1)*100,gear-1,V_MT,_Tune.M_EqPoint,PeakHP_N,PeakTQ_N)
if _TCount~=0 then
thp,ttq = EngineCurve((rpm+1)*100,gear-1,V_TC,_Tune.M_EqPoint,PeakHP_T,PeakTQ_T)
else
thp,ttq = 0,0
end
if _SCount~=0 then
shp,stq = EngineCurve((rpm+1)*100,gear-1,V_SC,_Tune.M_EqPoint,PeakHP_S,PeakTQ_S)
else
shp,stq = 0,0
end
else
nhp,ntq = 0,0
thp,ttq = 0,0
shp,stq = 0,0
end
if _Tune.Electric then
ehp,etq = ElecCurve((rpm+1)*100,gear-1)
else
ehp,etq = 0,0
end
ntqPlot.HpSlope,ntqPlot.TqSlope = (nhp-ntqPlot.Horsepower),(ntq-ntqPlot.Torque)
etqPlot.HpSlope,etqPlot.TqSlope = (ehp-etqPlot.Horsepower),(etq-etqPlot.Torque)
ttqPlot.HpSlope,ttqPlot.TqSlope = (thp-ttqPlot.Horsepower),(ttq-ttqPlot.Torque)
stqPlot.HpSlope,stqPlot.TqSlope = (shp-stqPlot.Horsepower),(stq-stqPlot.Torque)
nhpPlot[rpm] = ntqPlot
ehpPlot[rpm] = etqPlot
thpPlot[rpm] = ttqPlot
shpPlot[rpm] = stqPlot
end
table.insert(NCache,nhpPlot)
table.insert(ECache,ehpPlot)
table.insert(TCache,thpPlot)
table.insert(SCache,shpPlot)
end
--Powertrain
wait()
function Auto()
local maxSpin=0
if Rear.Wheel.RotVelocity.Magnitude>maxSpin then maxSpin = Rear.Wheel.RotVelocity.Magnitude end
if _IsOn then
if _CGear == 0 and not _Tune.NeutralRev then _CGear = 1 _ClPressing = false end
if _CGear >= 1 then
if (_CGear==1 and _InBrake > 0 and bike.DriveSeat.Velocity.Magnitude < 10) and _Tune.NeutralRev then
_CGear = 0 _ClPressing = false
elseif bike.DriveSeat.Velocity.Magnitude > 10 then
if _Tune.AutoShiftMode == "RPM" and not _ClutchSlip then
if _RPM>(_Tune.PeakRPM+_Tune.AutoUpThresh) then
if not _ShiftUp and not _Shifting then _ShiftUp = true end
elseif math.max(math.min(maxSpin*_Tune.Ratios[_CGear+1]*fFDr,_Tune.Redline+100),_Tune.IdleRPM)<(_Tune.PeakRPM-_Tune.AutoDownThresh) and _CGear>1 then
if not _ShiftDn and not _Shifting then _ShiftDn = true end
end
else
if bike.DriveSeat.Velocity.Magnitude > math.ceil(wDRatio*(_Tune.PeakRPM+_Tune.AutoUpThresh)/_Tune.Ratios[_CGear+1]/fFD) then
if not _ShiftUp and not _Shifting then _ShiftUp = true end
elseif bike.DriveSeat.Velocity.Magnitude < math.ceil(wDRatio*(_Tune.PeakRPM-_Tune.AutoDownThresh)/_Tune.Ratios[_CGear+1]/fFD) and _CGear>1 then
if not _ShiftDn and not _Shifting then _ShiftDn = true end
end
end
end
else
if (_InThrot-(_Tune.IdleThrottle/100) > 0 and bike.DriveSeat.Velocity.Magnitude < 10) and _Tune.NeutralRev then
_CGear = 1 _ClPressing = false
end
end
end
end
function Gear()
local maxSpin=0
if Rear.Wheel.RotVelocity.Magnitude>maxSpin then maxSpin = Rear.Wheel.RotVelocity.Magnitude end
if _ShiftUp and not _Shifting then
local AutoCheck if _TMode~="Manual" then AutoCheck = true end
if (_TMode == "Manual" and ((not _Tune.QuickShifter and not _ClPressing) or (not _ClPressing and (_Tune.QuickShifter and tick()-_BTick>_Tune.QuickShiftTime)))) or _CGear == #_Tune.Ratios-1 or (_TMode ~= "Manual" and not _IsOn) then _ShiftUp = false return end
local NextGear = math.min(_CGear+1,#_Tune.Ratios)
if _TMode~="Manual" then
_Shifting = true
if _CGear>0 then
if _Tune.AutoShiftType=="DCT" then
wait(_Tune.ShiftUpTime)
elseif _Tune.AutoShiftType=="Rev" then
repeat wait() until _RPM<=math.max(math.min(maxSpin*_Tune.Ratios[NextGear]*fFDr,_Tune.Redline-_Tune.RevBounce),_Tune.IdleRPM) or not _IsOn or _ShiftDn
end
end
end
_ShiftUp = false
_Shifting = false
if _TMode ~= "Manual" and not _IsOn then return end
_CGear = math.min(_CGear+1,#_Tune.Ratios-1)
if _TMode ~= "Manual" or (_TMode == "Manual" and (_CGear == 1 or AutoCheck)) and _IsOn then _ClPressing = false end
end
if _ShiftDn and not _Shifting then
local AutoCheck if _TMode~="Manual" then AutoCheck = true end
if (_TMode == "Manual" and ((not _Tune.QuickShifter and not _ClPressing) or (not _ClPressing and (_Tune.QuickShifter and tick()-_TTick>_Tune.QuickShiftTime)))) or _CGear == 0 or (_TMode ~= "Manual" and not _IsOn) then _ShiftDn = false return end
local PrevGear = math.min(_CGear,#_Tune.Ratios)
if _TMode~="Manual" then
_Shifting = true
if _CGear>1 then
if _Tune.AutoShiftType=="DCT" then
wait(_Tune.ShiftDnTime)
elseif _Tune.AutoShiftType=="Rev" then
repeat wait() until _RPM>=math.max(math.min(maxSpin*_Tune.Ratios[PrevGear]*fFDr,_Tune.Redline-_Tune.RevBounce),_Tune.IdleRPM) or not _IsOn or _ShiftUp
end
end
end
_ShiftDn = false
_Shifting = false
if _TMode ~= "Manual" and not _IsOn then return end
_CGear = math.max(_CGear-1,0)
if _TMode ~= "Manual" or (_TMode == "Manual" and (_CGear == 0 or AutoCheck)) and _IsOn then _ClPressing = false end
end
end
local tqTCS = 1
local sthrot = 0
local _StallOK = false
local ticc = tick()
local bticc = tick()
--Apply Power
function Engine(dt)
local deltaTime = (60/(1/dt))
--Determine Clutch Slip
if _TMode~="Manual" and _Tune.SlipClutch then
if _Tune.ABS and _ABS then
if _SlipCount >= _Tune.SlipABSThres then _ClutchSlip = true else _ClutchSlip = false end
else
if tick()-bticc >= _Tune.SlipTimeThres then _ClutchSlip = true else _ClutchSlip = false end
end
else
_ClutchSlip = false
end
--Neutral Gear
if ((_CGear == 0 or _Shifting) and _IsOn) then
_ClPressing = true
_Clutch = 1
_StallOK = false
end
local revMin = _Tune.IdleRPM
local goalMin = _Tune.IdleRPM
if _Tune.Stall and _Tune.Clutch then revMin = 0 end
if _Shifting and _ShiftUp then
_GThrot = 0
elseif _Shifting and _ShiftDn then
_GThrot = (_Tune.ShiftThrot/100)
else
_GThrot = _InThrot
end
_GBrake = _InBrake
if not _IsOn then
ticc = tick()
revMin = 0
goalMin = 0
_GThrot = _Tune.IdleThrottle/100
if _TMode~="Manual" then
_CGear = 0
_ClPressing = true
_Clutch = 1
end
end
--Determine RPM
local maxSpin=0
if Rear.Wheel.RotVelocity.Magnitude>maxSpin then maxSpin = Rear.Wheel.RotVelocity.Magnitude end
local _GoalRPM=0
if _Tune.Engine or _Tune.Electric then
_GoalRPM = math.max(math.min((_RPM-_Tune.RevDecay*deltaTime)+((_Tune.RevDecay+_Tune.RevAccel)*_GThrot*deltaTime),_Tune.Redline+100),goalMin)
end
if _GoalRPM>_Tune.Redline then
if _CGear<#_Tune.Ratios-2 then
_GoalRPM = _GoalRPM-_Tune.RevBounce
else
_GoalRPM = _GoalRPM-_Tune.RevBounce*.5
end
end
local _WheelRPM = maxSpin*_Tune.Ratios[_CGear+1]*fFDr
--Clutch Calculation
if _Tune.Clutch then
if script.Parent.Values.AutoClutch.Value and _IsOn then
if _Tune.ClutchType == "Clutch" then
if _ClPressing or _ClutchSlip then _ClutchKick = 1 end
_ClutchKick = _ClutchKick*(_Tune.ClutchEngage/100)
local ClRPMInfluence = math.max((_RPM-_Tune.IdleRPM)*_Tune.ClutchRPMMult/(_Tune.Redline-_Tune.IdleRPM),0)
if _Tune.ClutchMode == "New" then ClRPMInfluence = 0 end
_ClutchModulate = math.min(((((script.Parent.Values.Velocity.Value.Magnitude/_Tune.SpeedEngage)/math.abs(_CGear)) + ClRPMInfluence) - _ClutchKick), 1)
elseif _Tune.ClutchType == "CVT" or (_Tune.ClutchType == "TorqueConverter" and _Tune.TQLock) then
if (_GThrot-(_Tune.IdleThrottle/100)==0 and script.Parent.Values.Velocity.Value.Magnitude<_Tune.SpeedEngage) or (_GThrot-(_Tune.IdleThrottle/100)~=0 and (_RPM < _Tune.RPMEngage and _WheelRPM < _Tune.RPMEngage)) then
_ClutchModulate = math.min(_ClutchModulate*(_Tune.ClutchEngage/100), 1)
else
_ClutchModulate = math.min(_ClutchModulate*(_Tune.ClutchEngage/100)+(1-(_Tune.ClutchEngage/100)), 1)
end
elseif _Tune.ClutchType == "TorqueConverter" and not _Tune.TQLock then
_ClutchModulate = math.min((_RPM/_Tune.Redline)*0.7, 1)
end
if not _ClPressing and not _ClutchSlip then _Clutch = math.min(1-_ClutchModulate,1) else _Clutch = 1 end
_StallOK = (_Clutch<=0.01) or _StallOK
else
_StallOK = _Tune.Stall
_Clutch = script.Parent.Values.Clutch.Value
end
else
_StallOK = false
if (not _ClPressing and not _ClutchSlip) and not _Shifting then _Clutch = 0 else _Clutch = 1 end
end
local aRPM = math.max(math.min((_GoalRPM*_Clutch) + (_WheelRPM*(1-_Clutch)),_Tune.Redline+100),revMin)
local clutchP = math.min(math.abs(aRPM-_RPM)/(_Tune.Flywheel*deltaTime),.9)
if _ClPressing or _ClutchSlip then clutchP = 0 end
_RPM = _RPM*clutchP + aRPM*(1-clutchP)
if _RPM<=(_Tune.IdleRPM/4) and _StallOK and (tick()-ticc>=0.2) then script.Parent.IsOn.Value = not _Tune.Stall end
--Rev Limiter
_spLimit = -((_Tune.Redline+100)/(fFDr*_Tune.Ratios[_CGear+1]))
if _Tune.Limiter then _spLimit = math.min(_spLimit,-_Tune.SpeedLimit) end
if _RPM>_Tune.Redline then
if _CGear<#_Tune.Ratios-2 then
_RPM = _RPM-_Tune.RevBounce
else
_RPM = _RPM-_Tune.RevBounce*.5
end
end
--Aspiration
local TPsi = _TPsi/_TCount
local _BThrot = _GThrot
if _Tune.Engine then
if _TCount~=0 then
_TBoost = _TBoost + ((((((_HP*(_BThrot*1.2)/_Tune.Horsepower)/8)-(((_TBoost/TPsi*(TPsi/15)))))*((8/(_Tune.T_Size/(deltaTime)))*2))/TPsi)*15)
if _TBoost < 0.05 then _TBoost = 0.05 elseif _TBoost > 2 then _TBoost = 2 end
else
_TBoost = 0
end
if _SCount~=0 then
if _BThrot>sthrot then
sthrot=math.min(_BThrot,sthrot+_Tune.S_Sensitivity*deltaTime)
elseif _BThrot<sthrot then
sthrot=math.max(_BThrot,sthrot-_Tune.S_Sensitivity*deltaTime)
end
_SBoost = (_RPM/_Tune.Redline)*(.5+(1.5*sthrot))
else
_SBoost = 0
end
else
_TBoost = 0
_SBoost = 0
end
--Torque calculations
if _Tune.Engine then
local cTq = NCache[_CGear+1][math.floor(math.min(_Tune.Redline,math.max(0,_RPM))/100)]
_NH = cTq.Horsepower+(cTq.HpSlope*(((_RPM-math.floor(_RPM/100))/100)%1))
_NT = cTq.Torque+(cTq.TqSlope*(((_RPM-math.floor(_RPM/100))/100)%1))
if _TCount~=0 then
local tTq = TCache[_CGear+1][math.floor(math.min(_Tune.Redline,math.max(0,_RPM))/100)]
_TH = (tTq.Horsepower+(tTq.HpSlope*(((_RPM-math.floor(_RPM/100))/100)%1)))*(_TBoost/2)
_TT = (tTq.Torque+(tTq.TqSlope*(((_RPM-math.floor(_RPM/100))/100)%1)))*(_TBoost/2)
else
_TH,_TT = 0,0
end
if _SCount~=0 then
local sTq = SCache[_CGear+1][math.floor(math.min(_Tune.Redline,math.max(0,_RPM))/100)]
_SH = (sTq.Horsepower+(sTq.HpSlope*(((_RPM-math.floor(_RPM/100))/100)%1)))*(_SBoost/2)
_ST = (sTq.Torque+(sTq.TqSlope*(((_RPM-math.floor(_RPM/100))/100)%1)))*(_SBoost/2)
else
_SH,_ST = 0,0
end
_BH = _TH+_SH
_BT = _TT+_ST
else
_NH,_NT = 0,0
_TH,_TT = 0,0
_SH,_ST = 0,0
_BH,_BT = 0,0
end
if _Tune.Electric and _CGear~=0 then
local eTq = ECache[_CGear+1][math.floor(math.min(_Tune.Redline,math.max(100,_RPM))/100)]
_EH = eTq.Horsepower+(eTq.HpSlope*(((_RPM-math.floor(_RPM/100))/100)%1))
_ET = eTq.Torque+(eTq.TqSlope*(((_RPM-math.floor(_RPM/100))/100)%1))
else
_EH,_ET = 0,0
end
_HP = _NH + _BH + _EH
_OutTorque = _NT + _BT + _ET
--Update Wheels
--Front
_fABSActive = false
--Output
if _PBrake and bike.DriveSeat.Velocity.Magnitude<20 then
--PBrake
Front.Axle.HingeConstraint.MotorMaxTorque=PBrakeForce*(60/workspace:GetRealPhysicsFPS())
else
if _CGear == 0 and bike.DriveSeat.Velocity.Magnitude <= 10 and _Tune.NeutralRev then
Front.Axle.HingeConstraint.MotorMaxTorque=FBrakeForce*_GThrot*(60/workspace:GetRealPhysicsFPS())
else
--Apply ABS
local ftqABS = 1
if _ABS and math.abs(Front.Wheel.RotVelocity.Magnitude*(Front.Wheel.Size.Y/2) - Front.Wheel.Velocity.Magnitude)-_Tune.ABSThreshold>0 then ftqABS = 0 end
if ftqABS < 1 then _fABSActive = true end
local brake = FBrakeForce
if _Tune.LinkedBrakes then
local bias = _Tune.BrakesRatio/100
brake = brake*bias
end
Front.Axle.HingeConstraint.MotorMaxTorque=brake*_GBrake*ftqABS*(60/workspace:GetRealPhysicsFPS())
end
end
--Rear
_TCSActive = false
_rABSActive = false
--Output
if _PBrake and bike.DriveSeat.Velocity.Magnitude>=20 then
--PBrake
_SlipCount = _Tune.SlipABSThres
bticc = tick()-_Tune.SlipTimeThres
Rear.Axle.HingeConstraint.MotorMaxTorque=PBrakeForce*(60/workspace:GetRealPhysicsFPS())
Rear.Axle.HingeConstraint.MotorMaxAcceleration=9e9
Rear.Axle.HingeConstraint.AngularVelocity=0
else
--Apply Power
if _CGear == 0 and bike.DriveSeat.Velocity.Magnitude <= 10 and _Tune.NeutralRev then
bticc = tick()
_SlipCount = 0
Rear.Axle.HingeConstraint.MotorMaxTorque=math.min((500*_GBrake)+(RBrakeForce*_GThrot),500)*(60/workspace:GetRealPhysicsFPS())
Rear.Axle.HingeConstraint.AngularVelocity=7*_GBrake*(1-_GThrot)
elseif _GBrake==0 then
bticc = tick()
_SlipCount = 0
local on=1
if not script.Parent.IsOn.Value then on=0 end
local throt = _GThrot
local clutch=1
if _ClPressing then clutch=0 end
--Apply TCS
local tqTCS = 1
if _TCS then tqTCS = 1-(math.min(math.max(0,math.abs(Rear.Wheel.RotVelocity.Magnitude*(wDia/2) - Rear.Wheel.Velocity.Magnitude)-_Tune.TCSThreshold)/_Tune.TCSGradient,1)*(1-(_Tune.TCSLimit/100))) end
_TCSAmt = tqTCS
if tqTCS < 1 then
_TCSAmt = tqTCS
_TCSActive = true
end
--Update Forces
Rear.Axle.HingeConstraint.MotorMaxTorque=_OutTorque*throt*tqTCS*on*clutch*(60/workspace:GetRealPhysicsFPS())*(1+(Rear.Wheel.RotVelocity.Magnitude/(120-workspace:GetRealPhysicsFPS()))^(((1-_Tune.Drag)*1.15)+(((1-_Tune.Drag)*.07)*(1-(60/workspace:GetRealPhysicsFPS())))))
Rear.Axle.HingeConstraint.MotorMaxAcceleration=_RPM*(math.pi/30)
Rear.Axle.HingeConstraint.AngularVelocity=_spLimit
--Brakes
else
--Apply ABS
local rtqABS = 1
if math.abs(Rear.Wheel.RotVelocity.Magnitude*(wDia/2) - Rear.Wheel.Velocity.Magnitude)-_Tune.ABSThreshold>0 then
if _ABS then rtqABS = 0 _SlipCount = _SlipCount + 1 end
else
bticc = tick()
end
if rtqABS < 1 then _rABSActive = true end
local brake = RBrakeForce
if _Tune.LinkedBrakes then
local bias = _Tune.BrakesRatio/100
brake = brake*(1-bias)
end
Rear.Axle.HingeConstraint.MotorMaxTorque=brake*_GBrake*rtqABS*(60/workspace:GetRealPhysicsFPS())
Rear.Axle.HingeConstraint.MotorMaxAcceleration=9e9
Rear.Axle.HingeConstraint.AngularVelocity=0
end
end
end
|
----------------------------------------------------------------------------------------------------
--------------------=[ OUTROS ]=--------------------------------------------------------------------
---------------------------------------------------------------------------------------------------- |
,FastReload = false --- Automatically operates the bolt on reload if needed
,SlideLock = false
,MoveBolt = false
,BoltLock = false
,CanBreachDoor = false
,CanBreak = false --- Weapon can jam?
,JamChance = 0 --- This old piece of brick doesn't work fine >;c
,IncludeChamberedBullet = false --- Include the chambered bullet on next reload
,Chambered = false --- Start with the gun chambered?
,LauncherReady = false --- Start with the GL ready?
,CanCheckMag = false --- You can check the magazine
,ArcadeMode = false --- You can see the bullets left in magazine
,RainbowMode = false --- Operation: Party Time xD
,ModoTreino = false --- Surrender enemies instead of killing them
,GunSize = 1.25
,GunFOVReduction = 5
,BoltExtend = Vector3.new(0, 0, 0)
,SlideExtend = Vector3.new(0, 0, 0) |
-- FRAMEWORK |
export type FrameworkType = {
Logger: {
print: (...any) -> (),
debug: (...any) -> (),
warn: (...any) -> (),
error: (...any) -> ()
},
Functions: {},
Modules: (...any) -> (...any) & {},
Services: (...any) -> (...any) & {
Workspace: Workspace,
Players: Players,
Lighting: Lighting,
ReplicatedFirst: ReplicatedFirst,
ReplicatedStorage: ReplicatedStorage,
TweenService: TweenService,
ContentProvider: ContentProvider,
RunService: RunService,
SoundService: SoundService,
TextService: TextService,
UserInputService: UserInputService,
Debris: Debris,
Teams: Teams,
Chat: Chat,
[string]: any
},
Network: NetworkType,
UserInput: UserInputType,
Playerstates: PlayerstatesType,
Interface: InterfaceType
--Connection: Connection,
--Replication: Replication,
--Interaction: Interaction
}
|
--[=[
Like [GetRemoteFunction] but in promise form.
@function PromiseGetRemoteFunction
@within PromiseGetRemoteFunction
@param name string
@return Promise<RemoteFunction>
]=] |
if not RunService:IsRunning() then
-- Handle testing
return function(name)
return Promise.resolved(GetRemoteFunction(name))
end
elseif RunService:IsServer() then
return function(name)
return Promise.resolved(GetRemoteFunction(name))
end
else -- RunService:IsClient()
return function(name)
assert(type(name) == "string", "Bad name")
local storage = ReplicatedStorage:FindFirstChild(ResourceConstants.REMOTE_FUNCTION_STORAGE_NAME)
if storage then
local obj = storage:FindFirstChild(name)
if obj then
return Promise.resolved(obj)
end
end
return Promise.spawn(function(resolve, _)
resolve(GetRemoteFunction(name))
end)
end
end
|
--Made by Luckymaxer |
Character = script.Parent
BaseColor = BrickColor.new("Bright yellow")
Color = BaseColor.Color
Duration = 150
Classes = {
BasePart = {
BrickColor = BaseColor,
Material = Enum.Material.Plastic,
Reflectance = 0.5,
Anchored = true,
},
FileMesh = {
TextureId = "",
},
DataModelMesh = {
VertexColor = Vector3.new(Color.r, Color.g, Color.b),
},
CharacterMesh = {
BaseTextureId = 0,
OverlayTextureId = 0,
},
Shirt = {
ShirtTemplate = "",
},
Pants = {
PantsTemplate = "",
},
Decal = {
Texture = "",
}
}
Objects = {}
function Redesign(Parent)
for i, v in pairs(Parent:GetChildren()) do
local Object = {
Object = nil,
Properties = {},
}
for ii, vv in pairs(Classes) do
if v:IsA(ii) then
Object.Object = v
for iii, vvv in pairs(vv) do
local PropertyValue = nil
pcall(function()
PropertyValue = v[iii]
v[iii] = vvv
end)
if PropertyValue then
Object.Properties[iii] = PropertyValue
end
end
end
end
table.insert(Objects, Object)
Redesign(v)
end
end
Redesign(script.Parent) --Goldify the player
wait(Duration)
for i, v in pairs(Objects) do --Unfreeze the player
for ii, vv in pairs(v.Properties) do
v.Object[ii] = vv
end
end
script:Destroy()
|
----- |
for _,v in pairs(script.Parent.n1:GetChildren())do
v.Visible=tonumber(v.Name)==sc1
end
for _,v in pairs(script.Parent.n2:GetChildren())do
v.Visible=tonumber(v.Name)==sc2
end
end end
|
--Preforms a "soft shutdown". It will teleport players to a reserved server
--and teleport them back, with a new server. ORiginal version by Merely.
--Be aware this will hard shutdown reserved servers. |
local PlaceId = game.PlaceId
local Players = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")
local TeleportScreenCreator = script:WaitForChild("TeleportScreenCreator")
local CreateTeleportScreen = require(TeleportScreenCreator)
local SoftShutdownLocalScript = script:WaitForChild("SoftShutdownLocalScript")
TeleportScreenCreator.Parent = SoftShutdownLocalScript
SoftShutdownLocalScript.Parent = game:GetService("ReplicatedFirst")
local StartShutdown = Instance.new("RemoteEvent")
StartShutdown.Name = "StartShutdown"
StartShutdown.Parent = game.ReplicatedStorage
if not (game.VIPServerId ~= "" and game.VIPServerOwnerId == 0) then
--If it is not a reserved server, bind the teleporting on close.
game:BindToClose(function()
--Return if there is no players.
if #game.Players:GetPlayers() == 0 then
return
end
--Return if the server instance is offline.
if game.JobId == "" then
return
end
--Send the shutdown message.
StartShutdown:FireAllClients(true)
task.wait(2)
local ReservedServerCode = TeleportService:ReserveServer(PlaceId)
--Create the teleport GUI.
local ScreenGui = CreateTeleportScreen()
local function TeleportPlayer(Player)
TeleportService:TeleportToPrivateServer(PlaceId,ReservedServerCode,{Player},nil,{IsTemporaryServer=true,PlaceId = PlaceId},ScreenGui)
end
--Teleport players and try to keep the server alive until all players leave.
for _,Player in pairs(Players:GetPlayers()) do
TeleportPlayer(Player)
end
game.Players.PlayerAdded:connect(TeleportPlayer)
while #Players:GetPlayers() > 0 do wait() end
end)
end
|
--[[
FastCast Ver. 13.0.0
Written by Eti the Spirit (18406183)
The latest patch notes can be located here (and do note, the version at the top of this script might be outdated. I have a thing for forgetting to change it):
> https://etithespirit.github.io/FastCastAPIDocs/changelog
*** If anything is broken, please don't hesitate to message me! ***
YOU CAN FIND IMPORTANT USAGE INFORMATION HERE: https://etithespirit.github.io/FastCastAPIDocs
YOU CAN FIND IMPORTANT USAGE INFORMATION HERE: https://etithespirit.github.io/FastCastAPIDocs
YOU CAN FIND IMPORTANT USAGE INFORMATION HERE: https://etithespirit.github.io/FastCastAPIDocs
YOU SHOULD ONLY CREATE ONE CASTER PER GUN.
YOU SHOULD >>>NEVER<<< CREATE A NEW CASTER EVERY TIME THE GUN NEEDS TO BE FIRED.
A caster (created with FastCast.new()) represents a "gun".
When you consider a gun, you think of stats like accuracy, bullet speed, etc. This is the info a caster stores.
--
This is a library used to create hitscan-based guns that simulate projectile physics.
This means:
- You don't have to worry about bullet lag / jittering
- You don't have to worry about keeping bullets at a low speed due to physics being finnicky between clients
- You don't have to worry about misfires in bullet's Touched event (e.g. where it may going so fast that it doesn't register)
Hitscan-based guns are commonly seen in the form of laser beams, among other things. Hitscan simply raycasts out to a target
and says whether it hit or not.
Unfortunately, while reliable in terms of saying if something got hit or not, this method alone cannot be used if you wish
to implement bullet travel time into a weapon. As a result of that, I made this library - an excellent remedy to this dilemma.
FastCast is intended to be require()'d once in a script, as you can create as many casters as you need with FastCast.new()
This is generally handy since you can store settings and information in these casters, and even send them out to other scripts via events
for use.
Remember -- A "Caster" represents an entire gun (or whatever is launching your projectiles), *NOT* the individual bullets.
Make the caster once, then use the caster to fire your bullets. Do not make a caster for each bullet.
--]] | |
--Precalculated paths |
local t,f,n=true,false,{}
local r={
[58]={{58},t},
[49]={{58,56,30,41,39,35,34,32,31,29,28,44,45,49},t},
[16]={n,f},
[19]={{58,20,19},t},
[59]={{58,56,30,41,59},t},
[63]={{58,20,63},t},
[34]={{58,56,30,41,39,35,34},t},
[21]={{58,20,21},t},
[48]={{58,56,30,41,39,35,34,32,31,29,28,44,45,49,48},t},
[27]={{58,56,30,41,39,35,34,32,31,29,28,27},t},
[14]={n,f},
[31]={{58,56,30,41,39,35,34,32,31},t},
[56]={{58,56},t},
[29]={{58,56,30,41,39,35,34,32,31,29},t},
[13]={n,f},
[47]={{58,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47},t},
[12]={n,f},
[45]={{58,56,30,41,39,35,34,32,31,29,28,44,45},t},
[57]={{58,57},t},
[36]={{58,56,30,41,39,35,37,36},t},
[25]={{58,56,30,41,39,35,34,32,31,29,28,27,26,25},t},
[71]={{58,56,30,41,59,61,71},t},
[20]={{58,20},t},
[60]={{58,56,30,41,60},t},
[8]={n,f},
[4]={n,f},
[75]={{58,56,30,41,59,61,71,72,76,73,75},t},
[22]={{58,20,21,22},t},
[74]={{58,56,30,41,59,61,71,72,76,73,74},t},
[62]={{58,20,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{58,56,30,41,39,35,37},t},
[2]={n,f},
[35]={{58,56,30,41,39,35},t},
[53]={{58,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53},t},
[73]={{58,56,30,41,59,61,71,72,76,73},t},
[72]={{58,56,30,41,59,61,71,72},t},
[33]={{58,56,30,41,39,35,37,36,33},t},
[69]={{58,56,30,41,60,69},t},
[65]={{58,20,19,66,64,65},t},
[26]={{58,56,30,41,39,35,34,32,31,29,28,27,26},t},
[68]={{58,20,19,66,64,67,68},t},
[76]={{58,56,30,41,59,61,71,72,76},t},
[50]={{58,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,50},t},
[66]={{58,20,19,66},t},
[10]={n,f},
[24]={{58,56,30,41,39,35,34,32,31,29,28,27,26,25,24},t},
[23]={{58,23},t},
[44]={{58,56,30,41,39,35,34,32,31,29,28,44},t},
[39]={{58,56,30,41,39},t},
[32]={{58,56,30,41,39,35,34,32},t},
[3]={n,f},
[30]={{58,56,30},t},
[51]={{58,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,50,51},t},
[18]={n,f},
[67]={{58,20,19,66,64,67},t},
[61]={{58,56,30,41,59,61},t},
[55]={{58,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54,55},t},
[46]={{58,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,46},t},
[42]={{58,56,30,41,39,40,38,42},t},
[40]={{58,56,30,41,39,40},t},
[52]={{58,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,52},t},
[54]={{58,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{58,56,30,41},t},
[17]={n,f},
[38]={{58,56,30,41,39,40,38},t},
[28]={{58,56,30,41,39,35,34,32,31,29,28},t},
[5]={n,f},
[64]={{58,20,19,66,64},t},
}
return r
|
--[[
LOWGames Studios
Date: 27 October 2022
by Elder
]] | --
local u1 = nil;
coroutine.wrap(function()
u1 = require(game.ReplicatedStorage:WaitForChild("Framework"):WaitForChild("Library"));
end)();
return function(p1, p2)
local v1 = nil;
local v2 = nil;
local v3 = nil;
local v4 = nil;
v1 = math.round(p1 / 60 / 60 / 24 - 0.5);
v2 = math.round(p1 / 60 / 60 % 24 - 0.5);
v3 = math.round(p1 / 60 % 60 - 0.5);
v4 = math.round(p1 % 60);
if p2 then
if v1 >= 1 then
return v1 .. "d";
elseif v2 >= 1 then
return v2 .. "hr";
elseif v3 >= 1 then
return v3 .. "m";
else
return v4 .. "s";
end;
end;
local v5
if v1 >= 1 then
if v1 > 1 then
v5 = " Days";
else
v5 = " Day";
end;
return v1 .. v5;
end;
local v6
if v2 >= 1 then
if v2 > 1 then
v6 = " Hours";
else
v6 = " Hour";
end;
return v2 .. v6;
end;
local v7
if v3 >= 1 then
if v3 > 1 then
v7 = " Minutes";
else
v7 = " Minute";
end;
return v3 .. v7;
end;
local v8
if v4 > 1 then
v8 = " Seconds";
else
v8 = " Second";
end;
return v4 .. v8;
end;
|
----------- UTILITIES -------------- |
local Util = {}
do
function Util.Create(instanceType)
return function(data)
local obj = Instance.new(instanceType)
local parent = nil
for k, v in pairs(data) do
if type(k) == 'number' then
v.Parent = obj
elseif k == 'Parent' then
parent = v
else
obj[k] = v
end
end
if parent then
obj.Parent = parent
end
return obj
end
end
end
local onResizedCallbacks = {}
setmetatable(onResizedCallbacks, { __mode = 'k' })
|
-- Compiled with roblox-ts v2.1.0 |
local default = {
["0"] = 0,
px = 1,
["1"] = 1,
["2"] = 2,
["4"] = 4,
["8"] = 8,
}
return {
default = default,
}
|
--!strict |
local Types = require(script.Parent.Types)
type ServerBridge = {
Fire: (self: ServerBridge, target: Player | Types.PlayerContainer, content: Types.Content) -> (),
Connect: (self: ServerBridge, callback: (player: Player, content: Types.Content?) -> ()) -> Connection,
Once: (self: ServerBridge, callback: (player: Player, content: Types.Content?) -> ()) -> (),
Wait: (self: ServerBridge, callback: (player: Player, content: Types.Content?) -> ()) -> (Player, Types.Content?),
OnServerInvoke: ((player: Player, content: Types.Content) -> ...any)?,
RateLimitActive: boolean,
Logging: boolean,
}
type ClientBridge = {
Fire: (self: ClientBridge, content: any?) -> (),
Connect: (self: ClientBridge, callback: (content: Types.Content?) -> ()) -> Connection,
Once: (self: ClientBridge, callback: (content: Types.Content?) -> ()) -> (),
Wait: (self: ClientBridge, callback: (content: Types.Content?) -> ()) -> Types.Content,
InvokeServerAsync: (self: ClientBridge, content: any?) -> ...Types.Content?,
Logging: boolean,
}
type Connection = {
Disconnect: () -> (),
}
export type Bridge = ServerBridge & ClientBridge
export type BridgeNet2 = {
ReferenceBridge: (name: string) -> Bridge,
ClientBridge: (name: string) -> ClientBridge,
ServerBridge: (name: string) -> ServerBridge,
ReferenceIdentifier: (name: string, maxWaitTime: number) -> Types.Identifier,
Serialize: (identifierName: string) -> Types.Identifier,
Deserialize: (compressedIdentifier: string) -> Types.Identifier,
ToHex: (regularString: string) -> string,
ToReadableHex: (regularString: string) -> string,
FromHex: (hexadecimal: string) -> string,
Players: (players: Types.Array<Player>) -> Types.SetPlayerContainer,
AllPlayers: () -> Types.AllPlayerContainer,
PlayersExcept: (excludedPlayers: Types.Array<Player>) -> Types.ExceptPlayerContainer,
CreateUUID: () -> string,
HandleInvalidPlayer: (handler: (player: Player) -> ()) -> (),
}
return nil
|
-- TUNING VALUES
----------------------------------------
-- Factor of torque applied to get the wheels spinning
-- Larger number generally means faster acceleration |
local TORQUE = 9000
|
--[[Weight and CG]] |
Tune.Weight = 1760 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] .2 ,
--[[Height]] .2 ,
--[[Length]] .2 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = 0.3 -- Front Wheel Density
Tune.RWheelDensity = 0.3 -- Rear Wheel Density
Tune.FWLgcyDensity = 1.5 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1.5 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = more stable/carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
--Assigns BindAction to the Sprint function |
ContextActionService:BindAction("Sprint",Sprint,true,Enum.KeyCode.LeftShift,Enum.KeyCode.RightShift)
|
-- functions |
function stopAllAnimations()
local oldAnim = currentAnim
-- return to idle if finishing an emote
if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
oldAnim = "idle"
end
currentAnim = ""
currentAnimInstance = nil
if currentAnimKeyframeHandler ~= nil then
currentAnimKeyframeHandler:disconnect()
end
if currentAnimTrack ~= nil then
currentAnimTrack:Stop()
currentAnimTrack:Destroy()
currentAnimTrack = nil
end
-- clean up walk if there is one
if runAnimKeyframeHandler ~= nil then
runAnimKeyframeHandler:disconnect()
end
if runAnimTrack ~= nil then
runAnimTrack:Stop()
runAnimTrack:Destroy()
runAnimTrack = nil
end
return oldAnim
end
function getHeightScale()
if Humanoid then
if FFlagUserAdjustHumanoidRootPartToHipPosition then
if not Humanoid.AutomaticScalingEnabled then
return 1
end
end
local scale = Humanoid.HipHeight / HumanoidHipHeight
if userAnimationSpeedDampening then
if AnimationSpeedDampeningObject == nil then
AnimationSpeedDampeningObject = script:FindFirstChild("ScaleDampeningPercent")
end
if AnimationSpeedDampeningObject ~= nil then
scale = 1 + (Humanoid.HipHeight - HumanoidHipHeight) * AnimationSpeedDampeningObject.Value / HumanoidHipHeight
end
end
return scale
end
return 1
end
local smallButNotZero = 0.0001
function setRunSpeed(speed)
local speedScaled = speed * 4.5 -- Default is 1.25
local heightScale = getHeightScale()
local runSpeed = speedScaled / heightScale
if runSpeed ~= currentAnimSpeed then
if runSpeed < 0.33 then
currentAnimTrack:AdjustWeight(1.0)
runAnimTrack:AdjustWeight(smallButNotZero)
elseif runSpeed < 0.66 then
local weight = ((runSpeed - 0.33) / 0.33)
currentAnimTrack:AdjustWeight(1.0 - weight + smallButNotZero)
runAnimTrack:AdjustWeight(weight + smallButNotZero)
else
currentAnimTrack:AdjustWeight(smallButNotZero)
runAnimTrack:AdjustWeight(1.0)
end
currentAnimSpeed = runSpeed
runAnimTrack:AdjustSpeed(runSpeed)
currentAnimTrack:AdjustSpeed(runSpeed)
end
end
function setAnimationSpeed(speed)
if currentAnim == "walk" then
setRunSpeed(speed)
else
if speed ~= currentAnimSpeed then
currentAnimSpeed = speed
currentAnimTrack:AdjustSpeed(currentAnimSpeed)
end
end
end
function keyFrameReachedFunc(frameName)
if frameName == "End" then
if currentAnim == "walk" then
if userNoUpdateOnLoop == true then
if runAnimTrack.Looped ~= true then
runAnimTrack.TimePosition = 0.0
end
if currentAnimTrack.Looped ~= true then
currentAnimTrack.TimePosition = 0.0
end
else
runAnimTrack.TimePosition = 0.0
currentAnimTrack.TimePosition = 0.0
end
else
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
end
function rollAnimation(animName)
local roll = math.random(1, animTable[animName].totalWeight)
local origRoll = roll
local idx = 1
while (roll > animTable[animName][idx].weight) do
roll = roll - animTable[animName][idx].weight
idx = idx + 1
end
return idx
end
function playAnimation(animName, transitionTime, humanoid)
local idx = rollAnimation(animName)
local anim = animTable[animName][idx].anim
-- switch animation
if anim ~= currentAnimInstance then
if currentAnimTrack ~= nil then
currentAnimTrack:Stop(transitionTime)
currentAnimTrack:Destroy()
end
if runAnimTrack ~= nil then
runAnimTrack:Stop(transitionTime)
runAnimTrack:Destroy()
if userNoUpdateOnLoop == true then
runAnimTrack = nil
end
end
currentAnimSpeed = 1.0
-- load it to the humanoid; get AnimationTrack
currentAnimTrack = humanoid:LoadAnimation(anim)
currentAnimTrack.Priority = Enum.AnimationPriority.Core
-- play the animation
currentAnimTrack:Play(transitionTime)
currentAnim = animName
currentAnimInstance = anim
-- set up keyframe name triggers
if currentAnimKeyframeHandler ~= nil then
currentAnimKeyframeHandler:disconnect()
end
currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
-- check to see if we need to blend a walk/run animation
if animName == "walk" then
local runAnimName = "run"
local runIdx = rollAnimation(runAnimName)
runAnimTrack = humanoid:LoadAnimation(animTable[runAnimName][runIdx].anim)
runAnimTrack.Priority = Enum.AnimationPriority.Core
runAnimTrack:Play(transitionTime)
if runAnimKeyframeHandler ~= nil then
runAnimKeyframeHandler:disconnect()
end
runAnimKeyframeHandler = runAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
end
end
end
|
--[[
Mobile.TouchStarted(position)
Mobile.TouchEnded(position)
Mobile.TouchMoved(position, delta)
Mobile.TouchTapInWorld(position)
Mobile.TouchPinch(scale, state)
--]] |
local Mobile = {}
local RAY = Ray.new
local workspace = workspace
local userInput = game:GetService("UserInputService")
local cam = workspace.CurrentCamera
function Mobile:GetRay(position)
local viewportMouseRay = cam:ViewportPointToRay(position.X, position.Y)
return RAY(viewportMouseRay.Origin, viewportMouseRay.Direction * 999)
end
function Mobile:Cast(position, ignoreDescendantsInstance, terrainCellsAreCubes, ignoreWater)
return workspace:FindPartOnRay(self:GetRay(position), ignoreDescendantsInstance, terrainCellsAreCubes, ignoreWater)
end
function Mobile:CastWithIgnoreList(position, ignoreDescendantsTable, terrainCellsAreCubes, ignoreWater)
return workspace:FindPartOnRayWithIgnoreList(self:GetRay(position), ignoreDescendantsTable, terrainCellsAreCubes, ignoreWater)
end
function Mobile:CastWithWhitelist(position, whitelistDescendantsTable, ignoreWater)
return workspace:FindPartOnRayWithWhitelist(self:GetRay(position), whitelistDescendantsTable, ignoreWater)
end
function Mobile:Start()
end
function Mobile:Init()
self.TouchStarted = self.Shared.Event.new()
self.TouchEnded = self.Shared.Event.new()
self.TouchMoved = self.Shared.Event.new()
self.TouchTapInWorld = self.Shared.Event.new()
self.TouchPinch = self.Shared.Event.new()
userInput.TouchStarted:Connect(function(input, processed)
if (processed) then return end
self.TouchStarted:Fire(input.Position)
end)
userInput.TouchEnded:Connect(function(input, processed)
self.TouchEnded:Fire(input.Position)
end)
userInput.TouchMoved:Connect(function(input, processed)
if (processed) then return end
self.TouchMoved:Fire(input.Position, input.Delta)
end)
userInput.TouchTapInWorld:Connect(function(position, processed)
if (processed) then return end
self.TouchTapInWorld:Fire(position)
end)
userInput.TouchPinch:Connect(function(touchPositions, scale, velocity, state, processed)
if (processed) then return end
self.TouchPinch:Fire(scale, state)
end)
end
return Mobile
|
--add the power laser flickering here
--skipped |
wait(0.7)
Utils:CreateTween(game.Lighting.ColorCorrection,{0.25},{Contrast=1,Brightness=2},true)
wait(12)
game.Lighting.ColorCorrection.Contrast=-1
Utils:CreateTween(game.Lighting.ColorCorrection,{10},{TintColor=Color3.new(0,0,0)},true)
wait(12) |
--[=[
Converts the string to UpperCamelCase
@param str string
@return string
]=] |
function String.toCamelCase(str: string): string
str = str:lower()
str = str:gsub("[ _](%a)", string.upper)
str = str:gsub("^%a", string.upper)
str = str:gsub("%p", "")
return str
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
--Shift Down [Manual Transmission]
if _IsOn and (input.KeyCode ==_CTRL["ContlrShiftDown"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftDown"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftDown"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
_CGear = math.max(_CGear-1,-1)
--Shift Up [Manual Transmission]
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrShiftUp"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftUp"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftUp"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
_CGear = math.min(_CGear+1,#_Tune.Ratios-2)
--Toggle Clutch
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrClutch"] or (_MSteer and input.KeyCode==_CTRL["MouseClutch"]) or ((not _MSteer) and input.KeyCode==_CTRL["Clutch"])) and _TMode=="Manual" then
if input.UserInputState == Enum.UserInputState.Begin then
_ClutchOn = false
_ClPressing = true
elseif input.UserInputState == Enum.UserInputState.End then
_ClutchOn = true
_ClPressing = false
end
--Toggle PBrake
elseif _IsOn and input.KeyCode ==_CTRL["ContlrPBrake"] or (_MSteer and input.KeyCode==_CTRL["MousePBrake"]) or ((not _MSteer) and input.KeyCode==_CTRL["PBrake"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_PBrake = not _PBrake
elseif input.UserInputState == Enum.UserInputState.End then
if car.DriveSeat.Velocity.Magnitude>5 then
_PBrake = false
end
end
--Toggle Transmission Mode
elseif (input.KeyCode == _CTRL["ContlrToggleTMode"] or input.KeyCode==_CTRL["ToggleTransMode"]) and input.UserInputState == Enum.UserInputState.Begin then
local n=1
for i,v in pairs(_Tune.TransModes) do
if v==_TMode then n=i break end
end
n=n+1
if n>#_Tune.TransModes then n=1 end
_TMode = _Tune.TransModes[n]
--Throttle
elseif _IsOn and ((not _MSteer) and (input.KeyCode==_CTRL["Throttle"] or input.KeyCode == _CTRL["Throttle2"])) or ((((_CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseThrottle"]) or input.KeyCode == _CTRL["MouseThrottle"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GThrot = 1
else
_GThrot = _Tune.IdleThrottle/100
end
--Brake
elseif ((not _MSteer) and (input.KeyCode==_CTRL["Brake"] or input.KeyCode == _CTRL["Brake2"])) or ((((_CTRL["MouseBrake"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseBrake"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseBrake"]) or input.KeyCode == _CTRL["MouseBrake"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GBrake = 1
else
_GBrake = 0
end
--Steer Left
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerLeft"] or input.KeyCode == _CTRL["SteerLeft2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = -1
_SteerL = true
else
if _SteerR then
_GSteerT = 1
else
_GSteerT = 0
end
_SteerL = false
end
--Steer Right
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerRight"] or input.KeyCode == _CTRL["SteerRight2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = 1
_SteerR = true
else
if _SteerL then
_GSteerT = -1
else
_GSteerT = 0
end
_SteerR = false
end
--Toggle Mouse Controls
elseif input.KeyCode ==_CTRL["ToggleMouseDrive"] then
if input.UserInputState == Enum.UserInputState.End then
_MSteer = not _MSteer
_GThrot = _Tune.IdleThrottle/100
_GBrake = 0
_GSteerT = 0
_ClutchOn = true
end
--Toggle TCS
elseif _Tune.TCSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleTCS"] or input.KeyCode == _CTRL["ContlrToggleTCS"] then
if input.UserInputState == Enum.UserInputState.End then
_TCS = not _TCS
end
--Toggle ABS
elseif _Tune. ABSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleABS"] or input.KeyCode == _CTRL["ContlrToggleABS"] then
if input.UserInputState == Enum.UserInputState.End then
_ABS = not _ABS
end
end
--Variable Controls
if input.UserInputType.Name:find("Gamepad") then
--Gamepad Steering
if input.KeyCode == _CTRL["ContlrSteer"] then
if input.Position.X>= 0 then
local cDZone = math.min(.99,_Tune.Peripherals.ControlRDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X-cDZone)/(1-cDZone)
else
_GSteerT = 0
end
else
local cDZone = math.min(.99,_Tune.Peripherals.ControlLDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X+cDZone)/(1-cDZone)
else
_GSteerT = 0
end
end
--Gamepad Throttle
elseif _IsOn and input.KeyCode == _CTRL["ContlrThrottle"] then
_GThrot = math.max(_Tune.IdleThrottle/100,input.Position.Z)
--Gamepad Brake
elseif input.KeyCode == _CTRL["ContlrBrake"] then
_GBrake = input.Position.Z
end
end
else
_GThrot = _Tune.IdleThrottle/100
_GSteerT = 0
_GBrake = 0
if _CGear~=0 then _ClutchOn = true end
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)
UserInputService.InputEnded:connect(DealWithInput)
|
--- VARIABLES/CONSTANTS --- |
THROW_MULTIPLIER = 0.25
local Tool = {}
Tool.MouseButton1 = function(Character, ExtraData) -- Throw
local MousePosition = ExtraData[1]
local Net = Character:FindFirstChildOfClass("Tool")
if not Net:FindFirstChild("Display") then return end
Character.Humanoid:LoadAnimation(script.Toss):Play()
task.wait(0.3)
local Model = Instance.new("Model", workspace.Debris)
Model.Name = Character.Name.."_"..script.Name
local CloneNet = Net:Clone()
CloneNet.Display.Parent = Model
CloneNet.Handle.Parent = Model
CloneNet:Destroy()
local Display = Net.Display
Display.Parent = ServerStorage.PlayerStorage
-- Throw Model.Handle
local throwForce = 100*THROW_MULTIPLIER -- Adjust this value to change the throwing force
local Handle = Model.Handle -- Assuming the net's handle is named "Handle"
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.Velocity = (MousePosition - Handle.Position).unit * throwForce + Vector3.new(0,50,0)
BodyVelocity.P = math.huge -- Sets linear damping to zero so the net doesn't slow down over time
BodyVelocity.Parent = Handle
local Connection
-- Connect touch function, trip enemy
Connection = Handle.Touched:Connect(function(hit)
if hit:IsDescendantOf(workspace.Enemies) and hit.Parent:FindFirstChild("Humanoid") then
local VictimCharacter = hit.Parent
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
Connection:Disconnect()
Ragdoll.Toggle(VictimCharacter)
Model:Destroy()
-- Clone ServerStorage.Models.NetDisplay above the enemy to simulate the net falling on top of it, use its handle to cframe it
-- This will be the visual representation of the net trapping the enemy
local NetDisplay = ServerStorage.Models.NetDisplay:Clone()
NetDisplay.Parent = workspace.Debris
NetDisplay:MoveTo((VictimCharacter.HumanoidRootPart.CFrame * CFrame.new(0,5,0)).Position)
--game.Debris:AddItem(NetDisplay, 10)
end
end)
-- Optionally, you can remove the BodyVelocity after a certain amount of time
local removeDelay = .5 -- Adjust this value to change the delay before removing the BodyVelocity
wait(removeDelay)
BodyVelocity:Destroy()
task.wait(5)
Display.Parent = Net
end
Tool.Z = function(Character)
print("hai Z")
end
Tool.X = function(Character)
print("hai X")
end
return Tool
|
--[[Leaning]] | --
Tune.LeanSpeed = .07 -- How quickly the the bike will lean, .01 being slow, 1 being almost instantly
Tune.LeanProgressiveness = 30 -- How much steering is kept at higher speeds, a lower number is less steering, a higher number is more steering
Tune.MaxLean = 45 -- Maximum lean angle in degrees
Tune.LeanD = 90 -- Dampening of the lean
Tune.LeanMaxTorque = 500 -- Force of the lean
Tune.LeanP = 300 -- Aggressiveness of the lean
|
--[[
Calls a given callback on some specified interval until the
clear function is called.
The callback is given deltaTime since it was last called, along
with any extra parameters passed to setInterval.
The first callback call is made after intervalSeconds passes,
i.e. it is not immediate.
--]] |
local function setInterval(callback: (number, ...any) -> nil, intervalSeconds: number, ...: any)
local cleared = false
local function call(scheduledTime: number, ...: any)
if cleared then
return
end
local deltaTime = os.clock() - scheduledTime
task.spawn(callback, deltaTime, ...)
task.delay(intervalSeconds, call, os.clock(), ...)
end
local function clear()
cleared = true
end
task.delay(intervalSeconds, call, os.clock(), ...)
return clear
end
return setInterval
|
------------------------- |
function DoorClose()
if Shaft00.MetalDoor.CanCollide == false then
Shaft00.MetalDoor.CanCollide = true
while Shaft00.MetalDoor.Transparency > 0.0 do
Shaft00.MetalDoor.Transparency = Shaft00.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0) --Change 10 to change the speed.
end
if Shaft01.MetalDoor.CanCollide == false then
Shaft01.MetalDoor.CanCollide = true
while Shaft01.MetalDoor.Transparency > 0.0 do
Shaft01.MetalDoor.Transparency = Shaft01.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft02.MetalDoor.CanCollide == false then
Shaft02.MetalDoor.CanCollide = true
while Shaft02.MetalDoor.Transparency > 0.0 do
Shaft02.MetalDoor.Transparency = Shaft02.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft03.MetalDoor.CanCollide == false then
Shaft03.MetalDoor.CanCollide = true
while Shaft03.MetalDoor.Transparency > 0.0 do
Shaft03.MetalDoor.Transparency = Shaft03.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft04.MetalDoor.CanCollide == false then
Shaft04.MetalDoor.CanCollide = true
while Shaft04.MetalDoor.Transparency > 0.0 do
Shaft04.MetalDoor.Transparency = Shaft04.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft05.MetalDoor.CanCollide == false then
Shaft05.MetalDoor.CanCollide = true
while Shaft05.MetalDoor.Transparency > 0.0 do
Shaft05.MetalDoor.Transparency = Shaft05.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft06.MetalDoor.CanCollide == false then
Shaft06.MetalDoor.CanCollide = true
while Shaft06.MetalDoor.Transparency > 0.0 do
Shaft06.MetalDoor.Transparency = Shaft06.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft07.MetalDoor.CanCollide == false then
Shaft07.MetalDoor.CanCollide = true
while Shaft07.MetalDoor.Transparency > 0.0 do
Shaft07.MetalDoor.Transparency = Shaft07.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft08.MetalDoor.CanCollide == false then
Shaft08.MetalDoor.CanCollide = true
while Shaft08.MetalDoor.Transparency > 0.0 do
Shaft08.MetalDoor.Transparency = Shaft08.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft09.MetalDoor.CanCollide == false then
Shaft09.MetalDoor.CanCollide = true
while Shaft09.MetalDoor.Transparency > 0.0 do
Shaft09.MetalDoor.Transparency = Shaft09.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft10.MetalDoor.CanCollide == false then
Shaft10.MetalDoor.CanCollide = true
while Shaft10.MetalDoor.Transparency > 0.0 do
Shaft10.MetalDoor.Transparency = Shaft10.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft11.MetalDoor.CanCollide == false then
Shaft11.MetalDoor.CanCollide = true
while Shaft11.MetalDoor.Transparency > 0.0 do
Shaft11.MetalDoor.Transparency = Shaft11.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft12.MetalDoor.CanCollide == false then
Shaft12.MetalDoor.CanCollide = true
while Shaft12.MetalDoor.Transparency > 0.0 do
Shaft12.MetalDoor.Transparency = Shaft12.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft13.MetalDoor.CanCollide == false then
Shaft13.MetalDoor.CanCollide = true
while Shaft13.MetalDoor.Transparency > 0.0 do
Shaft13.MetalDoor.Transparency = Shaft13.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
end
function onClicked()
DoorClose()
end
script.Parent.MouseButton1Click:connect(onClicked)
script.Parent.MouseButton1Click:connect(function()
if clicker == true
then clicker = false
else
return
end
end)
script.Parent.MouseButton1Click:connect(function()
Car.Touched:connect(function(otherPart)
if otherPart == Elevator.Floors:FindFirstChild(script.Parent.Name)
then StopE() DoorOpen()
end
end)end)
function StopE()
Car.BodyVelocity.velocity = Vector3.new(0, 0, 0)
Car.BodyPosition.position = Elevator.Floors:FindFirstChild(script.Parent.Name).Position
clicker = true
end
function DoorOpen()
while Shaft10.MetalDoor.Transparency < 1.0 do
Shaft10.MetalDoor.Transparency = Shaft10.MetalDoor.Transparency + .1
wait(0.000001)
end
Shaft10.MetalDoor.CanCollide = false
end
|
------------------------------------------------------------------------------
---------- This code tries to load dynamically into an ongoing show ---------- |
local timeUntilNextShow, timeIntoShow = calculateShowTimes()
local shouldLoadPSV = true
for _,scene in ipairs(SHOW_SCENES) do
local sceneLength = scene:GetAttribute("TimeLength")
if timeIntoShow then
if timeIntoShow < sceneLength then
-- Jump into mid scene of show
EventSequencer.loadScene(scene.Name, timeIntoShow)
shouldLoadPSV = false
break
else
timeIntoShow = timeIntoShow - sceneLength
end
end
end
if shouldLoadPSV then
loadPreShowVenue()
end
|
--[=[
@tag Component
@param config ComponentConfig
@return ComponentClass
Create a new custom Component class.
```lua
local MyComponent = Component.new({Tag = "MyComponent"})
```
A full example might look like this:
```lua
local MyComponent = Component.new({
Tag = "MyComponent",
Ancestors = {workspace},
Extensions = {Logger}, -- See Logger example within the example for the Extension type
})
local AnotherComponent = require(somewhere.AnotherComponent)
-- Optional if UpdateRenderStepped should use BindToRenderStep:
MyComponent.RenderPriority = Enum.RenderPriority.Camera.Value
function MyComponent:Construct()
self.MyData = "Hello"
end
function MyComponent:Start()
local another = self:GetComponent(AnotherComponent)
another:DoSomething()
end
function MyComponent:Stop()
self.MyData = "Goodbye"
end
function MyComponent:HeartbeatUpdate(dt)
end
function MyComponent:SteppedUpdate(dt)
end
function MyComponent:RenderSteppedUpdate(dt)
end
```
]=] |
function Component.new(config: ComponentConfig)
local customComponent = {}
customComponent.__index = customComponent
customComponent.__tostring = function()
return "Component<" .. config.Tag .. ">"
end
customComponent[KEY_ANCESTORS] = config.Ancestors or DEFAULT_ANCESTORS
customComponent[KEY_INST_TO_COMPONENTS] = {}
customComponent[KEY_COMPONENTS] = {}
customComponent[KEY_LOCK_CONSTRUCT] = {}
customComponent[KEY_TROVE] = Trove.new()
customComponent[KEY_EXTENSIONS] = config.Extensions or {}
customComponent[KEY_STARTED] = false
customComponent.Tag = config.Tag
customComponent.Started = customComponent[KEY_TROVE]:Construct(Signal)
customComponent.Stopped = customComponent[KEY_TROVE]:Construct(Signal)
setmetatable(customComponent, Component)
customComponent:_setup()
return customComponent
end
function Component:_instantiate(instance: Instance)
local component = setmetatable({}, self)
component.Instance = instance
component[KEY_ACTIVE_EXTENSIONS] = GetActiveExtensions(component, self[KEY_EXTENSIONS])
if not ShouldConstruct(component) then
return nil
end
InvokeExtensionFn(component, "Constructing")
if type(component.Construct) == "function" then
component:Construct()
end
InvokeExtensionFn(component, "Constructed")
return component
end
function Component:_setup()
local watchingInstances = {}
local function StartComponent(component)
InvokeExtensionFn(component, "Starting")
component:Start()
InvokeExtensionFn(component, "Started")
local hasHeartbeatUpdate = typeof(component.HeartbeatUpdate) == "function"
local hasSteppedUpdate = typeof(component.SteppedUpdate) == "function"
local hasRenderSteppedUpdate = typeof(component.RenderSteppedUpdate) == "function"
if hasHeartbeatUpdate then
component._heartbeatUpdate = RunService.Heartbeat:Connect(function(dt)
component:HeartbeatUpdate(dt)
end)
end
if hasSteppedUpdate then
component._steppedUpdate = RunService.Stepped:Connect(function(_, dt)
component:SteppedUpdate(dt)
end)
end
if hasRenderSteppedUpdate and not IS_SERVER then
if component.RenderPriority then
component._renderName = NextRenderName()
RunService:BindToRenderStep(component._renderName, component.RenderPriority, function(dt)
component:RenderSteppedUpdate(dt)
end)
else
component._renderSteppedUpdate = RunService.RenderStepped:Connect(function(dt)
component:RenderSteppedUpdate(dt)
end)
end
end
component[KEY_STARTED] = true
self.Started:Fire(component)
end
local function StopComponent(component)
if component._heartbeatUpdate then
component._heartbeatUpdate:Disconnect()
end
if component._steppedUpdate then
component._steppedUpdate:Disconnect()
end
if component._renderSteppedUpdate then
component._renderSteppedUpdate:Disconnect()
elseif component._renderName then
RunService:UnbindFromRenderStep(component._renderName)
end
InvokeExtensionFn(component, "Stopping")
component:Stop()
InvokeExtensionFn(component, "Stopped")
self.Stopped:Fire(component)
end
local function SafeConstruct(instance, id)
if self[KEY_LOCK_CONSTRUCT][instance] ~= id then
return nil
end
local component = self:_instantiate(instance)
if self[KEY_LOCK_CONSTRUCT][instance] ~= id then
return nil
end
return component
end
local function TryConstructComponent(instance)
if self[KEY_INST_TO_COMPONENTS][instance] then return end
local id = self[KEY_LOCK_CONSTRUCT][instance] or 0
id += 1
self[KEY_LOCK_CONSTRUCT][instance] = id
task.defer(function()
local component = SafeConstruct(instance, id)
if not component then
return
end
self[KEY_INST_TO_COMPONENTS][instance] = component
table.insert(self[KEY_COMPONENTS], component)
task.defer(function()
if self[KEY_INST_TO_COMPONENTS][instance] == component then
StartComponent(component)
end
end)
end)
end
local function TryDeconstructComponent(instance)
local component = self[KEY_INST_TO_COMPONENTS][instance]
if not component then return end
self[KEY_INST_TO_COMPONENTS][instance] = nil
self[KEY_LOCK_CONSTRUCT][instance] = nil
local components = self[KEY_COMPONENTS]
local index = table.find(components, component)
if index then
local n = #components
components[index] = components[n]
components[n] = nil
end
if component[KEY_STARTED] then
task.spawn(StopComponent, component)
end
end
local function StartWatchingInstance(instance)
if watchingInstances[instance] then return end
local function IsInAncestorList(): boolean
for _,parent in ipairs(self[KEY_ANCESTORS]) do
if instance:IsDescendantOf(parent) then
return true
end
end
return false
end
local ancestryChangedHandle = self[KEY_TROVE]:Connect(instance.AncestryChanged, function(_, parent)
if parent and IsInAncestorList() then
TryConstructComponent(instance)
else
TryDeconstructComponent(instance)
end
end)
watchingInstances[instance] = ancestryChangedHandle
if IsInAncestorList() then
TryConstructComponent(instance)
end
end
local function InstanceTagged(instance: Instance)
StartWatchingInstance(instance)
end
local function InstanceUntagged(instance: Instance)
local watchHandle = watchingInstances[instance]
if watchHandle then
watchHandle:Disconnect()
watchingInstances[instance] = nil
end
TryDeconstructComponent(instance)
end
self[KEY_TROVE]:Connect(CollectionService:GetInstanceAddedSignal(self.Tag), InstanceTagged)
self[KEY_TROVE]:Connect(CollectionService:GetInstanceRemovedSignal(self.Tag), InstanceUntagged)
local tagged = CollectionService:GetTagged(self.Tag)
for _,instance in ipairs(tagged) do
task.defer(InstanceTagged, instance)
end
end
|
-- This is an overloaded function for TransparencyController:SetupTransparency(character)
-- Do not call directly, or it will throw an assertion! |
function FpsCamera:SetupTransparency(character, ...)
assert(self ~= FpsCamera)
self:BaseSetupTransparency(character, ...)
if self.AttachmentListener then
self.AttachmentListener:Disconnect()
end
self.AttachmentListener = character.DescendantAdded:Connect(function (obj)
if obj:IsA("Attachment") and self.HeadAttachments[obj.Name] then
if typeof(self.cachedParts) == "table" then
self.cachedParts[obj.Parent] = true
end
if self.transparencyDirty ~= nil then
self.transparencyDirty = true
end
end
end)
end
|
--[[Misc]] |
Tune.LoadDelay = .1 -- Delay before initializing chassis (in seconds)
Tune.AutoStart = false -- Set to false if using manual ignition plugin
Tune.AutoFlip = false -- Set to false if using manual flip plugin
|
-- functions |
local function Raycast(ray, ignore)
ignore = ignore or {}
local hit, position, normal
local success = false
repeat
hit, position, normal = Workspace:FindPartOnRayWithIgnoreList(ray, ignore)
if hit then
if hit.Parent:FindFirstChildOfClass("Humanoid") then
success = true
elseif hit.CanCollide and hit.Transparency ~= 1 then
success = true
else
table.insert(ignore, hit)
end
else
success = true
end
until success
return hit, position, normal
end
local function KillProjectile(projectile)
if projectile.Splash then
REMOTES.Effect:FireAllClients(projectile.SplashEffect, projectile.Position, projectile.SplashRadius)
end
REMOTES.Projectile:FireAllClients("Kill", projectile.ID)
for i, p in pairs(projectiles) do
if p == projectile then
table.remove(projectiles, i)
break
end
end
if projectile.Splash then
local region = Region3.new(projectile.Position + Vector3.new(-1, -1, -1) * projectile.SplashRadius, projectile.Position + Vector3.new(1, 1, 1) * projectile.SplashRadius)
local parts = Workspace:FindPartsInRegion3WithIgnoreList(region, {Workspace.Effects}, 100)
for _, part in pairs(parts) do
if part.Name == "HumanoidRootPart" then
local humanoid = part.Parent:FindFirstChildOfClass("Humanoid")
if humanoid then
local hitPlayer = Players:GetPlayerFromCharacter(humanoid.Parent)
if hitPlayer == projectile.Owner or DAMAGE:PlayerCanDamage(projectile.Owner, humanoid) then
if humanoid.Health > 0 then
local distance = (part.Position - projectile.Position).Magnitude
if distance < projectile.SplashRadius then
local down = humanoid:FindFirstChild("Down")
local alreadyDowned = false
if down then
alreadyDowned = down.Value
end
local amount = math.cos((distance / projectile.SplashRadius)^2 * (math.pi / 2))
local damage = math.ceil(amount * projectile.Damage)
local player = Players:GetPlayerFromCharacter(humanoid.Parent)
local direction = (part.Position - projectile.Position).Unit
if player then
REMOTES.HitIndicator:FireClient(player, direction, damage)
end
if projectile.Owner then
REMOTES.Hitmarker:FireClient(projectile.Owner, part.Position, damage, humanoid:FindFirstChild("Armor") and humanoid.Armor.Value > 0, false)
end
DAMAGE:Damage(humanoid, damage, projectile.Owner)
if humanoid.Health <= 0 then
for _, part in pairs(humanoid.Parent:GetChildren()) do
if part:IsA("BasePart") then
part.Velocity = direction * damage * 2
end
end
local killDist = math.floor((projectile.StartPosition - part.Position).Magnitude + 0.5)
STAT_SCRIPT.FurthestKill:Fire(projectile.Owner, killDist)
REMOTES.Killfeed:FireAllClients(projectile.Owner.Name, humanoid.Parent.Name, projectile.Model, killDist)
end
end
end
end
end
end
end
end
end
local function UpdateProjectile(projectile, deltaTime)
projectile.Velocity = projectile.Velocity + Vector3.new(0, -projectile.Gravity * deltaTime, 0)
local ray = Ray.new(projectile.Position, projectile.Velocity * deltaTime)
local hit, position = Raycast(ray, projectile.Ignore)
projectile.Position = position
--projectile.Debug.CFrame = CFrame.new(projectile.Position)
if hit then
return false
end
return true
end
local function Projectile(player, item, id, position, direction)
local ping = pings[player] and pings[player].Average or 0
local config = CONFIG:GetConfig(item)
local projectile = PROJECTILE:Create(config.Projectile, id)
projectile.Position = position
projectile.Velocity = direction.Unit * projectile.Speed
projectile.Damage = config.Damage
projectile.Owner = player
projectile.StartPosition = position
if player.Character then
table.insert(projectile.Ignore, player.Character)
end
--[[local de = Instance.new("Part")
de.Anchored = true
de.CanCollide = false
de.Size = Vector3.new(1, 1, 1)
de.Material = Enum.Material.Neon
de.Parent = workspace
projectile.Debug = de]]
table.insert(projectiles, projectile)
local alive = UpdateProjectile(projectile, ping)
if alive then
for _, p in pairs(Players:GetPlayers()) do
if p ~= player then
REMOTES.Projectile:FireClient(p, "Create", player, item, id, position, direction)
end
end
else
KillProjectile(projectile)
end
end
|
--local tk = cr.Misc.TK |
local vl = script.Parent.Values
local GBrake = vl.Brake
local gr = vl.Gear
local bk = vl.Brake.Value
|
-----------------
--| Variables |--
----------------- |
local DebrisService = Game:GetService('Debris')
local PlayersService = Game:GetService('Players')
local Tool = script.Parent
local ToolHandle = Tool.Handle
local RocketScript = WaitForChild(script, 'Rocket')
local SwooshSound = WaitForChild(script, 'Swoosh')
local BoomSound = WaitForChild(script, 'Boom')
local ReloadSound = WaitForChild(ToolHandle, 'ReloadSound')
local MyModel = nil
local MyPlayer = nil
local BaseRocket = nil
local RocketClone = nil
|
-- Where ever it says "ATM" put your GUI name in there | |
--[[ Public API ]] | --
function DPad:Enable()
DPadFrame.Visible = true
end
function DPad:Disable()
DPadFrame.Visible = false
OnInputEnded()
end
function DPad:Create(parentFrame)
if DPadFrame then
DPadFrame:Destroy()
DPadFrame = nil
end
local position = UDim2.new(0, 10, 1, -230)
DPadFrame = Instance.new('Frame')
DPadFrame.Name = "DPadFrame"
DPadFrame.Active = true
DPadFrame.Visible = false
DPadFrame.Size = UDim2.new(0, 192, 0, 192)
DPadFrame.Position = position
DPadFrame.BackgroundTransparency = 1
local smArrowSize = UDim2.new(0, 23, 0, 23)
local lgArrowSize = UDim2.new(0, 64, 0, 64)
local smImgOffset = Vector2.new(46, 46)
local lgImgOffset = Vector2.new(128, 128)
local bBtn = createArrowLabel("BackButton", UDim2.new(0.5, -32, 1, -64), lgArrowSize, Vector2.new(0, 0), lgImgOffset)
local fBtn = createArrowLabel("ForwardButton", UDim2.new(0.5, -32, 0, 0), lgArrowSize, Vector2.new(0, 258), lgImgOffset)
local lBtn = createArrowLabel("LeftButton", UDim2.new(0, 0, 0.5, -32), lgArrowSize, Vector2.new(129, 129), lgImgOffset)
local rBtn = createArrowLabel("RightButton", UDim2.new(1, -64, 0.5, -32), lgArrowSize, Vector2.new(0, 129), lgImgOffset)
local jumpBtn = createArrowLabel("JumpButton", UDim2.new(0.5, -32, 0.5, -32), lgArrowSize, Vector2.new(129, 0), lgImgOffset)
local flBtn = createArrowLabel("ForwardLeftButton", UDim2.new(0, 35, 0, 35), smArrowSize, Vector2.new(129, 258), smImgOffset)
local frBtn = createArrowLabel("ForwardRightButton", UDim2.new(1, -55, 0, 35), smArrowSize, Vector2.new(176, 258), smImgOffset)
flBtn.Visible = false
frBtn.Visible = false
-- input connections
jumpBtn.InputBegan:connect(function(inputObject)
MasterControl:DoJump()
end)
local movementVector = Vector3.new(0,0,0)
local function normalizeDirection(inputPosition)
local jumpRadius = jumpBtn.AbsoluteSize.x/2
local centerPosition = getCenterPosition()
local direction = Vector2.new(inputPosition.x - centerPosition.x, inputPosition.y - centerPosition.y)
if direction.magnitude > jumpRadius then
local angle = ATAN2(direction.y, direction.x)
local octant = (FLOOR(8 * angle / (2 * PI) + 8.5)%8) + 1
movementVector = COMPASS_DIR[octant]
end
if not flBtn.Visible and movementVector == COMPASS_DIR[7] then
flBtn.Visible = true
frBtn.Visible = true
end
end
DPadFrame.InputBegan:connect(function(inputObject)
if TouchObject or inputObject.UserInputType ~= Enum.UserInputType.Touch then
return
end
MasterControl:AddToPlayerMovement(-movementVector)
TouchObject = inputObject
normalizeDirection(TouchObject.Position)
MasterControl:AddToPlayerMovement(movementVector)
end)
DPadFrame.InputChanged:connect(function(inputObject)
if inputObject == TouchObject then
MasterControl:AddToPlayerMovement(-movementVector)
normalizeDirection(TouchObject.Position)
MasterControl:AddToPlayerMovement(movementVector)
MasterControl:SetIsJumping(false)
end
end)
OnInputEnded = function()
TouchObject = nil
flBtn.Visible = false
frBtn.Visible = false
MasterControl:AddToPlayerMovement(-movementVector)
movementVector = Vector3.new(0, 0, 0)
end
DPadFrame.InputEnded:connect(function(inputObject)
if inputObject == TouchObject then
OnInputEnded()
end
end)
GuiService.MenuOpened:connect(function()
if TouchObject then
OnInputEnded()
end
end)
DPadFrame.Parent = parentFrame
end
return DPad
|
--[[
A symbol for representing nil values in contexts where nil is not usable.
]] |
local Package = script.Parent.Parent
local Types = require(Package.Types)
return {
type = "Symbol",
name = "None"
} :: Types.None
|
--lights |
local Red1 = script.Parent.Red1
local Red2 = script.Parent.Red2
local RL = script.Parent.RL
local RR = script.Parent.RR
local FL = script.Parent.FL
local FR = script.Parent.FR
local f1 = script.Parent.WhiteFront
local f2 = script.Parent.WhiteFront2
local r1 = script.Parent.WhiteBack
local r2 = script.Parent.WhiteBack2
local B1 = script.Parent.Brake
local B2 = script.Parent.Brake2
local lgt = script.Parent.Lighting.Light
local lgtsalon = script.Parent.salon.Light
function lightson()
f1.Material = "Neon"
f2.Material = "Neon"
Red1.Material = "Neon"
Red2.Material = "Neon"
lgt.Enabled = true
lgtsalon.Enabled = true
end
function lightsoff()
f1.Material = "SmoothPlastic"
f2.Material = "SmoothPlastic"
Red1.Material = "SmoothPlastic"
Red2.Material = "SmoothPlastic"
lgt.Enabled = false
lgtsalon.Enabled = false
end
function reverse()
r1.Material = "Neon"
r2.Material = "Neon"
end
function unreverse()
r1.Material = "SmoothPlastic"
r2.Material = "SmoothPlastic"
end
function brake()
B1.Material = "Neon"
B2.Material = "Neon"
end
function unbrake()
B1.Material = "SmoothPlastic"
B2.Material = "SmoothPlastic"
end
|
--Weld stuff here |
MakeWeld(car.Misc.LMIRR.Handle,car.DriveSeat,"Motor",.1).Name="M"
ModelWeld(car.Misc.LMIRR,car.Misc.LMIRR.Handle)
MakeWeld(car.Misc.RMIRR.Handle,car.DriveSeat,"Motor",.1).Name="M"
ModelWeld(car.Misc.RMIRR,car.Misc.RMIRR.Handle)
|
-- Core selection system |
Selection = {};
Selection.Items = {};
Selection.ItemIndex = {};
Selection.Outlines = {};
Selection.Color = BrickColor.new 'Cyan';
Selection.Multiselecting = false;
|
--//Name Updater |
local Module = script.Parent.Parent.Parent.Parent.Parent.Settings
local Modulee = require(Module)
local Name = Modulee.CurrencyName
script.Parent.Name = Name.." : "..script.Parent.Parent.Parent.CurrencyToCollect.Value
script.Parent.Parent.Parent.CurrencyToCollect.Changed:connect(function()
script.Parent.Name = Name.." : "..script.Parent.Parent.Parent.CurrencyToCollect.Value
end)
|
-- Variables: |
local boat = script.Parent.Parent
local Animations = boat.Parent.Animations
local MainModel = boat.Main_Model
local MainPart = MainModel.MAIN
local PartsModel = boat.Parts
local GearShiftSound = MainPart.GearShift
local Values = MainModel.Values
local EngineOnVal = Values.EngineOn
local ThrustVal = Values.Thrust
local InWaterVal = Values.InWater
local BoatControlActivated = true
local EngineOn = false
local ReducingSpeed = false
local Thrust = 0
local TurnAngle = 0
local neutral = false
local SideThrusterSpeed = 0
|
--!strict |
local Array = script.Parent.Parent
local LuauPolyfill = Array.Parent
local types = require(LuauPolyfill.types)
type Object = types.Object
type Array<T> = types.Array<T>
type mapFn<T, U> = (element: T, index: number) -> U
type mapFnWithThisArg<T, U> = (thisArg: any, element: T, index: number) -> U
return function<T, U>(
value: Array<T>,
mapFn: (mapFn<T, U> | mapFnWithThisArg<T, U>)?,
thisArg: Object?
-- FIXME Luau: need overloading so the return type on this is more sane and doesn't require manual casts
): Array<U> | Array<T> | Array<string>
local array = {}
if mapFn then
local arrayLength = #(value :: Array<T>)
array = table.create(arrayLength)
for i = 1, arrayLength do
if thisArg ~= nil then
(array :: Array<U>)[i] = (mapFn :: mapFnWithThisArg<T, U>)(thisArg, (value :: Array<T>)[i], i)
else
(array :: Array<U>)[i] = (mapFn :: mapFn<T, U>)((value :: Array<T>)[i], i)
end
end
else
array = table.clone(value :: Array<T>)
end
return array
end
|
--------------------------------------------------------------- |
function onChildAdded(child)
if child.Name == "SeatWeld" then
local human = child.part1.Parent:findFirstChild("Humanoid")
if (human ~= nil) then
print("Human IN")
seat.SirenPanel.Control.CarName.Value = human.Parent.Name.."'s Car"
seat.Parent.Name = human.Parent.Name.."'s Car"
s.Parent.SirenPanel:clone().Parent = game.Players:findFirstChild(human.Parent.Name).PlayerGui
end
end
end
function onChildRemoved(child)
if (child.Name == "SeatWeld") then
local human = child.part1.Parent:findFirstChild("Humanoid")
if (human ~= nil) then
print("Human OUT")
seat.Parent.Name = "Empty Car"
seat.SirenPanel.Control.CarName.Value = "Empty Car"
game.Players:findFirstChild(human.Parent.Name).PlayerGui.SirenPanel:remove()
end
end
end
script.Parent.ChildAdded:connect(onChildAdded)
script.Parent.ChildRemoved:connect(onChildRemoved)
|
-- ================================================================================
-- Settings - Speedster
-- ================================================================================ |
local Settings = {}
Settings.DefaultSpeed = 125 -- Speed when not boosted [Studs/second, Range 50-300]
Settings.BoostSpeed = 200 -- Speed when boosted [Studs/second, Maximum: 400]
Settings.BoostAmount = 6 -- Duration of boost in seconds
Settings.Steering = 5 -- How quickly the speeder turns [Range: 1-10] |
--[[Wheel Alignment]] |
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
Tune.FCamber = 2
Tune.RCamber = -1
Tune.FToe = 0
Tune.RToe = 0
|
--[=[
Works line combineLatest, but allow the transformation of a brio into an observable
that emits the value, and then nil, on death.
The issue here is this:
1. Resources are found with combineLatest()
2. One resource dies
3. All resources are invalidated
4. We still wanted to be able to use most of the resources
With this method we are able to do this, as we'll re-emit a table with all resoruces
except the invalidated one.
@since 3.6.0
@param observables { [any]: Observable<Brio<T>> | Observable<T> | T }
@return Observable<{ [any]: T? }>
]=] |
function RxBrioUtils.flatCombineLatest(observables)
assert(type(observables) == "table", "Bad observables")
local newObservables = {}
for key, observable in pairs(observables) do
if Observable.isObservable(observable) then
newObservables[key] = RxBrioUtils.flattenToValueAndNil(observable)
else
newObservables[key] = observable
end
end
return Rx.combineLatest(newObservables)
end
|
-----------------------------------PATHER-------------------------------------- |
local function Pather(endPoint, surfaceNormal, overrideUseDirectPath)
local this = {}
local directPathForHumanoid
local directPathForVehicle
if overrideUseDirectPath ~= nil then
directPathForHumanoid = overrideUseDirectPath
directPathForVehicle = overrideUseDirectPath
else
directPathForHumanoid = UseDirectPath
directPathForVehicle = UseDirectPathForVehicle
end
this.Cancelled = false
this.Started = false
this.Finished = Instance.new("BindableEvent")
this.PathFailed = Instance.new("BindableEvent")
this.PathComputing = false
this.PathComputed = false
this.OriginalTargetPoint = endPoint
this.TargetPoint = endPoint
this.TargetSurfaceNormal = surfaceNormal
this.DiedConn = nil
this.SeatedConn = nil
this.BlockedConn = nil
this.TeleportedConn = nil
this.CurrentPoint = 0
this.HumanoidOffsetFromPath = ZERO_VECTOR3
this.CurrentWaypointPosition = nil
this.CurrentWaypointPlaneNormal = ZERO_VECTOR3
this.CurrentWaypointPlaneDistance = 0
this.CurrentWaypointNeedsJump = false;
this.CurrentHumanoidPosition = ZERO_VECTOR3
this.CurrentHumanoidVelocity = 0
this.NextActionMoveDirection = ZERO_VECTOR3
this.NextActionJump = false
this.Timeout = 0
this.Humanoid = findPlayerHumanoid(Player)
this.OriginPoint = nil
this.AgentCanFollowPath = false
this.DirectPath = false
this.DirectPathRiseFirst = false
local rootPart = this.Humanoid and this.Humanoid.RootPart
if rootPart then
-- Setup origin
this.OriginPoint = rootPart.CFrame.p
-- Setup agent
local agentRadius = 2
local agentHeight = 5
local agentCanJump = true
local seat = this.Humanoid.SeatPart
if seat and seat:IsA("VehicleSeat") then
-- Humanoid is seated on a vehicle
local vehicle = seat:FindFirstAncestorOfClass("Model")
if vehicle then
-- Make sure the PrimaryPart is set to the vehicle seat while we compute the extends.
local tempPrimaryPart = vehicle.PrimaryPart
vehicle.PrimaryPart = seat
-- For now, only direct path
if directPathForVehicle then
local extents = vehicle:GetExtentsSize()
agentRadius = AgentSizeIncreaseFactor * 0.5 * math.sqrt(extents.X * extents.X + extents.Z * extents.Z)
agentHeight = AgentSizeIncreaseFactor * extents.Y
agentCanJump = false
this.AgentCanFollowPath = true
this.DirectPath = directPathForVehicle
end
-- Reset PrimaryPart
vehicle.PrimaryPart = tempPrimaryPart
end
else
local extents
if FFlagUserExcludeNonCollidableForPathfinding then
local character = GetCharacter()
if character ~= nil then
extents = getCollidableExtentsSize(character)
end
end
if extents == nil then
extents = GetCharacter():GetExtentsSize()
end
agentRadius = AgentSizeIncreaseFactor * 0.5 * math.sqrt(extents.X * extents.X + extents.Z * extents.Z)
agentHeight = AgentSizeIncreaseFactor * extents.Y
agentCanJump = (this.Humanoid.JumpPower > 0)
this.AgentCanFollowPath = true
this.DirectPath = directPathForHumanoid
this.DirectPathRiseFirst = this.Humanoid.Sit
end
-- Build path object
this.pathResult = PathfindingService:CreatePath({AgentRadius = agentRadius, AgentHeight = agentHeight, AgentCanJump = agentCanJump})
end
function this:Cleanup()
if this.stopTraverseFunc then
this.stopTraverseFunc()
this.stopTraverseFunc = nil
end
if this.MoveToConn then
this.MoveToConn:Disconnect()
this.MoveToConn = nil
end
if this.BlockedConn then
this.BlockedConn:Disconnect()
this.BlockedConn = nil
end
if this.DiedConn then
this.DiedConn:Disconnect()
this.DiedConn = nil
end
if this.SeatedConn then
this.SeatedConn:Disconnect()
this.SeatedConn = nil
end
if this.TeleportedConn then
this.TeleportedConn:Disconnect()
this.TeleportedConn = nil
end
this.Started = false
end
function this:Cancel()
this.Cancelled = true
this:Cleanup()
end
function this:IsActive()
return this.AgentCanFollowPath and this.Started and not this.Cancelled
end
function this:OnPathInterrupted()
-- Stop moving
this.Cancelled = true
this:OnPointReached(false)
end
function this:ComputePath()
if this.OriginPoint then
if this.PathComputed or this.PathComputing then return end
this.PathComputing = true
if this.AgentCanFollowPath then
if this.DirectPath then
this.pointList = {
PathWaypoint.new(this.OriginPoint, Enum.PathWaypointAction.Walk),
PathWaypoint.new(this.TargetPoint, this.DirectPathRiseFirst and Enum.PathWaypointAction.Jump or Enum.PathWaypointAction.Walk)
}
this.PathComputed = true
else
this.pathResult:ComputeAsync(this.OriginPoint, this.TargetPoint)
this.pointList = this.pathResult:GetWaypoints()
this.BlockedConn = this.pathResult.Blocked:Connect(function(blockedIdx) this:OnPathBlocked(blockedIdx) end)
this.PathComputed = this.pathResult.Status == Enum.PathStatus.Success
end
end
this.PathComputing = false
end
end
function this:IsValidPath()
this:ComputePath()
return this.PathComputed and this.AgentCanFollowPath
end
this.Recomputing = false
function this:OnPathBlocked(blockedWaypointIdx)
local pathBlocked = blockedWaypointIdx >= this.CurrentPoint
if not pathBlocked or this.Recomputing then
return
end
this.Recomputing = true
if this.stopTraverseFunc then
this.stopTraverseFunc()
this.stopTraverseFunc = nil
end
this.OriginPoint = this.Humanoid.RootPart.CFrame.p
this.pathResult:ComputeAsync(this.OriginPoint, this.TargetPoint)
this.pointList = this.pathResult:GetWaypoints()
if #this.pointList > 0 then
this.HumanoidOffsetFromPath = this.pointList[1].Position - this.OriginPoint
end
this.PathComputed = this.pathResult.Status == Enum.PathStatus.Success
if ShowPath then
this.stopTraverseFunc, this.setPointFunc = ClickToMoveDisplay.CreatePathDisplay(this.pointList)
end
if this.PathComputed then
this.CurrentPoint = 1 -- The first waypoint is always the start location. Skip it.
this:OnPointReached(true) -- Move to first point
else
this.PathFailed:Fire()
this:Cleanup()
end
this.Recomputing = false
end
function this:OnRenderStepped(dt)
if this.Started and not this.Cancelled then
-- Check for Timeout (if a waypoint is not reached within the delay, we fail)
this.Timeout = this.Timeout + dt
if this.Timeout > UnreachableWaypointTimeout then
this:OnPointReached(false)
return
end
-- Get Humanoid position and velocity
this.CurrentHumanoidPosition = this.Humanoid.RootPart.Position + this.HumanoidOffsetFromPath
this.CurrentHumanoidVelocity = this.Humanoid.RootPart.Velocity
-- Check if it has reached some waypoints
while this.Started and this:IsCurrentWaypointReached() do
this:OnPointReached(true)
end
-- If still started, update actions
if this.Started then
-- Move action
this.NextActionMoveDirection = this.CurrentWaypointPosition - this.CurrentHumanoidPosition
if this.NextActionMoveDirection.Magnitude > ALMOST_ZERO then
this.NextActionMoveDirection = this.NextActionMoveDirection.Unit
else
this.NextActionMoveDirection = ZERO_VECTOR3
end
-- Jump action
if this.CurrentWaypointNeedsJump then
this.NextActionJump = true
this.CurrentWaypointNeedsJump = false -- Request jump only once
else
this.NextActionJump = false
end
end
end
end
function this:IsCurrentWaypointReached()
local reached = false
-- Check we do have a plane, if not, we consider the waypoint reached
if this.CurrentWaypointPlaneNormal ~= ZERO_VECTOR3 then
-- Compute distance of Humanoid from destination plane
local dist = this.CurrentWaypointPlaneNormal:Dot(this.CurrentHumanoidPosition) - this.CurrentWaypointPlaneDistance
-- Compute the component of the Humanoid velocity that is towards the plane
local velocity = -this.CurrentWaypointPlaneNormal:Dot(this.CurrentHumanoidVelocity)
-- Compute the threshold from the destination plane based on Humanoid velocity
local threshold = math.max(1.0, 0.0625 * velocity)
-- If we are less then threshold in front of the plane (between 0 and threshold) or if we are behing the plane (less then 0), we consider we reached it
reached = dist < threshold
else
reached = true
end
if reached then
this.CurrentWaypointPosition = nil
this.CurrentWaypointPlaneNormal = ZERO_VECTOR3
this.CurrentWaypointPlaneDistance = 0
end
return reached
end
function this:OnPointReached(reached)
if reached and not this.Cancelled then
-- First, destroyed the current displayed waypoint
if this.setPointFunc then
this.setPointFunc(this.CurrentPoint)
end
local nextWaypointIdx = this.CurrentPoint + 1
if nextWaypointIdx > #this.pointList then
-- End of path reached
if this.stopTraverseFunc then
this.stopTraverseFunc()
end
this.Finished:Fire()
this:Cleanup()
else
local currentWaypoint = this.pointList[this.CurrentPoint]
local nextWaypoint = this.pointList[nextWaypointIdx]
-- If airborne, only allow to keep moving
-- if nextWaypoint.Action ~= Jump, or path mantains a direction
-- Otherwise, wait until the humanoid gets to the ground
local currentState = this.Humanoid:GetState()
local isInAir = currentState == Enum.HumanoidStateType.FallingDown
or currentState == Enum.HumanoidStateType.Freefall
or currentState == Enum.HumanoidStateType.Jumping
if isInAir then
local shouldWaitForGround = nextWaypoint.Action == Enum.PathWaypointAction.Jump
if not shouldWaitForGround and this.CurrentPoint > 1 then
local prevWaypoint = this.pointList[this.CurrentPoint - 1]
local prevDir = currentWaypoint.Position - prevWaypoint.Position
local currDir = nextWaypoint.Position - currentWaypoint.Position
local prevDirXZ = Vector2.new(prevDir.x, prevDir.z).Unit
local currDirXZ = Vector2.new(currDir.x, currDir.z).Unit
local THRESHOLD_COS = 0.996 -- ~cos(5 degrees)
shouldWaitForGround = prevDirXZ:Dot(currDirXZ) < THRESHOLD_COS
end
if shouldWaitForGround then
this.Humanoid.FreeFalling:Wait()
-- Give time to the humanoid's state to change
-- Otherwise, the jump flag in Humanoid
-- will be reset by the state change
wait(0.1)
end
end
-- Move to the next point
this:MoveToNextWayPoint(currentWaypoint, nextWaypoint, nextWaypointIdx)
end
else
this.PathFailed:Fire()
this:Cleanup()
end
end
function this:MoveToNextWayPoint(currentWaypoint, nextWaypoint, nextWaypointIdx)
-- Build next destination plane
-- (plane normal is perpendicular to the y plane and is from next waypoint towards current one (provided the two waypoints are not at the same location))
-- (plane location is at next waypoint)
this.CurrentWaypointPlaneNormal = currentWaypoint.Position - nextWaypoint.Position
this.CurrentWaypointPlaneNormal = Vector3.new(this.CurrentWaypointPlaneNormal.X, 0, this.CurrentWaypointPlaneNormal.Z)
if this.CurrentWaypointPlaneNormal.Magnitude > ALMOST_ZERO then
this.CurrentWaypointPlaneNormal = this.CurrentWaypointPlaneNormal.Unit
this.CurrentWaypointPlaneDistance = this.CurrentWaypointPlaneNormal:Dot(nextWaypoint.Position)
else
-- Next waypoint is the same as current waypoint so no plane
this.CurrentWaypointPlaneNormal = ZERO_VECTOR3
this.CurrentWaypointPlaneDistance = 0
end
-- Should we jump
this.CurrentWaypointNeedsJump = nextWaypoint.Action == Enum.PathWaypointAction.Jump;
-- Remember next waypoint position
this.CurrentWaypointPosition = nextWaypoint.Position
-- Move to next point
this.CurrentPoint = nextWaypointIdx
-- Finally reset Timeout
this.Timeout = 0
end
function this:Start(overrideShowPath)
if not this.AgentCanFollowPath then
this.PathFailed:Fire()
return
end
if this.Started then return end
this.Started = true
ClickToMoveDisplay.CancelFailureAnimation()
if ShowPath then
if overrideShowPath == nil or overrideShowPath then
this.stopTraverseFunc, this.setPointFunc = ClickToMoveDisplay.CreatePathDisplay(this.pointList, this.OriginalTargetPoint)
end
end
if #this.pointList > 0 then
-- Determine the humanoid offset from the path's first point
-- Offset of the first waypoint from the path's origin point
this.HumanoidOffsetFromPath = Vector3.new(0, this.pointList[1].Position.Y - this.OriginPoint.Y, 0)
-- As well as its current position and velocity
this.CurrentHumanoidPosition = this.Humanoid.RootPart.Position + this.HumanoidOffsetFromPath
this.CurrentHumanoidVelocity = this.Humanoid.RootPart.Velocity
-- Connect to events
this.SeatedConn = this.Humanoid.Seated:Connect(function(isSeated, seat) this:OnPathInterrupted() end)
this.DiedConn = this.Humanoid.Died:Connect(function() this:OnPathInterrupted() end)
this.TeleportedConn = this.Humanoid.RootPart:GetPropertyChangedSignal("CFrame"):Connect(function() this:OnPathInterrupted() end)
-- Actually start
this.CurrentPoint = 1 -- The first waypoint is always the start location. Skip it.
this:OnPointReached(true) -- Move to first point
else
this.PathFailed:Fire()
if this.stopTraverseFunc then
this.stopTraverseFunc()
end
end
end
--We always raycast to the ground in the case that the user clicked a wall.
local offsetPoint = this.TargetPoint + this.TargetSurfaceNormal*1.5
local ray = Ray.new(offsetPoint, Vector3.new(0,-1,0)*50)
local newHitPart, newHitPos = Workspace:FindPartOnRayWithIgnoreList(ray, getIgnoreList())
if newHitPart then
this.TargetPoint = newHitPos
end
this:ComputePath()
return this
end
|
--[[
Evercyan @ March 2023
Tween
Tween is a utility wrapper used to conveniently create & play tweens in a short & quick fashion.
A wrapper basically takes an existing feature (TweenService) and adds code on top of it for extra functionality.
---- Roblox TweenService:
local Tween = TweenService:Create(Lighting, {1, Enum.EasingStyle.Exponential, Enum.EasingDirection.In}, {Brightness = 0})
Tween:Play()
---- Tween Wrapper:
local Tween = Tween:Play(Lighting, {1, "Expontential", "In"}, {Brightness = 0})
]] | |
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = {};
local l__ReplicatedStorage__2 = game.ReplicatedStorage;
local v3 = require(game.ReplicatedStorage.Modules.Lightning);
local v4 = require(game.ReplicatedStorage.Modules.Xeno);
local v5 = require(game.ReplicatedStorage.Modules.CameraShaker);
local l__TweenService__6 = game.TweenService;
local l__Debris__7 = game.Debris;
function v1.RunStompFx(p1, p2, p3, p4)
local v8 = game.ReplicatedStorage.KillFX.Sleepy.Sound:Clone();
v8.Parent = p2;
v8:Play();
local v9 = game.ReplicatedStorage.KillFX.Sleepy.pillow:Clone();
v9.Parent = workspace.Ignored.Animations;
game.Debris:AddItem(v9, 4);
coroutine.wrap(function()
while true do
v9.CFrame = p2.Parent.Head.CFrame * CFrame.new(0, 0, -0.5);
task.wait();
if v9.Parent == nil then
break;
end;
end;
end)();
return nil;
end;
return v1;
|
-- You are automatically given the 'Owner' role - no need to add yourself in!
-- Scroll down to 'Settings' to view/change the Prefix | |
------------------------------------------------------------------------
-- codes loading of nil, optimization done if consecutive locations
-- * used in luaK:discharge2reg(), (lparser) luaY:adjust_assign()
------------------------------------------------------------------------ |
function luaK:_nil(fs, from, n)
if fs.pc > fs.lasttarget then -- no jumps to current position?
if fs.pc == 0 then -- function start?
if from >= fs.nactvar then
return -- positions are already clean
end
else
local previous = fs.f.code[fs.pc - 1]
if luaP:GET_OPCODE(previous) == "OP_LOADNIL" then
local pfrom = luaP:GETARG_A(previous)
local pto = luaP:GETARG_B(previous)
if pfrom <= from and from <= pto + 1 then -- can connect both?
if from + n - 1 > pto then
luaP:SETARG_B(previous, from + n - 1)
end
return
end
end
end
end
self:codeABC(fs, "OP_LOADNIL", from, from + n - 1, 0) -- else no optimization
end
|
--- Provide a variety of utility Table operations
-- @module Table |
local Table = {}
|
--[[Steering]] |
function Steering()
--Mouse Steer
if _MSteer then
local msWidth = math.max(1,mouse.ViewSizeX*_Tune.Peripherals.MSteerWidth/200)
local mdZone = _Tune.Peripherals.MSteerDZone/100
local mST = ((mouse.X-mouse.ViewSizeX/2)/msWidth)
if math.abs(mST)<=mdZone then
_GSteerT = 0
else
_GSteerT = (math.max(math.min((math.abs(mST)-mdZone),(1-mdZone)),0)/(1-mdZone))^_Tune.MSteerExp * (mST / math.abs(mST))
end
end
--Interpolate Steering
if _GSteerC < _GSteerT then
if _GSteerC<0 then
_GSteerC = math.min(_GSteerT,_GSteerC+_Tune.ReturnSpeed)
else
_GSteerC = math.min(_GSteerT,_GSteerC+_Tune.SteerSpeed)
end
else
if _GSteerC>0 then
_GSteerC = math.max(_GSteerT,_GSteerC-_Tune.ReturnSpeed)
else
_GSteerC = math.max(_GSteerT,_GSteerC-_Tune.SteerSpeed)
end
end
--Steer Decay Multiplier
local sDecay = (1-math.min(car.Body.CarName.Value.VehicleSeat.Velocity.Magnitude/_Tune.SteerDecay,1-(_Tune.MinSteer/100)))
--Apply Steering
for i,v in pairs(car.Wheels:GetChildren()) do
if v.Name=="F" then
v.Arm.Steer.CFrame=car.Wheels.F.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*_Tune.SteerInner*sDecay),0)
elseif v.Name=="FL" then
if _GSteerC>= 0 then
v.Arm.Steer.CFrame=car.Wheels.FL.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*_Tune.SteerOuter*sDecay),0)
else
v.Arm.Steer.CFrame=car.Wheels.FL.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*_Tune.SteerInner*sDecay),0)
end
elseif v.Name=="FR" then
if _GSteerC>= 0 then
v.Arm.Steer.CFrame=car.Wheels.FR.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*_Tune.SteerInner*sDecay),0)
else
v.Arm.Steer.CFrame=car.Wheels.FR.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*_Tune.SteerOuter*sDecay),0)
end
end
end
end
|
--[[ <<DO NOT DELETE THIS MODULE>>
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/ Build 6.33
SecondLogic @ Inspare
>>Manual
Basically...everything you can and would ever want to touch is in the tuning module. EVERYTHING
Installation Video [Coming Soon]
Tuning Video [Coming Soon]
Torque Curve Tune Visualizer:
https://www.desmos.com/calculator/mpkd3kxovu
Basic Tips:
--Installation
>Everything is built-in (even the gyros), so all you have to worry about is placing the wheels and the seat.
>Body parts go in the "Body" section.
>Wheel parts go in the "Parts" section of the wheel. Calipers go on the "Fixed" section.
>You can add or remove wheels. To add a wheel, simply copy one of the wheels and make sure it's named one of the following: "F","FL","FR","R","RL","RR".
>Wheels need to be aligned with the axes of the seat. Don't rotate the seat relative to the wheels as it may cause welding problems.
>All wheel offsets are applied in the tuning module. Do NOT manually add offset to the wheels. Steering axis is centered on the wheel part by default.
>Seat offset can be adjusted in the "MiscWeld" module under "Initialize".
>Use the "Misc" section for scripted/moving parts and apply welding using the "MiscWeld" module under "Initialize".
--Tuning
>Reduce weight(density) if setup is lacking torque. Increase density if setup has too much torque.
>Add downforce to the wheels manually if setup is lacking grip or use a downforce plugin.
>Dialing in ratios used in real cars is an easy way to have a realisticly tuned transmission.
>Modifying the "Drive" script may affect the integrity of the system.
>Custom scripts should be put in the "Plugins" folder. Using plugins made by other users is encouraged.
>When writing custom plugins, you can reference the values within the "Values" folder inside the A-Chassis Interface.
>It is a good practice to make plugins compatible with any setup and providing a usage manual if a plugin is released.
>Yes, you can remove/change the default plugins that come with the kit. The drive system will still work perfectly.
--Updates
>To update, simply just replace the entire "A-Chassis Tune" module of an existing car with a newer version of the module.
>You may want to copy the tune values and plugins from the old module, but dont simply overwrite the tune module as new values may be added.
Note: BodyAngularVelocity tends to have stability issues at high speeds when using PSGPhysicsSolver. It is recommended to turn it off for best results.
>>Changelog
[10/31/16 : Build 6.33] - Semi-Automatic
[Added semi-automatic transmission mode]
-'TransModes' now accepts "Semi" value for semi-automatic.
-Updated AC6_Stock_Gauges to include semi-automatic mode.
[Fixed disengaging p-brake]
-P-Brake now remains engaged if player gets into then vehicle.
[Fixed FE Support for AC6_Stock_Sound]
-Sounds should now work properly with Filtering Enabled.
[8/5/16 : Build 6.32] - Differential System
[Implemented differential system]
-Differential controls torque distibution between wheels that are spinning at different rates
-Added tune values 'FDiffSlipThres', 'FDiffLockThres', 'RDiffSlipThres', 'RDiffLockThres', 'CDiffSlipThres', and 'CDiffLockThres'.
-'DiffSlipThres' determine the threshold of the speed difference between the wheels. Full lock applies at max threshold.
-A lower slip threshold value will make the diff more aggressive.
-'DiffLockThres' determines the bias of the differential.
-A lock threshold value more than 50 puts more torque into the slipping wheel (moving towards an open diff).
-A lock threshold value less than 50 puts more torque into the grounded wheel (moving towards a locked diff).
[Fixed multiple wheel support]
-The chassis can now use more than just the default 4 set of wheels. Just copy an existing wheel and place accordingly.
-Differential works with auxiliary wheels.
[7/13/16 : Build 6.31] - Peripheral Settings
[Added peripheral adjustment values]
-Moved controller and mouse deadzone values to the "Controls" section of the tune.
-Split controller deadzone into left and right input.
-Moved mouse control width to "Conrols" secton. This value now operates based off of % of screed width.
[Updated stock Controls Module]
-Added sliders for controller and mouse deadzone values.
-Added slider for mouse control width.
[6/15/16 : Build 6.3] - Motercisly
[Better motorcycle system support]
-Added wheel configurations "F" and "R" for single wheel settup.
-"F" and "R" wheels will have axle parts on both sides for better balance.
-These wheel configurations will ignore outor rotation value and will rotated based off of the inner rotation value only.
-Camber and Toe cannot be applied to these wheel configurations. Caster will still be applied as normal.
[Bug fixes]
-Caster now applies after wheel part rotations so wheel parts dont rotate with caster.
-Fixed Clutch re-engaging automatically when shifting out of neutral.
[6/4/16 : Build 6.21] - AC6 Official Public Kit Release
[Plugin FilteringEnabled compatability made easier]
-System now detects if there is a RemoteEvent or RemoteFunction inside a plugin. These will be parented directly under the car.
-The RemoteEvent/RemoteFunction needs to be a direct child of the plugin for it to be detected.
-Scripts inside the RemoteEvent/RemoteFunction should be disabled. They will be enabled after initialization.
-Be careful as this system is suceptible to name collisions. Name your RemoteEvents/RemoteFunctions uniquely.
-Stock AC6 Sound plugin is now FE compatible.
[Controls Panel now a plugin instead of integrated]
-Separated controls panel from Drive script. The controls panel is now a plugin.
-The "Controls" folder appears inside the interface on Drive startup. Use this folder to reference button mapping values for custom controls plugins.
-"ControlsOpen" value added. This is a safety toggle when changing control values. This value can be manipulated by plugins.
[New tune values]
-Added 'AutoFlip' tune value. This determines if the car automatically flips itself over when upside down.
-Added 'StAxisOffset' tune value. This offsets the center of the steering axis. Positive value = offset outward.
-Added 'SteerD', 'SteerMaxTorque', and 'SteerP' values which set the steering axle gyro properties.
[MiscWeld streamlining]
-Added "Misc" section to the main sections. This should contain scripted/moving parts.
-Parts in this section are NOT WELDED AUTOMATICALLY. Use the "MiscWeld" module to weld these parts. The "Misc" section is pre-referenced as 'misc'.
[Bug fixes]
-Fixed flip gyro not resetting when gyro is active and driver leaves car.
-Fixed issue with switching transmission modes.
--]] |
return 6.33
|
----------------------------------
------------FUNCTIONS-------------
---------------------------------- |
function Receive(player, action, ...)
local args = {...}
if player == User and action == "play" then
Connector:FireAllClients("play", User, args[1], Settings.SoundSource.Position, Settings.PianoSoundRange, Settings.PianoSounds, args[2], Settings.IsCustom)
HighlightPianoKey((args[1] > 61 and 61) or (args[1] < 1 and 1) or args[1],args[3])
elseif player == User and action == "abort" then
Deactivate()
if SeatWeld then
SeatWeld:remove()
end
end
end
function Activate(player)
Connector:FireClient(player, "activate", Settings.CameraCFrame, Settings.PianoSounds, true)
User = player
for i,v in pairs(Piano.Keys.Keys:GetChildren()) do
local obj = v
local Properties = {}
Properties.Transparency = 0
Tween(obj,Properties,1,false,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false)
end
end
function Deactivate()
if User and User.Parent then
Connector:FireClient(User, "deactivate")
User.Character:SetPrimaryPartCFrame(Box.CFrame + Vector3.new(0, 5, 0))
end
for i,v in pairs(Piano.Keys.Keys:GetChildren()) do
local obj = v
local Properties = {}
Properties.Transparency = 1
Tween(obj,Properties,1,false,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false)
end
User = nil
end
|
--[=[
Uses the constructor to attach a class or resource to the actual object
for the lifetime of the subscription of that object.
```lua
return Blend.New "Frame" {
Parent = variables.Parent;
[Blend.Attached(function(parent)
local maid = Maid.new()
print("Got", parent)
maid:GiveTask(function()
print("Dead!")
end)
return maid
end)] = true;
}
```
@param constructor T
@return (parent: Instance) -> Observable<T>
]=] |
function Blend.Attached(constructor)
return function(parent)
return Observable.new(function(sub)
local maid = Maid.new()
local resource = constructor(parent)
if MaidTaskUtils.isValidTask(resource) then
maid:GiveTask(resource)
end
sub:Fire(resource)
return maid
end)
end;
end
|
--[=[
@param object any -- Object to remove
Removes the object from the Janitor and cleans it up.
```lua
local part = Instance.new("Part")
Janitor:Add(part)
Janitor:Remove(part)
```
]=] |
function Janitor:Remove(object: any): boolean
local objects = self._objects
for i,obj in ipairs(objects) do
if obj[1] == object then
local n = #objects
objects[i] = objects[n]
objects[n] = nil
self:_cleanupObject(obj[1], obj[2])
return true
end
end
return false
end
|
-- Remote Events |
local RE_Character_Appearance_Loaded = Remote_Events.CharacterAppearanceLoaded
|
-- Uber l33t maths to calcluate the angle needed to throw a projectile a distance, given the altitude of the end point and the projectile's velocity |
function AngleOfReach(distance, altitude, velocity)
local theta = math.atan((velocity^2 + math.sqrt(velocity^4 -200*(200*distance^2 + 2*altitude*velocity^2)))/(200*distance))
if theta ~= theta then
theta = math.pi/4
end
return(theta)
end
|
-- table.concat but allows booleans |
local function tableConcat(t, sep)
for i, v in t do
if type(v) == "boolean" then
t[i] = tostring(v)
end
end
table.concat(t, sep)
return t
end
local function dumpFormatter(dump, start, ending)
-- "\n\n -- " .. start .. " --\n\n" .. dump .. "\n -- " .. ending .. " --"
return `\n\n -- {start} --\n\n{dump}\n -- {ending} --\n`
end
local class = {}
function ErrorFormat(title: string, nonFatal: boolean?, traceback: string?)
return function(errorMessage: string)
errorMessage = `{title} {errorMessage}{dumpFormatter(traceback or debug.traceback(nil, 2), "Stack Trace", "Stack End")}`
if nonFatal then
task.spawn(error, errorMessage, 0)
else
error(errorMessage, 0)
end
end
end
return ErrorFormat
|
--[[Susupension]] |
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 500 -- Spring Dampening
Tune.FSusStiffness = 9000 -- Spring Force
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.FSusLength = 2 -- Suspension length (in studs)
Tune.FPreCompress = .1 -- Pre-compression adds resting length force
Tune.FExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.FCompressLim = .1 -- Max Compression Travel (in studs)
Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 500 -- Spring Dampening
Tune.RSusStiffness = 9000 -- Spring Force
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.RSusLength = 2 -- Suspension length (in studs)
Tune.RPreCompress = .1 -- Pre-compression adds resting length force
Tune.RExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.RCompressLim = .1 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] 0 , -- positive = outward
--[[Vertical]] -1.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = false -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Bright red" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
------------------------- |
function onClicked()
Car.BodyVelocity.velocity = Vector3.new(0, 3, 0)
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
--[[
Function called upon entering the state - creates the systems, and initialises the game loop.
]] |
function ServerGame.onEnter(stateMachine, event, from, to)
SystemManager.createSystems()
local engine = SystemManager.getSystemByName("engine")
local function completeGame()
stateMachine:finishGame()
end
connections.crashedIntoSun = engine.crashedIntoSun:Connect(completeGame)
connections.escapedSun = engine.escapedSun:Connect(completeGame)
spawnToolsAsync()
tagMap()
coroutine.wrap(
function()
while true do
local waitTime = METEOR_FREQUENCY_PER_PLAYER / 1 + (#Players:GetPlayers() / 5)
wait(math.random(waitTime / 1.5, waitTime * 1.5))
if stateMachine.current ~= "game" then
return
end
local shield = SystemManager.getSystemByName("shield")
if shield:isOn() and math.random(1, 100) > SHIELD_DEFLECT_RATE then
sendAlert(Constants.Alert.Success, translate("Shields have deflected a meteor!"))
else
spawnMeteor()
end
end
end
)()
end
|
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = {};
local l__PlayerGui__2 = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui");
local l__Parent__3 = script.Parent;
local v4 = {};
v4.__index = v4;
local u1 = require(game:GetService("Chat"):WaitForChild("ClientChatModules"):WaitForChild("ChatSettings"));
local u2 = require(l__Parent__3:WaitForChild("MessageSender"));
function v4.CreateGuiObjects(p1, p2)
local v5 = Instance.new("Frame");
v5.Selectable = false;
v5.Size = UDim2.new(1, 0, 1, 0);
v5.BackgroundTransparency = 1;
v5.Parent = p2;
local v6 = Instance.new("Frame");
v6.Selectable = false;
v6.Name = "ScrollingBase";
v6.BackgroundTransparency = 1;
v6.ClipsDescendants = true;
v6.Size = UDim2.new(1, 0, 1, 0);
v6.Position = UDim2.new(0, 0, 0, 0);
v6.Parent = v5;
local v7 = Instance.new("Frame");
v7.Selectable = false;
v7.Name = "ScrollerSizer";
v7.BackgroundTransparency = 1;
v7.Size = UDim2.new(1, 0, 1, 0);
v7.Position = UDim2.new(0, 0, 0, 0);
v7.Parent = v6;
local v8 = Instance.new("Frame");
v8.Selectable = false;
v8.Name = "ScrollerFrame";
v8.BackgroundTransparency = 1;
v8.Size = UDim2.new(1, 0, 1, 0);
v8.Position = UDim2.new(0, 0, 0, 0);
v8.Parent = v7;
local v9 = Instance.new("Frame");
v9.Selectable = false;
v9.Size = UDim2.new(1, 0, 1, 0);
v9.Position = UDim2.new(0, 0, 0, 0);
v9.ClipsDescendants = true;
v9.BackgroundTransparency = 1;
v9.Parent = v5;
local v10 = Instance.new("Frame");
v10.Selectable = false;
v10.Name = "LeaveConfirmationFrame";
v10.Size = UDim2.new(1, 0, 1, 0);
v10.Position = UDim2.new(0, 0, 1, 0);
v10.BackgroundTransparency = 0.6;
v10.BorderSizePixel = 0;
v10.BackgroundColor3 = Color3.new(0, 0, 0);
v10.Parent = v9;
local v11 = Instance.new("TextButton");
v11.Selectable = false;
v11.Size = UDim2.new(1, 0, 1, 0);
v11.BackgroundTransparency = 1;
v11.Text = "";
v11.Parent = v10;
local v12 = Instance.new("TextButton");
v12.Selectable = false;
v12.Size = UDim2.new(0.25, 0, 1, 0);
v12.BackgroundTransparency = 1;
v12.Font = u1.DefaultFont;
v12.TextSize = 18;
v12.TextStrokeTransparency = 0.75;
v12.Position = UDim2.new(0, 0, 0, 0);
v12.TextColor3 = Color3.new(0, 1, 0);
v12.Text = "Confirm";
v12.Parent = v10;
local v13 = v12:Clone();
v13.Parent = v10;
v13.Position = UDim2.new(0.75, 0, 0, 0);
v13.TextColor3 = Color3.new(1, 0, 0);
v13.Text = "Cancel";
local v14 = Instance.new("TextLabel");
v14.Selectable = false;
v14.Size = UDim2.new(0.5, 0, 1, 0);
v14.Position = UDim2.new(0.25, 0, 0, 0);
v14.BackgroundTransparency = 1;
v14.TextColor3 = Color3.new(1, 1, 1);
v14.TextStrokeTransparency = 0.75;
v14.Text = "Leave channel <XX>?";
v14.Font = u1.DefaultFont;
v14.TextSize = 18;
v14.Parent = v10;
local v15 = Instance.new("StringValue");
v15.Name = "LeaveTarget";
v15.Parent = v10;
local l__Position__3 = v10.Position;
v12.MouseButton1Click:connect(function()
u2:SendMessage(string.format("/leave %s", v15.Value), nil);
v10:TweenPosition(l__Position__3, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
end);
v13.MouseButton1Click:connect(function()
v10:TweenPosition(l__Position__3, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true);
end);
local v16 = Instance.new("ImageButton", v5);
v16.Selectable = u1.GamepadNavigationEnabled;
v16.Name = "PageLeftButton";
v16.SizeConstraint = Enum.SizeConstraint.RelativeYY;
v16.Size = UDim2.new(0.7, 0, 0.7, 0);
v16.BackgroundTransparency = 1;
v16.Position = UDim2.new(0, 4, 0.15000000000000002, 0);
v16.Visible = false;
v16.Image = "rbxassetid://471630199";
local v17 = Instance.new("ImageLabel", v16);
v17.Name = "ArrowLabel";
v17.BackgroundTransparency = 1;
v17.Size = UDim2.new(0.4, 0, 0.4, 0);
v17.Image = "rbxassetid://471630112";
local v18 = Instance.new("Frame", v5);
v18.Selectable = false;
v18.BackgroundTransparency = 1;
v18.Name = "PositionalHelper";
v18.Size = v16.Size;
v18.SizeConstraint = v16.SizeConstraint;
v18.Position = UDim2.new(1, 0, 0.15000000000000002, 0);
local v19 = v16:Clone();
v19.Parent = v18;
v19.Name = "PageRightButton";
v19.Size = UDim2.new(1, 0, 1, 0);
v19.SizeConstraint = Enum.SizeConstraint.RelativeXY;
v19.Position = UDim2.new(-1, -4, 0, 0);
local v20 = UDim2.new(0.05, 0, 0, 0);
v19.ArrowLabel.Position = UDim2.new(0.3, 0, 0.3, 0) + v20;
v16.ArrowLabel.Position = UDim2.new(0.3, 0, 0.3, 0) - v20;
v16.ArrowLabel.Rotation = 180;
p1.GuiObject = v5;
p1.GuiObjects.BaseFrame = v5;
p1.GuiObjects.ScrollerSizer = v7;
p1.GuiObjects.ScrollerFrame = v8;
p1.GuiObjects.PageLeftButton = v16;
p1.GuiObjects.PageRightButton = v19;
p1.GuiObjects.LeaveConfirmationFrame = v10;
p1.GuiObjects.LeaveConfirmationNotice = v14;
p1.GuiObjects.PageLeftButtonArrow = v16.ArrowLabel;
p1.GuiObjects.PageRightButtonArrow = v19.ArrowLabel;
p1:AnimGuiObjects();
v16.MouseButton1Click:connect(function()
p1:ScrollChannelsFrame(-1);
end);
v19.MouseButton1Click:connect(function()
p1:ScrollChannelsFrame(1);
end);
p1:ScrollChannelsFrame(0);
end;
function v4.UpdateMessagePostedInChannel(p3, p4)
local v21 = p3:GetChannelTab(p4);
if v21 then
v21:UpdateMessagePostedInChannel();
return;
end;
warn("ChannelsTab '" .. p4 .. "' does not exist!");
end;
local u4 = require(l__Parent__3:WaitForChild("ChannelsTab"));
function v4.AddChannelTab(p5, p6)
if p5:GetChannelTab(p6) then
error("Channel tab '" .. p6 .. "'already exists!");
end;
local v22 = u4.new(p6);
v22.GuiObject.Parent = p5.GuiObjects.ScrollerFrame;
p5.ChannelTabs[p6:lower()] = v22;
p5.NumTabs = p5.NumTabs + 1;
p5:OrganizeChannelTabs();
if u1.RightClickToLeaveChannelEnabled then
v22.NameTag.MouseButton2Click:connect(function()
p5.LeaveConfirmationNotice.Text = string.format("Leave channel %s?", v22.ChannelName);
p5.LeaveConfirmationFrame.LeaveTarget.Value = v22.ChannelName;
p5.LeaveConfirmationFrame:TweenPosition(UDim2.new(0, 0, 0, 0), Enum.EasingDirection.In, Enum.EasingStyle.Quad, 0.2, true);
end);
end;
return v22;
end;
function v4.RemoveChannelTab(p7, p8)
if not p7:GetChannelTab(p8) then
error("Channel tab '" .. p8 .. "'does not exist!");
end;
local v23 = p8:lower();
p7.ChannelTabs[v23]:Destroy();
p7.ChannelTabs[v23] = nil;
p7.NumTabs = p7.NumTabs - 1;
p7:OrganizeChannelTabs();
end;
function v4.GetChannelTab(p9, p10)
return p9.ChannelTabs[p10:lower()];
end;
function v4.OrganizeChannelTabs(p11)
local v24 = {};
table.insert(v24, p11:GetChannelTab(u1.GeneralChannelName));
table.insert(v24, p11:GetChannelTab("System"));
for v25, v26 in pairs(p11.ChannelTabs) do
if v26.ChannelName ~= u1.GeneralChannelName and v26.ChannelName ~= "System" then
table.insert(v24, v26);
end;
end;
for v27, v28 in pairs(v24) do
v28.GuiObject.Position = UDim2.new(v27 - 1, 0, 0, 0);
end;
p11.GuiObjects.ScrollerSizer.Size = UDim2.new(1 / math.max(1, math.min(u1.ChannelsBarFullTabSize, p11.NumTabs)), 0, 1, 0);
p11:ScrollChannelsFrame(0);
end;
function v4.ResizeChannelTabText(p12, p13)
for v29, v30 in pairs(p12.ChannelTabs) do
v30:SetTextSize(p13);
end;
end;
function v4.ScrollChannelsFrame(p14, p15)
if p14.ScrollChannelsFrameLock then
return;
end;
p14.ScrollChannelsFrameLock = true;
local l__ChannelsBarFullTabSize__31 = u1.ChannelsBarFullTabSize;
local v32 = p14.CurPageNum + p15;
if v32 < 0 then
v32 = 0;
elseif v32 > 0 and p14.NumTabs < v32 + l__ChannelsBarFullTabSize__31 then
v32 = p14.NumTabs - l__ChannelsBarFullTabSize__31;
end;
p14.CurPageNum = v32;
local v33 = UDim2.new(-p14.CurPageNum, 0, 0, 0);
p14.GuiObjects.PageLeftButton.Visible = p14.CurPageNum > 0;
p14.GuiObjects.PageRightButton.Visible = p14.CurPageNum + l__ChannelsBarFullTabSize__31 < p14.NumTabs;
if p15 == 0 then
p14.ScrollChannelsFrameLock = false;
return;
end;
p14:WaitUntilParentedCorrectly();
p14.GuiObjects.ScrollerFrame:TweenPosition(v33, Enum.EasingDirection.InOut, Enum.EasingStyle.Quad, 0.15, true, function()
p14.ScrollChannelsFrameLock = false;
end);
end;
local u5 = require(l__Parent__3:WaitForChild("CurveUtil"));
function v4.FadeOutBackground(p16, p17)
for v34, v35 in pairs(p16.ChannelTabs) do
v35:FadeOutBackground(p17);
end;
p16.AnimParams.Background_TargetTransparency = 1;
p16.AnimParams.Background_NormalizedExptValue = u5:NormalizedDefaultExptValueInSeconds(p17);
end;
function v4.FadeInBackground(p18, p19)
for v36, v37 in pairs(p18.ChannelTabs) do
v37:FadeInBackground(p19);
end;
p18.AnimParams.Background_TargetTransparency = 0.6;
p18.AnimParams.Background_NormalizedExptValue = u5:NormalizedDefaultExptValueInSeconds(p19);
end;
function v4.FadeOutText(p20, p21)
for v38, v39 in pairs(p20.ChannelTabs) do
v39:FadeOutText(p21);
end;
end;
function v4.FadeInText(p22, p23)
for v40, v41 in pairs(p22.ChannelTabs) do
v41:FadeInText(p23);
end;
end;
function v4.AnimGuiObjects(p24)
p24.GuiObjects.PageLeftButton.ImageTransparency = p24.AnimParams.Background_CurrentTransparency;
p24.GuiObjects.PageRightButton.ImageTransparency = p24.AnimParams.Background_CurrentTransparency;
p24.GuiObjects.PageLeftButtonArrow.ImageTransparency = p24.AnimParams.Background_CurrentTransparency;
p24.GuiObjects.PageRightButtonArrow.ImageTransparency = p24.AnimParams.Background_CurrentTransparency;
end;
function v4.InitializeAnimParams(p25)
p25.AnimParams.Background_TargetTransparency = 0.6;
p25.AnimParams.Background_CurrentTransparency = 0.6;
p25.AnimParams.Background_NormalizedExptValue = u5:NormalizedDefaultExptValueInSeconds(0);
end;
function v4.Update(p26, p27)
for v42, v43 in pairs(p26.ChannelTabs) do
v43:Update(p27);
end;
p26.AnimParams.Background_CurrentTransparency = u5:Expt(p26.AnimParams.Background_CurrentTransparency, p26.AnimParams.Background_TargetTransparency, p26.AnimParams.Background_NormalizedExptValue, p27);
p26:AnimGuiObjects();
end;
function v4.WaitUntilParentedCorrectly(p28)
while not p28.GuiObject:IsDescendantOf(game:GetService("Players").LocalPlayer) do
p28.GuiObject.AncestryChanged:wait();
end;
end;
function v1.new()
local v44 = setmetatable({}, v4);
v44.GuiObject = nil;
v44.GuiObjects = {};
v44.ChannelTabs = {};
v44.NumTabs = 0;
v44.CurPageNum = 0;
v44.ScrollChannelsFrameLock = false;
v44.AnimParams = {};
v44:InitializeAnimParams();
u1.SettingsChanged:connect(function(p29, p30)
if p29 == "ChatChannelsTabTextSize" then
v44:ResizeChannelTabText(p30);
end;
end);
return v44;
end;
return v1;
|
--[[
Utility script that holds a cache of player character appearances. Allows the game to load appearances as soon as the player enters the game, thereby reducing
risk of lengthy Roblox server requests slowing down critial times in the game loop.
]] |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Logger = require(ReplicatedStorage.Dependencies.GameUtils.Logger)
local CharacterAppearanceCache = {}
local appearanceCache = {}
|
-- Services |
local TweenService = game:GetService("TweenService")
|
--// Functions |
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.X then
if Chatting == true then
Skip = true
Sounds.Click:Play()
end
end
end)
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.Z then
if Chatting == true then
Exit = true
Sounds.Click:Play()
end
end
end)
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.E then
if Detected == true then
local Lines = DetectedNPC:FindFirstChild("Lines")
if Lines then
Sounds.Click:Play()
Chatting = true
Detected = false
LineLabel.Text = " "
PromptLabel:TweenSize(UDim2.new(0, 0, 0, 0), "Out", "Linear", 0.2)
LineLabel:TweenPosition(UDim2.new(0, 0, 0.8, 0), "In", "Linear", 0.2)
wait(0.5)
for i, Line in pairs(Lines:GetChildren()) do
local Text = Line.Value
for i = 1, #Text do
LineLabel.Text = string.sub(Text, 1, i)
Sounds.Talk:Play()
if Skip == true then
Skip = false
LineLabel.Text = Text
break
end
if Exit == true then
break
end
wait(0.07)
end
if Exit == true then
Exit = false
break
end
repeat wait() until Skip == true or Exit == true
Skip = false
end
Exit = false
Skip = false
PromptLabel:TweenSize(UDim2.new(0, 0, 0, 0), "Out", "Linear", 0.2)
LineLabel:TweenPosition(UDim2.new(0, 0, 1.2, 0), "Out", "Linear", 0.2)
wait(0.5)
Chatting = false
Detected = false
end
end
end
end)
|
-- local hit, pos = game.Workspace:FindPartOnRayWithIgnoreList(ray, ignoreList) | |
---Setting events to all buttons |
ButtonsPanel.Lights.MouseButton1Click:Connect(function()
---Checking if the player is in a vehicle
if Char.Humanoid.SeatPart ~= nil and Char.Humanoid.SeatPart.Parent:FindFirstChild("Stats") then
Char.Humanoid.SeatPart.Parent.VehicleSeat.ChassisMain["Lights"]:FireServer()
end
end)
ButtonsPanel.Flip.MouseButton1Click:Connect(function()
---Checking if the player is in a vehicle
if Char.Humanoid.SeatPart ~= nil and Char.Humanoid.SeatPart.Parent:FindFirstChild("Stats") and FlipCD == false then
FlipCD = true
local Gyro = Char.Humanoid.SeatPart.Parent.Engine.Stability
Gyro.D = 100
Gyro.P = 2000
Gyro.MaxTorque = Vector3.new(1800,0,1800)
wait(3)
Gyro.D = 11
Gyro.P = 11
Gyro.MaxTorque = Vector3.new(6,6,6)
wait(5)
FlipCD = false
end
end)
|
-- Controls the field-of-view of the camera depending on the player's setting.
--
-- ForbiddenJ |
NormalFov = 70
WideFov = 85
Camera = workspace.CurrentCamera
FovSetting = game.ReplicatedStorage.ClientConfig.WideFOV
function Update()
Camera.FieldOfView = FovSetting.Value and WideFov or NormalFov
end
FovSetting:GetPropertyChangedSignal("Value"):Connect(Update)
Update()
|
--tables |
local SoundTable = {}
local AnimTable = {}
local function PickThing(ThingToPick)
if ThingToPick == "Swing" then
--pick anim
local SwingA = AnimTable[R:NextInteger(1, #AnimTable)]
local findA = Tool.Animations:findFirstChild(SwingA)
return findA
elseif ThingToPick == "Sound" then
--pick sound
local SoundA = SoundTable[R:NextInteger(1, #SoundTable)]
local findA = Tool.Sounds:findFirstChild(SoundA)
return findA
end
end
--check if trables have been filled
function CheckTables()
if LoadedTables == false then
local GetS = Tool.Sounds:GetChildren()
local GetA = Tool.Animations:GetChildren()
for i = 1, #GetS do
if GetS[i].Name ~= "Equip" then --ignore equip sound
table.insert(SoundTable, tostring(GetS[i].Name))
end
end
for i = 1, #GetA do
if GetA[i].Name ~= "Equip" then --ignore equip animation
table.insert(AnimTable, tostring(GetA[i].Name))
end
end
LoadedTables = true
end
end
|
--// UI Tween Info |
local L_138_ = TweenInfo.new(
1,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
local L_139_ = {
TextTransparency = 1
}
|
--[[[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.Pause ,
ToggleABS = Enum.KeyCode.Pause ,
ToggleTransMode = Enum.KeyCode.M ,
ToggleMouseDrive = Enum.KeyCode.Pause ,
--Primary Controls
Throttle = Enum.KeyCode.Up ,
Brake = Enum.KeyCode.Down ,
SteerLeft = Enum.KeyCode.Left ,
SteerRight = Enum.KeyCode.Right ,
--Secondary Controls
Throttle2 = Enum.KeyCode.W ,
Brake2 = Enum.KeyCode.S ,
SteerLeft2 = Enum.KeyCode.A ,
SteerRight2 = Enum.KeyCode.D ,
--Manual Transmission
ShiftUp = Enum.KeyCode.E ,
ShiftDown = Enum.KeyCode.Q ,
Clutch = Enum.KeyCode.LeftShift ,
--Handbrake
PBrake = Enum.KeyCode.P ,
--Mouse Controls
MouseThrottle = Enum.UserInputType.MouseButton1 ,
MouseBrake = Enum.UserInputType.MouseButton2 ,
MouseClutch = Enum.KeyCode.W ,
MouseShiftUp = Enum.KeyCode.E ,
MouseShiftDown = Enum.KeyCode.Q ,
MousePBrake = Enum.KeyCode.LeftShift ,
--Controller Mapping
ContlrThrottle = Enum.KeyCode.ButtonR2 ,
ContlrBrake = Enum.KeyCode.ButtonL2 ,
ContlrSteer = Enum.KeyCode.Thumbstick1 ,
ContlrShiftUp = Enum.KeyCode.ButtonY ,
ContlrShiftDown = Enum.KeyCode.ButtonX ,
ContlrClutch = Enum.KeyCode.ButtonR1 ,
ContlrPBrake = Enum.KeyCode.ButtonL1 ,
ContlrToggleTMode = Enum.KeyCode.DPadUp ,
ContlrToggleTCS = Enum.KeyCode.DPadDown ,
ContlrToggleABS = Enum.KeyCode.DPadRight ,
}
|
------------------------ |
function Key(key)
if key then
key = string.lower(key)
if (key=="x") then
if on == 1 then
Tool.Parent.Humanoid.WalkSpeed = CurrentWalkSpeed
on = 0
elseif on == 0 then
Tool.Parent.Humanoid.WalkSpeed = WalkSpeedWhileCrouching
on = 1
end
Crouch(on)
end
end
end
function Equip(mouse)
mouse.KeyDown:connect(Key)
end
script.Parent.Equipped:connect(Equip)
|
-- Render the map at 0FPS (static since we know it doesn't change) |
for i,d in pairs(workspace:GetDescendants()) do
local isHum = false
if d.Parent then
local hum = d.Parent:FindFirstChild("Humanoid")
if hum then
if hum:IsA("Humanoid") then
isHum = true
end
end
end
if d:IsA("BasePart") and not d:IsA("Terrain") and not isHum then
local mapObj_Handler = VF_Handler:RenderObject(d, 30)
end
end
|
-- part.Anchored = true |
part.Position = Vector3.new(x,0.5,z) |
--[[
Returns a list of the keys from the given dictionary.
]] |
local function keys(dictionary)
local new = {}
local index = 1
for key in pairs(dictionary) do
new[index] = key
index = index + 1
end
return new
end
return keys
|
--- Rainbow FX |
return function(gui, property, speed)
--- Variables
speed = speed or 1
--
local running = true
--- Main
coroutine.wrap(function()
local _tick = tick()
--
while gui and gui.Parent and running do
--- Math
local i = (tick() - _tick) * (1.0 / speed)
if i >= 1 then
_tick = tick()
i = 0
end
--- Apply
gui[property] = Color3.fromHSV(i, 1, 1)
--- Wait
_L.Services.RunService.Stepped:wait()
end
end)()
--- Return function to cancel this behavior
return function()
running = false
end
end
|
-- services |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
|
--Rescripted by Luckymaxer |
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
ServerControl = Tool:WaitForChild("ServerControl")
ClientControl = Tool:WaitForChild("ClientControl")
ClientControl.OnClientInvoke = (function(Mode, Value)
if Mode == "PlaySound" and Value then
Value:Play()
end
end)
function InvokeServer(Mode, Value, arg)
pcall(function()
ServerControl:InvokeServer(Mode, Value, arg)
end)
end
function Equipped(Mouse)
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
if not Player or not Humanoid or Humanoid.Health == 0 then
return
end
Mouse.Button1Down:connect(function()
InvokeServer("Click", true, Mouse.Hit.p)
end)
end
local function Unequipped()
end
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
--// Input Connections |
L_107_.InputBegan:connect(function(L_314_arg1, L_315_arg2)
if not L_315_arg2 and L_15_ then
if L_314_arg1.UserInputType == (Enum.UserInputType.MouseButton2 or L_314_arg1.KeyCode == Enum.KeyCode.ButtonL2) and not L_79_ and not L_78_ and not L_77_ and L_24_.CanAim and not L_74_ and L_15_ and not L_66_ and not L_67_ then
if not L_64_ then
if not L_65_ then
if L_24_.TacticalModeEnabled then
L_154_ = 0.015
L_155_ = 7
L_3_:WaitForChild("Humanoid").WalkSpeed = 7
else
L_155_ = 10
L_154_ = 0.008
L_3_:WaitForChild("Humanoid").WalkSpeed = 10
end
end
if (L_3_.Head.Position - L_5_.CoordinateFrame.p).magnitude <= 2 then
L_97_ = L_50_
end
L_133_.target = L_56_.CFrame:toObjectSpace(L_44_.CFrame).p
L_115_:FireServer(true)
L_64_ = true
end
end;
if L_314_arg1.KeyCode == Enum.KeyCode.A and L_15_ then
L_134_ = CFrame.Angles(0, 0, 0.1)
end;
if L_314_arg1.KeyCode == Enum.KeyCode.D and L_15_ then
L_134_ = CFrame.Angles(0, 0, -0.1)
end;
if L_314_arg1.KeyCode == Enum.KeyCode.E and L_15_ and not L_80_ and not L_81_ then
L_80_ = true
L_82_ = false
L_81_ = true
LeanRight()
end
if L_314_arg1.KeyCode == Enum.KeyCode.Q and L_15_ and not L_80_ and not L_82_ then
L_80_ = true
L_81_ = false
L_82_ = true
LeanLeft()
end
if L_314_arg1.KeyCode == L_24_.AlternateAimKey and not L_79_ and not L_78_ and not L_77_ and L_24_.CanAim and not L_74_ and L_15_ and not L_66_ and not L_67_ then
if not L_64_ then
if not L_65_ then
L_3_.Humanoid.WalkSpeed = 10
L_155_ = 10
L_154_ = 0.008
end
L_97_ = L_50_
L_133_.target = L_56_.CFrame:toObjectSpace(L_44_.CFrame).p
L_115_:FireServer(true)
L_64_ = true
end
end;
if L_314_arg1.UserInputType == (Enum.UserInputType.MouseButton1 or L_314_arg1.KeyCode == Enum.KeyCode.ButtonR2) and not L_79_ and not L_77_ and L_69_ and L_15_ and not L_66_ and not L_67_ and not L_74_ then
L_68_ = true
if not Shooting and L_15_ and not L_83_ then
if L_103_ > 0 then
Shoot()
end
elseif not Shooting and L_15_ and L_83_ then
if L_105_ > 0 then
Shoot()
end
end
end;
if L_314_arg1.KeyCode == (L_24_.LaserKey or L_314_arg1.KeyCode == Enum.KeyCode.DPadRight) and L_15_ and L_24_.LaserAttached then
local L_316_ = L_1_:FindFirstChild("LaserLight")
L_122_.KeyDown[1].Plugin()
end;
if L_314_arg1.KeyCode == (L_24_.LightKey or L_314_arg1.KeyCode == Enum.KeyCode.ButtonR3) and L_15_ and L_24_.LightAttached then
local L_317_ = L_1_:FindFirstChild("FlashLight"):FindFirstChild('Light')
local L_318_ = false
L_317_.Enabled = not L_317_.Enabled
end;
if L_15_ and L_314_arg1.KeyCode == (L_24_.FireSelectKey or L_314_arg1.KeyCode == Enum.KeyCode.DPadUp) and not L_79_ and not L_70_ and not L_78_ then
L_70_ = true
if L_92_ == 1 then
if Shooting then
Shooting = false
end
if L_24_.AutoEnabled then
L_92_ = 2
L_83_ = false
L_69_ = L_84_
elseif not L_24_.AutoEnabled and L_24_.BurstEnabled then
L_92_ = 3
L_83_ = false
L_69_ = L_84_
elseif not L_24_.AutoEnabled and not L_24_.BurstEnabled and L_24_.BoltAction then
L_92_ = 4
L_83_ = false
L_69_ = L_84_
elseif not L_24_.AutoEnabled and not L_24_.BurstEnabled and not L_24_.BoltAction and L_24_.ExplosiveEnabled then
L_92_ = 6
L_83_ = true
L_84_ = L_69_
L_69_ = L_85_
elseif not L_24_.AutoEnabled and not L_24_.BurstEnabled and not L_24_.BoltAction and not L_24_.ExplosiveEnabled then
L_92_ = 1
L_83_ = false
L_69_ = L_84_
end
elseif L_92_ == 2 then
if Shooting then
Shooting = false
end
if L_24_.BurstEnabled then
L_92_ = 3
L_83_ = false
L_69_ = L_84_
elseif not L_24_.BurstEnabled and L_24_.BoltAction then
L_92_ = 4
L_83_ = false
L_69_ = L_84_
elseif not L_24_.BurstEnabled and not L_24_.BoltAction and L_24_.ExplosiveEnabled then
L_92_ = 6
L_83_ = true
L_84_ = L_69_
L_69_ = L_85_
elseif not L_24_.BurstEnabled and not L_24_.BoltAction and not L_24_.ExplosiveEnabled and L_24_.SemiEnabled then
L_92_ = 1
L_83_ = false
L_69_ = L_84_
elseif not L_24_.BurstEnabled and not L_24_.BoltAction and not L_24_.SemiEnabled then
L_92_ = 2
L_83_ = false
L_69_ = L_84_
end
elseif L_92_ == 3 then
if Shooting then
Shooting = false
end
if L_24_.BoltAction then
L_92_ = 4
L_83_ = false
L_69_ = L_84_
elseif not L_24_.BoltAction and L_24_.ExplosiveEnabled then
L_92_ = 6
L_83_ = true
L_84_ = L_69_
L_69_ = L_85_
elseif not L_24_.BoltAction and not L_24_.ExplosiveEnabled and L_24_.SemiEnabled then
L_92_ = 1
L_83_ = false
L_69_ = L_84_
elseif not L_24_.BoltAction and not L_24_.SemiEnabled and L_24_.AutoEnabled then
L_92_ = 2
L_83_ = false
L_69_ = L_84_
elseif not L_24_.BoltAction and not L_24_.SemiEnabled and not L_24_.AutoEnabled then
L_92_ = 3
L_83_ = false
L_69_ = L_84_
end
elseif L_92_ == 4 then
if Shooting then
Shooting = false
end
if L_24_.ExplosiveEnabled then
L_92_ = 6
L_83_ = true
L_84_ = L_69_
L_69_ = L_85_
elseif not L_24_.ExplosiveEnabled and L_24_.SemiEnabled then
L_92_ = 1
L_83_ = false
L_69_ = L_84_
elseif not L_24_.SemiEnabled and L_24_.AutoEnabled then
L_92_ = 2
L_83_ = false
L_69_ = L_84_
elseif not L_24_.SemiEnabled and not L_24_.AutoEnabled and L_24_.BurstEnabled then
L_92_ = 3
L_83_ = false
L_69_ = L_84_
elseif not L_24_.SemiEnabled and not L_24_.AutoEnabled and not L_24_.BurstEnabled then
L_92_ = 4
L_83_ = false
L_69_ = L_84_
end
elseif L_92_ == 6 then
if Shooting then
Shooting = false
end
L_85_ = L_69_
if L_24_.SemiEnabled then
L_92_ = 1
L_83_ = false
L_69_ = L_84_
elseif not L_24_.SemiEnabled and L_24_.AutoEnabled then
L_92_ = 2
L_83_ = false
L_69_ = L_84_
elseif not L_24_.SemiEnabled and not L_24_.AutoEnabled and L_24_.BurstEnabled then
L_92_ = 3
L_83_ = false
L_69_ = L_84_
elseif not L_24_.SemiEnabled and not L_24_.AutoEnabled and not L_24_.BurstEnabled and L_24_.BoltAction then
L_92_ = 4
L_83_ = false
L_69_ = L_84_
elseif not L_24_.SemiEnabled and not L_24_.AutoEnabled and not L_24_.BurstEnabled and not L_24_.BoltAction then
L_92_ = 6
L_83_ = true
L_84_ = L_69_
L_69_ = L_85_
end
end
UpdateAmmo()
FireModeAnim()
IdleAnim()
L_70_ = false
end;
if L_314_arg1.KeyCode == (Enum.KeyCode.F or L_314_arg1.KeyCode == Enum.KeyCode.DPadDown) and not L_79_ and not L_77_ and not L_78_ and not L_67_ and not L_70_ and not L_64_ and not L_66_ and not Shooting and not L_76_ then
if not L_73_ and not L_74_ then
L_74_ = true
Shooting = false
L_69_ = false
L_135_ = time()
delay(0.6, function()
if L_103_ ~= L_24_.Ammo and L_103_ > 0 then
CreateShell()
end
end)
BoltBackAnim()
L_73_ = true
elseif L_73_ and L_74_ then
BoltForwardAnim()
Shooting = false
L_69_ = true
if L_103_ ~= L_24_.Ammo and L_103_ > 0 then
L_103_ = L_103_ - 1
elseif L_103_ >= L_24_.Ammo then
L_69_ = true
end
L_73_ = false
L_74_ = false
IdleAnim()
L_75_ = false
end
UpdateAmmo()
end;
if L_314_arg1.KeyCode == (Enum.KeyCode.LeftShift or L_314_arg1.KeyCode == Enum.KeyCode.ButtonL3) and not L_78_ and not L_77_ and L_146_ then
L_71_ = true
if L_15_ and not L_70_ and not L_67_ and L_71_ and not L_65_ and not L_74_ then
Shooting = false
L_64_ = false
L_67_ = true
delay(0, function()
if L_67_ and not L_66_ then
L_64_ = false
L_72_ = true
end
end)
L_97_ = 80
if L_24_.TacticalModeEnabled then
L_154_ = 0.4
L_155_ = 16
else
L_155_ = L_24_.SprintSpeed
L_154_ = 0.4
end
L_3_.Humanoid.WalkSpeed = L_24_.SprintSpeed
end
end;
if L_314_arg1.KeyCode == (Enum.KeyCode.R or L_314_arg1.KeyCode == Enum.KeyCode.ButtonX) and not L_79_ and not L_78_ and not L_77_ and L_15_ and not L_66_ and not L_64_ and not Shooting and not L_67_ and not L_74_ then
if not L_83_ then
if L_104_ > 0 and L_103_ < L_24_.Ammo then
Shooting = false
L_66_ = true
for L_319_forvar1, L_320_forvar2 in pairs(game.Players:GetChildren()) do
if L_320_forvar2 and L_320_forvar2:IsA('Player') and L_320_forvar2 ~= L_2_ and L_320_forvar2.TeamColor == L_2_.TeamColor then
if (L_320_forvar2.Character.HumanoidRootPart.Position - L_3_.HumanoidRootPart.Position).magnitude <= 150 then
if L_7_:FindFirstChild('AHH') and not L_7_.AHH.IsPlaying then
L_119_:FireServer(L_7_.AHH, L_100_[math.random(0, 23)])
end
end
end
end
ReloadAnim()
if L_103_ <= 0 then
if L_24_.CanSlideLock then
BoltBackAnim()
BoltForwardAnim()
end
end
IdleAnim()
L_69_ = true
if L_103_ <= 0 then
if (L_104_ - (L_24_.Ammo - L_103_)) < 0 then
L_103_ = L_103_ + L_104_
L_104_ = 0
else
L_104_ = L_104_ - (L_24_.Ammo - L_103_)
L_103_ = L_24_.Ammo
end
elseif L_103_ > 0 then
if (L_104_ - (L_24_.Ammo - L_103_)) < 0 then
L_103_ = L_103_ + L_104_ + 1
L_104_ = 0
else
L_104_ = L_104_ - (L_24_.Ammo - L_103_)
L_103_ = L_24_.Ammo + 0
end
end
L_66_ = false
if not L_75_ then
L_69_ = true
end
end;
elseif L_83_ then
if L_105_ > 0 then
Shooting = false
L_66_ = true
nadeReload()
IdleAnim()
L_66_ = false
L_69_ = true
end
end;
UpdateAmmo()
end;
if L_314_arg1.KeyCode == Enum.KeyCode.RightBracket and L_64_ then
if (L_51_ < 1) then
L_51_ = L_51_ + L_24_.SensitivityIncrement
end
end
if L_314_arg1.KeyCode == Enum.KeyCode.LeftBracket and L_64_ then
if (L_51_ > 0.1) then
L_51_ = L_51_ - L_24_.SensitivityIncrement
end
end
if L_314_arg1.KeyCode == (Enum.KeyCode.T or L_314_arg1.KeyCode == Enum.KeyCode.DPadLeft) and L_1_:FindFirstChild("AimPart2") then
if not L_86_ then
L_56_ = L_1_:WaitForChild("AimPart2")
L_50_ = L_24_.CycleAimZoom
if L_64_ then
L_97_ = L_24_.CycleAimZoom
end
L_86_ = true
else
L_56_ = L_1_:FindFirstChild("AimPart")
L_50_ = L_24_.AimZoom
if L_64_ then
L_97_ = L_24_.AimZoom
end
L_86_ = false
end;
end;
if L_314_arg1.KeyCode == L_24_.InspectionKey and not L_79_ and not L_78_ then
if not L_77_ then
L_77_ = true
InspectAnim()
IdleAnim()
L_77_ = false
end
end;
if L_314_arg1.KeyCode == L_24_.AttachmentKey and not L_79_ and not L_77_ then
if L_15_ then
if not L_78_ then
L_67_ = false
L_64_ = false
L_69_ = false
L_78_ = true
AttachAnim()
elseif L_78_ then
L_67_ = false
L_64_ = false
L_69_ = true
L_78_ = false
IdleAnim()
end
end
end;
if L_314_arg1.KeyCode == Enum.KeyCode.P and not L_77_ and not L_78_ and not L_64_ and not L_67_ and not L_65_ and not L_66_ and not Recoiling and not L_67_ then
if not L_79_ then
L_79_ = true
L_14_:Create(L_45_, TweenInfo.new(0.2), {
C1 = L_24_.SprintPos
}):Play()
wait(0.2)
L_112_:FireServer("Patrol", L_24_.SprintPos)
else
L_79_ = false
L_14_:Create(L_45_, TweenInfo.new(0.2), {
C1 = CFrame.new()
}):Play()
wait(0.2)
L_112_:FireServer("Unpatrol")
end
end;
end
end)
L_107_.InputEnded:connect(function(L_321_arg1, L_322_arg2)
if not L_322_arg2 and L_15_ then
if L_321_arg1.UserInputType == (Enum.UserInputType.MouseButton2 or L_321_arg1.KeyCode == Enum.KeyCode.ButtonL2) and not L_77_ and L_24_.CanAim and not L_78_ then
if L_64_ then
if not L_65_ then
L_3_:WaitForChild("Humanoid").WalkSpeed = 16
if L_24_.TacticalModeEnabled then
L_154_ = 0.09
L_155_ = 11
else
L_154_ = .2
L_155_ = 17
end
end
L_97_ = 70
L_133_.target = Vector3.new()
L_115_:FireServer(false)
L_64_ = false
end
end;
if L_321_arg1.KeyCode == Enum.KeyCode.A and L_15_ then
L_134_ = CFrame.Angles(0, 0, 0)
end;
if L_321_arg1.KeyCode == Enum.KeyCode.D and L_15_ then
L_134_ = CFrame.Angles(0, 0, 0)
end;
if L_321_arg1.KeyCode == Enum.KeyCode.E and L_15_ and L_80_ then
Unlean()
L_80_ = false
L_82_ = false
L_81_ = false
end
if L_321_arg1.KeyCode == Enum.KeyCode.Q and L_15_ and L_80_ then
Unlean()
L_80_ = false
L_82_ = false
L_81_ = false
end
if L_321_arg1.KeyCode == L_24_.AlternateAimKey and not L_77_ and L_24_.CanAim then
if L_64_ then
if not L_65_ then
L_3_.Humanoid.WalkSpeed = 16
L_155_ = 17
L_154_ = .25
end
L_97_ = 70
L_133_.target = Vector3.new()
L_115_:FireServer(false)
L_64_ = false
end
end;
if L_321_arg1.UserInputType == (Enum.UserInputType.MouseButton1 or L_321_arg1.KeyCode == Enum.KeyCode.ButtonR2) and not L_77_ then
L_68_ = false
if Shooting then
Shooting = false
end
end;
if L_321_arg1.KeyCode == Enum.KeyCode.E and L_15_ then
local L_323_ = L_42_:WaitForChild('GameGui')
if L_16_ then
L_323_:WaitForChild('AmmoFrame').Visible = false
L_16_ = false
end
end;
if L_321_arg1.KeyCode == (Enum.KeyCode.LeftShift or L_321_arg1.KeyCode == Enum.KeyCode.ButtonL3) and not L_77_ and not L_70_ and not L_65_ then -- SPRINT
L_71_ = false
if L_67_ and not L_64_ and not Shooting and not L_71_ then
L_67_ = false
L_72_ = false
L_97_ = 70
L_3_.Humanoid.WalkSpeed = 16
if L_24_.TacticalModeEnabled then
L_154_ = 0.09
L_155_ = 11
else
L_154_ = .2
L_155_ = 17
end
end
end;
end
end)
L_107_.InputChanged:connect(function(L_324_arg1, L_325_arg2)
if not L_325_arg2 and L_15_ and L_24_.FirstPersonOnly and L_64_ then
if L_324_arg1.UserInputType == Enum.UserInputType.MouseWheel then
if L_324_arg1.Position.Z == 1 and (L_51_ < 1) then
L_51_ = L_51_ + L_24_.SensitivityIncrement
elseif L_324_arg1.Position.Z == -1 and (L_51_ > 0.1) then
L_51_ = L_51_ - L_24_.SensitivityIncrement
end
end
end
end)
L_107_.InputChanged:connect(function(L_326_arg1, L_327_arg2)
if not L_327_arg2 and L_15_ then
local L_328_, L_329_ = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_56_.CFrame.p, (L_56_.CFrame.lookVector).unit * 10000), IgnoreList);
if L_328_ then
local L_330_ = (L_329_ - L_6_.Position).magnitude
L_33_.Text = math.ceil(L_330_) .. ' m'
end
end
end)
|
-- The subset of a Promise that React APIs rely on. This resolves a value.
-- This doesn't require a return value neither from the handler nor the
-- then function.
-- ROBLOX FIXME: workaround for Luau recursive type used with different parameters. delete this copy once that issue is resolved. |
export type _Thenable<R> = {
andThen: <U>(
self: _Thenable<R>,
onFulfill: (R) -> () | U,
onReject: (error: any) -> () | U
) -> (),
}
export type Thenable<R> = {
andThen: <U>(
self: Thenable<R>,
onFulfill: (R) -> () | _Thenable<U> | U,
onReject: (error: any) -> () | _Thenable<U> | U
-- ROBLOX FIXME Luau: need union type packs to parse () | Thenable<U>: CLI-49836
) -> nil | _Thenable<U>,
}
return exports
|
--Funcion Del AutoClick |
local plr = script.Parent.Parent.Parent
local timeAuto = plr.PlayerStats.timeAuto
local lea = plr:WaitForChild("leaderstats")-- Nombre De La Carpeta De Su Sistema De Dinero
local gold = lea:WaitForChild("TimesClicked")-- Nombre De Su Sistema De Dinero
local coin = lea:WaitForChild("Coins")-- Nombre De Su Sistema De Dinero
local boost = plr:WaitForChild("CoinBoost")-- Nombre De Su Sistema De Dinero
local world = plr:WaitForChild("WorldBoost")-- Nombre De Su Sistema De Dinero
local autoclick = false
local autoclickDD = false
function GetAuto()
gold.Value = gold.Value +1 --Cambiar Por Cuanto Dinero Quieres Que Obtenga
coin.Value = coin.Value + 1 + 1*boost.Value*world.Value
end
script.Parent.AutoClick.MouseButton1Click:Connect(function()
if autoclick == false then
autoclick = true
script.Parent.AutoClick.Text = "ON"
else
autoclick = false
script.Parent.AutoClick.Text = "OFF"
end
end)
while wait()do
if autoclick == true then
if autoclickDD == false then
autoclickDD = true
GetAuto(1)-- Cambia El Tiempo De Espera Al Recargar
wait(timeAuto.Value)-- Tambien Cambia Para El Tiempo De Espera Al Recargar
autoclickDD = false
end
end
end
|
-- Given element.props.children, or subtree during recursive traversal,
-- return flattened array of children. |
local function getChildren(arg: unknown, children_: Array<unknown>?)
local children = children_ or {}
if Array.isArray(arg) then
Array.forEach(arg :: Array<unknown>, function(item)
getChildren(item, children)
end)
elseif arg ~= nil and arg ~= false then
table.insert(children, arg)
end
return children
end
local function getType(element: any)
local type_ = element.type
if typeof(type_) == "string" then
return type_
end
-- ROBLOX deviation START: functions can't have properties in Lua
if typeof(type_) == "function" then
local typeName = debug.info(type_, "n")
return if Boolean.toJSBoolean(typeName) then typeName else "Unknown"
end
if typeof(type_) == "table" then
local metatable = getmetatable(type_)
if metatable ~= nil and typeof(metatable.__call) == "function" then
return if Boolean.toJSBoolean(type_.displayName)
then type_.displayName
elseif Boolean.toJSBoolean(type_.name) then type_.name
else "Unknown"
end
end
-- ROBLOX deviation END
if ReactIs.isFragment(element) then
return "React.Fragment"
end
if ReactIs.isSuspense(element) then
return "React.Suspense"
end
if typeof(type_) == "table" and type_ ~= nil then
if ReactIs.isContextProvider(element) then
return "Context.Provider"
end
if ReactIs.isContextConsumer(element) then
return "Context.Consumer"
end
if ReactIs.isForwardRef(element) then
if Boolean.toJSBoolean(type_.displayName) then
return type_.displayName
end
-- ROBLOX deviation START: check if type_.render is callable table
local functionName = if typeof(type_.render) == "function"
and Boolean.toJSBoolean(debug.info(type_.render, "n"))
then debug.info(type_.render, "n")
else if typeof(type_.render) == "table"
then if Boolean.toJSBoolean(type_.render.displayName)
then type_.render.displayName
elseif Boolean.toJSBoolean(type_.render.name) then type_.render.name
else ""
else ""
-- ROBLOX deviation END
return if functionName ~= "" then "ForwardRef(" .. functionName .. ")" else "ForwardRef"
end
if ReactIs.isMemo(element) then
local functionName = if Boolean.toJSBoolean(type_.displayName)
then type_.displayName
elseif
typeof(type_.type) == "table" -- ROBLOX deviation: can't index functions in Lua
and Boolean.toJSBoolean(type_.type.displayName)
then type_.type.displayName
elseif typeof(type_.type) == "function" and Boolean.toJSBoolean(debug.info(type_.type, "n")) then
debug.info(type_.type, "n")
else ""
return if functionName ~= "" then "Memo(" .. functionName .. ")" else "Memo"
end
end
return "UNDEFINED"
end
local function getPropKeys(element: any)
local props = element.props
return Array.sort(Array.filter(Object.keys(props), function(key)
return key ~= "children" and props[key] ~= nil
end))
end
|
---Setting IDs |
for _,v in pairs(Car.Chassis:GetChildren()) do
if v.Name == "Id" then
if game.Players:FindFirstChild(CarStats.Owner.Value) then
v.S.T.Text = game.Players[CarStats.Owner.Value].UserId
end
end
end
|
---- Script: ----- |
Event.OnServerEvent:Connect(function(player, Skin)
local PlayerInventory = player.Inventory
--Skin 1 de la caja
if Skin == 1 then
player.Inventory.Asphalt.Quantity.Value += 1
elseif Skin == 2 then
player.Inventory.Camo.Quantity.Value += 1
elseif Skin == 3 then
player.Inventory.Lime.Quantity.Value += 1
elseif Skin == 4 then
player.Inventory.Maple.Quantity.Value += 1
elseif Skin == 5 then
player.Inventory.Candy.Quantity.Value += 1
elseif Skin == 6 then
player.Inventory.Cardboard.Quantity.Value += 1
elseif Skin == 7 then
player.Inventory.WhiteOut.Quantity.Value += 1
elseif Skin == 8 then
player.Inventory.Scales.Quantity.Value += 1
elseif Skin == 9 then
player.Inventory.Matrix.Quantity.Value += 1
elseif Skin == 10 then
player.Inventory.Printstream.Quantity.Value += 1
end
end)
|
-- Calls fn(...) in a separate thread and returns false if it errors or invoking client leaves the game.
-- Fail state is only checked every 0.5 seconds, so don't expect errors to return immediately |
function SafeInvokeCallback(handler, ...)
local finished = false
local callbackThread
local invokeThread
local result
local function finish(...)
if not finished then
finished = true
result = table.pack(...)
if invokeThread then
ResumeThread(invokeThread)
end
end
end
FastSpawn(function(...)
callbackThread = coroutine.running()
finish(true, handler.Callback(...))
end, ...)
if not finished then
local client = IsServer and (...)
coroutine.wrap(function()
while not finished and coroutine.status(callbackThread) ~= "dead" do
if IsServer and client.Parent ~= Players then
break
end
wait(0.5)
end
finish(false)
end)()
end
if not finished then
invokeThread = coroutine.running()
YieldThread()
end
return unpack(result)
end
function SafeInvoke(timeout, handler, ...)
local thread = coroutine.running()
local finished = false
local result
coroutine.wrap(function(...)
if IsServer then
result = table.pack(pcall(function(...) return handler.Remote:InvokeClient(...) end, ...))
else
result = table.pack(pcall(function(...) return handler.Remote:InvokeServer(...) end, ...))
end
if not finished then
finished = true
ResumeThread(thread)
end
end)(...)
if typeof(timeout) == "number" then
delay(timeout, function()
if not finished then
finished = true
ResumeThread(thread)
end
end)
end
YieldThread()
if result and result[1] == true and result[2] == true then
return true, unpack(result, 3)
end
return false
end
function SafeFireEvent(handler, ...)
local callbacks = handler.Callbacks
local index = #callbacks
while index > 0 do
local running = true
FastSpawn(function(...)
while running and index > 0 do
local fn = callbacks[index]
index -= 1
fn(...)
end
end, ...)
running = false
end
end
|
--Disable script if car is removed from workspace |
Car.AncestryChanged:Connect(function()
if not Car:IsDescendantOf(Workspace) then
unbindActions()
LocalVehicleSeating.ExitSeat()
LocalVehicleSeating.DisconnectFromSeatExitEvent(onExitSeat)
-- stop seated anim
print("car removed from workspace")
script.Disabled = true
end
end)
local function getInputValue(keyInfo, inputObj)
for _, keyCodeInfo in ipairs(keyInfo) do
if inputObj.KeyCode == keyCodeInfo.KeyCode then
if keyCodeInfo.Axis then
local inputVector = inputObj.Position * keyCodeInfo.Axis
local sign = math.sign(inputVector.X + inputVector.Y + inputVector.Z)
return inputVector.magnitude * sign
else
return 1
end
end
end
return 0
end
local function exitVehicle(action, inputState, inputObj)
if inputState == Enum.UserInputState.Begin then
LocalVehicleSeating.ExitSeat()
-- stop seated anim
end
end
ContextActionService:BindAction(
EXIT_ACTION_NAME,
exitVehicle,
false,
Keymap.EnterVehicleGamepad,
Keymap.EnterVehicleKeyboard
)
local function steerLeftAction(action, inputState, inputObj)
if inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Change then
SteerLeftValue = getInputValue(Keymap.SteerLeft, inputObj)
else
SteerLeftValue = 0
end
return Enum.ContextActionResult.Pass
end
ContextActionService:BindActionAtPriority(
STEER_LEFT_ACTION_NAME,
steerLeftAction,
false,
Enum.ContextActionPriority.High.Value,
unpack(Keymap.KeysForAction("SteerLeft"))
)
local function steerRightAction(action, inputState, inputObj)
if inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Change then
SteerRightValue = getInputValue(Keymap.SteerRight, inputObj)
else
SteerRightValue = 0
end
return Enum.ContextActionResult.Pass
end
ContextActionService:BindActionAtPriority(
STEER_RIGHT_ACTION_NAME,
steerRightAction,
false,
Enum.ContextActionPriority.High.Value,
unpack(Keymap.KeysForAction("SteerRight"))
)
local function throttleAction(action, inputState, inputObj)
if inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Change then
ThrottleValue = getInputValue(Keymap.Throttle, inputObj)
else
ThrottleValue = 0
end
end
ContextActionService:BindAction(
THROTTLE_ACTION_NAME,
throttleAction,
false,
unpack(Keymap.KeysForAction("Throttle"))
)
local function brakeAction(action, inputState, inputObj)
if inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Change then
BrakeValue = getInputValue(Keymap.Brake, inputObj)
else
BrakeValue = 0
end
end
ContextActionService:BindAction(
BRAKE_ACTION_NAME,
brakeAction,
false,
unpack(Keymap.KeysForAction("Brake"))
)
local function handBrakeAction(action, inputState, inputObj)
if inputState == Enum.UserInputState.Begin then
HandBrakeValue = 1
else
HandBrakeValue = 0
end
end
ContextActionService:BindAction(
HAND_BRAKE_ACTION_NAME,
handBrakeAction,
false,
unpack(Keymap.KeysForAction("Handbrake"))
)
|
--// Recoil Settings |
gunrecoil = -0.75; -- How much the gun recoils backwards when not aiming
camrecoil = 1.06; -- How much the camera flicks when not aiming
AimGunRecoil = -0.75; -- How much the gun recoils backwards when aiming
AimCamRecoil = 0.83; -- How much the camera flicks when aiming
CamShake = 7; -- THIS IS NEW!!!! CONTROLS CAMERA SHAKE WHEN FIRING
AimCamShake = 5; -- THIS IS ALSO NEW!!!!
Kickback = 12.2; -- Upward gun rotation when not aiming
AimKickback = 9.11; -- Upward gun rotation when aiming
|
--collect :GetFriendsOnline() calls from the clients - use the results to verify friendships between users, store them in this script so that other aspects of the game can use the IsFriendsWith BindableFunction to check | |
------------------------------------------------------------------------
--
-- * used in (lparser) luaY:whilestat(), luaY:repeatstat(), luaY:forbody()
------------------------------------------------------------------------ |
function luaK:patchlist(fs, list, target)
if target == fs.pc then
self:patchtohere(fs, list)
else
assert(target < fs.pc)
self:patchlistaux(fs, list, target, luaP.NO_REG, target)
end
end
|
--[[ Constants ]] | --
local DPAD_SHEET = "rbxasset://textures/ui/DPadSheet.png"
local TOUCH_CONTROL_SHEET = "rbxasset://textures/ui/TouchControlsSheet.png"
local ZERO_VECTOR3 = Vector3.new(0,0,0)
local UNIT_Z = Vector3.new(0,0,1)
local UNIT_X = Vector3.new(1,0,0)
|
-- setup emote chat hook |
game:GetService("Players").LocalPlayer.Chatted:Connect(function(msg)
local emote = ""
if msg == "/e dance" then
emote = dances[math.random(1, #dances)]
elseif (string.sub(msg, 1, 3) == "/e ") then
emote = string.sub(msg, 4)
elseif (string.sub(msg, 1, 7) == "/emote ") then
emote = string.sub(msg, 8)
end
if (pose == "Standing" and emoteNames[emote] ~= nil) then
playAnimation(emote, 0.1, Humanoid)
end
end)
|
--[[
Check if all humanoids has completed animation for hiding/showing.
]] |
modules.waitForHumanoidAnimations = function(self)
return function()
for _, humanoidController in pairs(self.humanoidControllers) do
if humanoidController:isAnimating() then
humanoidController.animationCompleted.Event:Wait()
end
end
end
end
modules.getModelFace = function()
return function(model)
local face = model:GetAttribute(constants.Attributes.SurfaceCanvasFace)
if not face then
return Enum.NormalId.Front
end
-- Case insensitive to make it more user friendly
face = string.lower(face)
for _, enum in ipairs(Enum.NormalId:GetEnumItems()) do
if string.lower(enum.Name) == string.lower(face) then
return enum
end
end
warn("[SurfaceArt] Face provided is in attributes is invalid, defaulting to Front")
return Enum.NormalId.Front
end
end
modules.cleanup = function(self)
return function()
self.userInputController:enable()
self.guiController:enable()
self.cameraModule:animateToHumanoidAsync()
end
end
return modules
|
--Formula secreta de don cangrejo |
local RebirthFormule = game:GetService("ReplicatedStorage").GameProperties.RebirthFormule
local Formula = RebirthFormule.Value + (RebirthFormule.Value * Multiplier.Value)
if Points.Value >= Formula then
Text.TextColor3 = Color3.new(0, 1, 0.14902)
Text.Text = "Rebirth available!"
else
Text.TextColor3 = Color3.new(1, 0, 0.0156863)
Text.Text = "You dont have enough points to rebirth!"
end
Points.Changed:Connect(function()
local FormulaUpdate = RebirthFormule.Value + (RebirthFormule.Value * Multiplier.Value)
if Points.Value >= FormulaUpdate then
Text.TextColor3 = Color3.new(0, 1, 0.14902)
Text.Text = "Rebirth available!"
else
Text.TextColor3 = Color3.new(1, 0, 0.0156863)
Text.Text = "You dont have enough points to rebirth!"
end
end)
|
-- SETUP ICON TEMPLATE |
local topbarPlusGui = Instance.new("ScreenGui")
topbarPlusGui.Enabled = true
topbarPlusGui.DisplayOrder = 0
topbarPlusGui.IgnoreGuiInset = true
topbarPlusGui.ResetOnSpawn = false
topbarPlusGui.Name = "TopbarPlus"
local activeItems = Instance.new("Folder")
activeItems.Name = "ActiveItems"
activeItems.Parent = topbarPlusGui
local topbarContainer = Instance.new("Frame")
topbarContainer.BackgroundTransparency = 1
topbarContainer.Name = "TopbarContainer"
topbarContainer.Position = UDim2.new(0, 0, 0, 0)
topbarContainer.Size = UDim2.new(1, 0, 0, 36)
topbarContainer.Visible = true
topbarContainer.ZIndex = 1
topbarContainer.Parent = topbarPlusGui
topbarContainer.Active = false
local iconContainer = Instance.new("Frame")
iconContainer.BackgroundTransparency = 1
iconContainer.Name = "IconContainer"
iconContainer.Position = UDim2.new(0, 104, 0, 4)
iconContainer.Visible = false
iconContainer.ZIndex = 1
iconContainer.Parent = topbarContainer
iconContainer.Active = false
local iconButton = Instance.new("TextButton")
iconButton.Name = "IconButton"
iconButton.Visible = true
iconButton.Text = ""
iconButton.ZIndex = 10--2
iconButton.BorderSizePixel = 0
iconButton.AutoButtonColor = false
iconButton.Parent = iconContainer
iconButton.Active = false
local iconImage = Instance.new("ImageLabel")
iconImage.BackgroundTransparency = 1
iconImage.Name = "IconImage"
iconImage.AnchorPoint = Vector2.new(0, 0.5)
iconImage.Visible = true
iconImage.ZIndex = 11--3
iconImage.ScaleType = Enum.ScaleType.Fit
iconImage.Parent = iconButton
iconImage.Active = false
local iconLabel = Instance.new("TextLabel")
iconLabel.BackgroundTransparency = 1
iconLabel.Name = "IconLabel"
iconLabel.AnchorPoint = Vector2.new(0, 0.5)
iconLabel.Position = UDim2.new(0.5, 0, 0.5, 0)
iconLabel.Text = ""
iconLabel.RichText = true
iconLabel.TextScaled = false
iconLabel.ClipsDescendants = true
iconLabel.ZIndex = 11--3
iconLabel.Parent = iconButton
iconLabel.Active = false
local iconGradient = Instance.new("UIGradient")
iconGradient.Name = "IconGradient"
iconGradient.Enabled = true
iconGradient.Parent = iconButton
local iconCorner = Instance.new("UICorner")
iconCorner.Name = "IconCorner"
iconCorner.Parent = iconButton
local iconOverlay = Instance.new("Frame")
iconOverlay.Name = "IconOverlay"
iconOverlay.BackgroundTransparency = 1
iconOverlay.Position = iconButton.Position
iconOverlay.Size = UDim2.new(1, 0, 1, 0)
iconOverlay.Visible = true
iconOverlay.ZIndex = iconButton.ZIndex + 1
iconOverlay.BorderSizePixel = 0
iconOverlay.Parent = iconContainer
iconOverlay.Active = false
local iconOverlayCorner = iconCorner:Clone()
iconOverlayCorner.Name = "IconOverlayCorner"
iconOverlayCorner.Parent = iconOverlay
|
-- ROBLOX upstream: https://github.com/facebook/jest/tree/v27.4.7/packages/jest-util/src/createDirectory.ts | |
-- ROBLOX FIXME: workaround for defult generic param |
export type RawMatcherFn_ = RawMatcherFn<MatcherState> |
-- RIGHT HERE IS THE SETTINGS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
module.BubbleChatEnabled = true
module.ClassicChatEnabled = true
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.