prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
---Engine |
function Engine()
script.Parent:WaitForChild("Gauges")
script.Parent:WaitForChild("Status")
local down1
local down2
local Drive={
car.Wheels.FL:GetChildren(),
car.Wheels.FR:GetChildren(),
car.Wheels.RL:GetChildren(),
car.Wheels.RR:GetChildren()
}
local Tc={
Speed=0,
ThrotAccel=.1,
ThrotDecay=.4,
ClutchAccel=.1,
ClutchDecay=.5,
FreeAccel=.1,
FreeDecay=.01,
BrakeAccel=.5,
BrakeDecay=.5,
ExpGradient=2,
MaxTorque=100000,
BrakeMaxTorque=100000,
BExpGradient=2,
Brakes=4000, --Brake Force
ClutchGain=6000,
ClutchStall=0,
ShiftSpeed=.3,
ClutchShiftSpeed=.7,
RevBounceP=.93,
VariableThrotAdj=.1,
Trans={
-- Tuning: http://i.imgur.com/wbHZPI7.png
-- [1] [2] [3] [4] [5] [6] [7] [8] [9]
-- {Int Tq , Peak Tq , Peak Sp , Max Sp , Tq Decay, Limiter , C Tolerance , C Gain , C Stall }
{14000 , 19000 , 60 , 100 , 17 , 8 , .7 , .5 , 0 }, --1st
{10000 , 12000 , 90 , 120 , 20 , 10 , .2 , .3 , 0 }, --2nd
{8000 , 10000 , 170 , 150 , 27 , 13 , .1 , .2 , 0 }, --3rd
{5000 , 9000 , 220 , 200 , 28 , 20 , .08 , .15 , 0 }, --4th
{2500 , 8800 , 260 , 230 , 50 , 30 , .06 , .1 , 0 },
{2500 , 8400 , 260 , 260 , 50 , 30 , .06 , .1 , 0 },
{2500 , 8000 , 260 , 290 , 50 , 30 , .06 , .1 , 0 }, --5th --6th
},
ReverseTq=14000, --Reverse Torque
ReverseSp=30, --Max Reverse Speed
FDiffPerc=-.2, --Front Differential (-1 -> 1) *value < 0 is outer wheel biased
CDiffPerc=.25, --Center Differential (-1 -> 1) *value < 0 is front biased
RDiffPerc=-.2, --Rear Differential (-1 -> 1) *value < 0 is outer wheel biased
DTrainDist=-.5, --Power Distribution (See below diagram)
-- Rear <-|-------|-------|-------|-------|-> Front
-- Biased -1 0 1 Biased
-- RWD AWD FWD
-------------------------------------------
ThrotP=0,
MaxThrotP=1,
BrakeP=0,
ClutchP=0,
Throttle=0,
Brake=0,
Clutch=0,
Gear=1,
GearShift=1,
PrevGear=1,
RPM=0,
Units={
{"SPS",1},
{"MPH",.682},
{"KPH",1.097}
},
CUnit=1
}
local Friction={
TractionControl=true,
FDownforce=0000, --Front Downforce (Unsprung)
RDownforce=40000, --Rear Downforce (Unsprung)
FFChange=0,
FTolerance=10,
FMaxDiff=40,
FDecay=1,
FGripGain=1,
RFChange=-40000,
RTolerance=10,
RMaxDiff=40,
RDecay=.01,
RGripGain=.01,
PBrakeForce=40000,
SkidTol=40,
-----------------------------------------
PBrake=false,
FSkid=0,
RSkid=0,
}
for i,v in pairs(Drive) do
for n,a in pairs(v) do
if a.Wheel:FindFirstChild("#AV") then
a.Wheel:FindFirstChild("#AV"):Destroy()
end
local AV=Instance.new("BodyAngularVelocity",a.Wheel)
AV.Name="#AV"
AV.angularvelocity=Vector3.new(0,0,0)
AV.maxTorque=Vector3.new(0,0,0)
AV.P=Tc.MaxTorque
end
end
mouse.Button1Up:connect(function() down1=false end)
mouse.Button1Down:connect(function() down1=true end)
mouse.Button2Up:connect(function() down2=false end)
mouse.Button2Down:connect(function() down2=true end)
mouse.WheelForward:connect(function()
if GMode==1 then
Tc.MaxThrotP=math.min(1,Tc.MaxThrotP+Tc.VariableThrotAdj)
end
end)
mouse.WheelBackward:connect(function()
if GMode==1 then
Tc.MaxThrotP=math.max(0,Tc.MaxThrotP-Tc.VariableThrotAdj)
end
end)
mouse.KeyDown:connect(function(key)
if key=="q" then
Tc.PrevGear=Tc.Gear
Tc.GearShift=0
Tc.Gear=math.max(Tc.Gear-1,-1)
elseif key=="e" then
Tc.PrevGear=Tc.Gear
Tc.GearShift=0
Tc.Gear=math.min(Tc.Gear+1,#Tc.Trans)
elseif (string.byte(key)==48 and GMode==1) or (key=="p" and GMode==0) then
Friction.PBrake=1
elseif (key=="w" and GMode==1) or (string.byte(key)==48 and GMode==0) then
Tc.Clutch=1
elseif key=="t" then
Friction.TractionControl=not Friction.TractionControl
end
end)
mouse.KeyUp:connect(function(key)
if (string.byte(key)==48 and GMode==1) or (key=="p" and GMode==0) then
Friction.PBrake=0
elseif (key=="w" and GMode==1) or (string.byte(key)==48 and GMode==0) then
Tc.Clutch=0
end
end)
local function AChassis()
if GMode==0 then
Tc.MaxThrotP=1
Tc.MaxBrakeP=1
Tc.Throttle=math.max(car.DriveSeat.Throttle,0)
Tc.Brake=math.max(-car.DriveSeat.Throttle,0)
elseif GMode==1 then
Tc.MaxBrakeP=1
if down1 then
Tc.Throttle=1
else
Tc.Throttle=0
end
if down2 then
Tc.Brake=1
else
Tc.Brake=0
end
else
Friction.PBrake=ButtonL1
Tc.Clutch=ButtonR1
Tc.Throttle=math.ceil(RTriggerValue)
Tc.MaxThrotP=RTriggerValue
Tc.Brake=math.ceil(LTriggerValue)
Tc.MaxBrakeP=LTriggerValue^Tc.BExpGradient
if Tc.ControllerGUp==0 and ButtonY==1 then
Tc.PrevGear=Tc.Gear
Tc.GearShift=0
Tc.Gear=math.min(Tc.Gear+1,#Tc.Trans)
elseif Tc.ControllerGDown==0 and ButtonX==1 then
Tc.PrevGear=Tc.Gear
Tc.GearShift=0
Tc.Gear=math.max(Tc.Gear-1,-1)
end
Tc.ControllerGUp=ButtonY
Tc.ControllerGDown=ButtonX
end
if Tc.Throttle==1 then
Tc.ThrotP=math.min(Tc.MaxThrotP,Tc.ThrotP+Tc.ThrotAccel)
else
Tc.ThrotP=math.max(0,Tc.ThrotP-Tc.ThrotDecay)
end
if Tc.Brake==1 then
Tc.BrakeP=math.min(Tc.MaxBrakeP,Tc.BrakeP+Tc.BrakeAccel)
else
Tc.BrakeP=math.max(0,Tc.BrakeP-Tc.BrakeDecay)
end
if Tc.Clutch==1 or Tc.Gear==0 then
Tc.ClutchP=math.max(0,Tc.ClutchP-Tc.ClutchDecay)
else
Tc.ClutchP=math.min(1,Tc.ClutchP+Tc.ClutchAccel)
end
-------------
Tc.GearShift=math.min(1,Tc.GearShift+Tc.ShiftSpeed+(Tc.ClutchShiftSpeed*(1-Tc.ClutchP)))
---GearChangeBeta
local tol=Tc.Trans[math.max(Tc.Gear,1)][7]
local NSGear=Tc.Trans[math.max(Tc.Gear,1)][4]+Tc.Trans[math.max(Tc.Gear,1)][6]+3
local OSGear=Tc.Trans[math.max(Tc.PrevGear,1)][4]+Tc.Trans[math.max(Tc.PrevGear,1)][6]+3
local toprev=OSGear+((NSGear-OSGear)*Tc.GearShift)
local gearDiff=(Tc.RPM*NSGear)-(Tc.RPM*OSGear)
local stall=1
local stalltq=0
if math.abs(gearDiff)>tol then
stall=Tc.GearShift
if gearDiff>0 then
stalltq=Tc.Trans[Tc.Gear][8]*(1-Tc.GearShift)
else
stalltq=Tc.Trans[Tc.Gear][9]*(1-Tc.GearShift)
end
end
-------------
local frev=0
local rrev=0
for i,v in pairs(Drive[1]) do
frev=math.max(frev,v.Wheel.RotVelocity.Magnitude)
end
for i,v in pairs(Drive[2]) do
frev=math.max(frev,v.Wheel.RotVelocity.Magnitude)
end
for i,v in pairs(Drive[3]) do
rrev=math.max(rrev,v.Wheel.RotVelocity.Magnitude)
end
for i,v in pairs(Drive[4]) do
rrev=math.max(rrev,v.Wheel.RotVelocity.Magnitude)
end
local rev=rrev/toprev
if Tc.DTrainDist==1 then
rev=frev/toprev
elseif Tc.DTrainDist~=-1 then
rev=math.max(rev,frev/toprev)
end
local rGain=(Tc.ThrotP*2)-1
if rGain>0 then
rGain=rGain*Tc.FreeAccel
else
rGain=rGain*Tc.FreeDecay
end
Tc.RPM=math.min(1,math.max(0,rev*Tc.ClutchP^.3,(Tc.RPM+rGain)*(1-Tc.ClutchP)^.3))
-- A-Chassis 5.0
for i,a in pairs(Drive) do
for n,v in pairs(a) do
local tq=0
if Tc.Gear>0 then
Tc.Speed=toprev
if v.Wheel.RotVelocity.Magnitude<Tc.Trans[Tc.Gear][4] then
local tPerc=math.min(v.Wheel.RotVelocity.Magnitude/Tc.Trans[Tc.Gear][3],1)
local tqChange=Tc.Trans[Tc.Gear][2]-Tc.Trans[Tc.Gear][1]
tq=(Tc.Trans[Tc.Gear][1]+(tPerc*tqChange))
else
if v.Wheel.RotVelocity.Magnitude<Tc.Trans[Tc.Gear][4]+Tc.Trans[Tc.Gear][6]-1 then
local tPerc=(v.Wheel.RotVelocity.Magnitude-Tc.Trans[Tc.Gear][4])/Tc.Trans[Tc.Gear][5]
local tqChange=Tc.Trans[Tc.Gear][2]
tq=(math.max(0,Tc.Trans[Tc.Gear][2]-(tPerc*tqChange)))
else
Tc.Speed=(Tc.Trans[Tc.Gear][4]+Tc.Trans[Tc.Gear][6])*Tc.RevBounceP
tq=Tc.Trans[Tc.Gear][2]*2
end
end
elseif Tc.Gear==0 then
tq=0
else
Tc.Speed=-Tc.ReverseSp
tq=Tc.ReverseTq
end
if i==1 then
tq=tq*(1-(GSteer*Tc.FDiffPerc))*(1+math.abs(GSteer*Tc.CDiffPerc))*(1+Tc.DTrainDist)
elseif i==2 then
tq=tq*(1+(GSteer*Tc.FDiffPerc))*(1+math.abs(GSteer*Tc.CDiffPerc))*(1+Tc.DTrainDist)
elseif i==3 then
tq=tq*(1-(GSteer*Tc.RDiffPerc))*(1-math.abs(GSteer*Tc.CDiffPerc))*(1-Tc.DTrainDist)
else
tq=tq*(1+(GSteer*Tc.RDiffPerc))*(1-math.abs(GSteer*Tc.CDiffPerc))*(1-Tc.DTrainDist)
end
tq=tq*Tc.ThrotP*Tc.ClutchP^Tc.ExpGradient
tq=tq+(tq*stalltq)
local br=Tc.Brakes*Tc.BrakeP^Tc.ExpGradient
tq=math.abs(tq-br)
Tc.Speed=Tc.Speed*(1-math.ceil(Tc.BrakeP))
if i>2 and Friction.PBrake==1 then
Tc.Speed=0
tq=Friction.PBrakeForce
end
local Ref=v.Axle.CFrame.lookVector
local Speed=Tc.Speed
if i==1 or i==3 then Speed=-Speed end
local TqVector=1
if Friction.TractionControl then
TqVector=math.max(0,Friction.SkidTol-math.abs((v.Wheel.RotVelocity.Magnitude*(v.Wheel.Size.X/2))-v.Wheel.Velocity.Magnitude))/Friction.SkidTol
if TqVector<.7 then
script.Parent.Gauges.Speedo.TC.Visible=true
else
script.Parent.Gauges.Speedo.TC.Visible=false
end
else
script.Parent.Gauges.Speedo.TC.Visible=false
end
v.Wheel["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*tq*TqVector
v.Wheel["#AV"].angularvelocity=Ref*Speed*stall
v.Wheel["#AV"].P=Tc.MaxTorque*TqVector
end
end
end
script.Parent.Gauges.Speedo.Units.MouseButton1Click:connect(function()
if Tc.CUnit>=3 then
Tc.CUnit=1
else
Tc.CUnit=Tc.CUnit+1
end
script.Parent.Gauges.Speedo.Units.Text=Tc.Units[Tc.CUnit][1]
end)
local numbers={180354176,180354121,180354128,180354131,180354134,180354138,180354146,180354158,180354160,180354168,180355596,180354115}
local function Speedometer()
--Sound
car.DriveSeat.Rev.Pitch=car.DriveSeat.Rev.SetPitch.Value+car.DriveSeat.Rev.SetRev.Value*Tc.RPM
car.DriveSeat.Rel.Pitch=car.DriveSeat.Rel.SetPitch.Value+car.DriveSeat.Rel.SetRev.Value*Tc.RPM
car.DriveSeat.Rev.Volume=car.DriveSeat.Rev.SetVolume.Value*Tc.ThrotP
car.DriveSeat.Rel.Volume=car.DriveSeat.Rel.SetVolume.Value*(1-Tc.ThrotP)
if Tc.Throttle ~= 1 then
car.DriveSeat.Backfire.Volume=math.min(math.max((Tc.RPM-.5)/.5,0)*.7,car.DriveSeat.Backfire.Volume+.07)
else
car.DriveSeat.Backfire.Volume=math.max(car.DriveSeat.Backfire.Volume-.07,0)
end
--Afterburn
if Tc.PrevThrot~=Tc.Throttle and Tc.RPM > .6 then
local a=math.random(0,1)
if a==1 then
coroutine.resume(coroutine.create(function()
for i,v in pairs(car.Body.Exhaust:GetChildren()) do
v.Afterburn.Rate=10
end
wait(.1)
for i,v in pairs(car.Body.Exhaust:GetChildren()) do
v.Afterburn.Rate=0
end
end))
end
end
--Speedo
local fwheel=Tc.RPM*(Tc.Trans[math.max(Tc.Gear,1)][4]+Tc.Trans[math.max(Tc.Gear,1)][6])
local z1=math.min(1,math.max(0,fwheel-(Tc.Trans[math.max(Tc.Gear,1)][3]*.5))/(Tc.Trans[math.max(Tc.Gear,1)][3]-(Tc.Trans[math.max(Tc.Gear,1)][3]*.5)))
local z2=math.min(1,math.max(0,fwheel-Tc.Trans[math.max(Tc.Gear,1)][4])/Tc.Trans[math.max(Tc.Gear,1)][6])
local blue=1-z1
local red=z2*2
local green=0
if fwheel>Tc.Trans[math.max(Tc.Gear,1)][4] then
green=1-z2
else
green=math.max(.45,z1*2)
end
for i,v in pairs(script.Parent.Gauges.Tach:GetChildren()) do
local n=tonumber(string.match(v.Name, "%d+"))
if n~=nil then
if n%2 == 0 then
v.P.Size=UDim2.new(0,4,0,((1-math.abs(Tc.RPM-((n-1)/18)))^12*-40)-10)
else
v.P.Size=UDim2.new(0,6,0,((1-math.abs(Tc.RPM-((n-1)/18)))^12*-40)-10)
end
v.P.BackgroundColor3 = Color3.new(red,green,blue)
end
end
local sp=car.DriveSeat.Velocity.Magnitude*Tc.Units[Tc.CUnit][2]
if sp<1000 then
local nnn=math.floor(sp/100)
local nn=(math.floor(sp/10))-(nnn*10)
local n=(math.floor(sp)-(nn*10))-(nnn*100)
script.Parent.Gauges.Speedo.A.Image="http://www.roblox.com/asset/?id="..numbers[n+1]
if sp>=10 then
script.Parent.Gauges.Speedo.B.Image="http://www.roblox.com/asset/?id="..numbers[nn+1]
else
script.Parent.Gauges.Speedo.B.Image="http://www.roblox.com/asset/?id="..numbers[12]
end
if sp>=100 then
script.Parent.Gauges.Speedo.C.Image="http://www.roblox.com/asset/?id="..numbers[nnn+1]
else
script.Parent.Gauges.Speedo.C.Image="http://www.roblox.com/asset/?id="..numbers[12]
end
else
script.Parent.Gauges.Speedo.A.Image="http://www.roblox.com/asset/?id="..numbers[10]
script.Parent.Gauges.Speedo.B.Image="http://www.roblox.com/asset/?id="..numbers[10]
script.Parent.Gauges.Speedo.C.Image="http://www.roblox.com/asset/?id="..numbers[10]
end
if Tc.Gear>=0 then
script.Parent.Gauges.Gear.G.Image="http://www.roblox.com/asset/?id="..numbers[Tc.Gear+1]
else
script.Parent.Gauges.Gear.G.Image="http://www.roblox.com/asset/?id="..numbers[11]
end
--Status Indicators
script.Parent.Status.Clutch.B.Size=UDim2.new(0,4,-Tc.ClutchP,0)
script.Parent.Status.Throttle.B.Size=UDim2.new(0,4,-Tc.ThrotP,0)
script.Parent.Status.Brakes.B.Size=UDim2.new(0,4,-Tc.BrakeP,0)
script.Parent.Status.ThrotLimit.B.Size=UDim2.new(0,4,-Tc.MaxThrotP,0)
GSpeed=car.DriveSeat.Velocity.Magnitude
GTopSp=Tc.Trans[#Tc.Trans][4]+Tc.Trans[#Tc.Trans][6]
GRev=Tc.RPM
GThrottle=Tc.ThrotP
GBrake=Tc.BrakeP
Tc.PrevThrot=Tc.Throttle
end
local function Smoke()
local tireSP={}
for i,v in pairs(Drive) do
for n,a in pairs(v) do
if a.Wheel:FindFirstChild("Smoke")~=nil and a.Wheel:FindFirstChild("Squeal")~=nil then
if workspace:FindPartOnRay(Ray.new(a.Wheel.Position,Vector3.new(0,-a.Wheel.Size.X/2,0)),car) then
a.Wheel.Smoke.Enabled=math.abs((a.Wheel.RotVelocity.Magnitude*(a.Wheel.Size.X/2))-a.Wheel.Velocity.Magnitude)>20
a.Wheel.Squeal.Volume=math.min(1,math.max(0,math.abs((a.Wheel.RotVelocity.Magnitude*(a.Wheel.Size.X/2))-a.Wheel.Velocity.Magnitude)-20)/20)
else
a.Wheel.Smoke.Enabled=false
a.Wheel.Squeal.Volume=0
end
end
end
end
end
--run:BindToRenderStep("AChassis",Enum.RenderPriority.Last.Value,AChassis)
--run:BindToRenderStep("Speedometer",Enum.RenderPriority.Last.Value,Speedometer)
--run:BindToRenderStep("Smoke",Enum.RenderPriority.Last.Value,Smoke)
--table.insert(Binded,"AChassis")
--table.insert(Binded,"Speedometer")
--table.insert(Binded,"Smoke")
table.insert(LoopRun,AChassis)
table.insert(LoopRun,Speedometer)
table.insert(LoopRun,Smoke)
end
Engine() |
-- Formerly getCurrentCameraMode, this function resolves developer and user camera control settings to
-- decide which camera control module should be instantiated. The old method of converting redundant enum types |
function CameraModule:GetCameraControlChoice()
local player = Players.LocalPlayer
if player then
if self.lastInputType == Enum.UserInputType.Touch or UserInputService.TouchEnabled then
-- Touch
if player.DevTouchCameraMode == Enum.DevTouchCameraMovementMode.UserChoice then
return CameraUtils.ConvertCameraModeEnumToStandard( UserGameSettings.TouchCameraMovementMode )
else
return CameraUtils.ConvertCameraModeEnumToStandard( player.DevTouchCameraMode )
end
else
-- Computer
if player.DevComputerCameraMode == Enum.DevComputerCameraMovementMode.UserChoice then
local computerMovementMode = CameraUtils.ConvertCameraModeEnumToStandard(UserGameSettings.ComputerCameraMovementMode)
return CameraUtils.ConvertCameraModeEnumToStandard(computerMovementMode)
else
return CameraUtils.ConvertCameraModeEnumToStandard(player.DevComputerCameraMode)
end
end
end
end
function CameraModule:OnCharacterAdded(char, player)
if self.activeOcclusionModule then
self.activeOcclusionModule:CharacterAdded(char, player)
end
end
function CameraModule:OnCharacterRemoving(char, player)
if self.activeOcclusionModule then
self.activeOcclusionModule:CharacterRemoving(char, player)
end
end
function CameraModule:OnPlayerAdded(player)
player.CharacterAdded:Connect(function(char)
self:OnCharacterAdded(char, player)
end)
player.CharacterRemoving:Connect(function(char)
self:OnCharacterRemoving(char, player)
end)
end
function CameraModule:OnMouseLockToggled()
if self.activeMouseLockController then
local mouseLocked = self.activeMouseLockController:GetIsMouseLocked()
local mouseLockOffset = self.activeMouseLockController:GetMouseLockOffset()
if self.activeCameraController then
self.activeCameraController:SetIsMouseLocked(mouseLocked)
self.activeCameraController:SetMouseLockOffset(mouseLockOffset)
end
end
end
local cameraModuleObject = CameraModule.new()
local cameraApi = {}
return cameraModuleObject
|
-- Create class |
local InstancePool = {}
InstancePool.__index = InstancePool
function InstancePool.new(Timeout, GenerateCallback, CleanupCallback)
-- Prepare new pool
local self = {
Timeout = Timeout,
Generate = GenerateCallback,
Cleanup = CleanupCallback,
All = {},
Free = {},
InUse = {},
LastUse = {}
}
-- Return pool
return setmetatable(self, InstancePool)
end
function InstancePool:Release(Instance)
-- Log the last use of this instance
local ReleaseTime = tick()
self.LastUse[Instance] = ReleaseTime
-- Remove instance if not used after timeout
coroutine.resume(coroutine.create(function ()
wait(self.Timeout)
if self.LastUse[Instance] == ReleaseTime then
self:Remove(Instance)
end
end))
-- Run cleanup routine on instance
self.Cleanup(Instance)
-- Free instance
self.InUse[Instance] = nil
self.Free[Instance] = true
end
function InstancePool:Get()
-- Get free instance, or generate a new one
local Instance = next(self.Free) or self.Generate()
-- Reserve instance
self.Free[Instance] = nil
self.LastUse[Instance] = nil
self.All[Instance] = true
self.InUse[Instance] = true
-- Return instance
return Instance
end
function InstancePool:Remove(Instance)
self.Free[Instance] = nil
self.InUse[Instance] = nil
self.LastUse[Instance] = nil
self.All[Instance] = nil
Instance:Destroy()
end
function InstancePool:ReleaseAll()
for Instance in pairs(self.InUse) do
self:Release(Instance)
end
end
function InstancePool.Generate()
error('No instance generation callback specified', 2)
end
|
-- Connections |
UserInputService.DeviceAccelerationChanged:Connect(changeAcceleration)
clickButton.Activated:Connect(function(input, gameProcessed)
if cooldown then return end
if isInTutorial() then return end
local inputType = input.UserInputType
if inputType == Enum.UserInputType.MouseButton1 or inputType == Enum.UserInputType.Touch then
registerMovement()
UpdatePoints:FireServer(1)
end
end)
controller.CooldownFinished:Connect(function()
if not cooldown then return end
cooldown = false
clickButton.Image = "rbxassetid://5301573747"
end)
|
--// Logging |
local clientLog = {};
local dumplog = function() warn(":: Adonis :: Dumping client log...") for i,v in ipairs(clientLog) do warn(":: Adonis ::", v) end end;
local log = function(...) table.insert(clientLog, table.concat({...}, " ")) end;
|
--// Ammo Settings |
Ammo = 15;
StoredAmmo = 15;
MagCount = math.huge; -- If you want infinate ammo, set to math.huge EX. MagCount = math.huge;
ExplosiveAmmo = 0;
|
--[[**
ensures value is a number where min < value
@param min The minimum to use
@returns A function that will return true iff the condition is passed
**--]] |
function t.numberMinExclusive(min)
return function(value)
local success, errMsg = t.number(value)
if not success then
return false, errMsg or ""
end
if min < value then
return true
else
return false, string.format("number > %s expected, got %s", min, value)
end
end
end
|
------//High Ready Animations |
self.RightHighReady = CFrame.new(-1, -1, -1.5) * CFrame.Angles(math.rad(-160), math.rad(0), math.rad(0));
self.LeftHighReady = CFrame.new(.85,-0.35,-1.15) * CFrame.Angles(math.rad(-170),math.rad(60),math.rad(15));
|
--------LEFT DOOR -------- |
game.Workspace.doorleft.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l22.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l32.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l41.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l42.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l43.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l51.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l52.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l53.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l61.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l62.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l63.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l71.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l72.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.l73.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorleft.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value) |
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
-- STATE CHANGE HANDLERS |
function onRunning(speed)
if speed > 0.5 then
local scale = 16.0
playAnimation("walk", 0.1, Humanoid)
setAnimationSpeed(speed / scale)
pose = "Running"
else
if emoteNames[currentAnim] == nil then
playAnimation("idle", 0.1, Humanoid)
pose = "Standing"
end
end
end
function onDied()
pose = "Dead"
end
function onJumping()
playAnimation("jump", 0.1, Humanoid)
jumpAnimTime = jumpAnimDuration
pose = "Jumping"
end
function onClimbing(speed)
local scale = 5.0
playAnimation("climb", 0.1, Humanoid)
setAnimationSpeed(speed / scale)
pose = "Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
if (jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
end
pose = "FreeFall"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
pose = "Seated"
end
function onPlatformStanding()
pose = "PlatformStanding"
end
|
-- Strings |
local function Split(str, delimiter)
local start = 1
local t = {}
while true do
local pos = string.find (str, delimiter, start, true)
if not pos then
break
end
table.insert (t, string.sub (str, start, pos - 1))
start = pos + string.len (delimiter)
end
table.insert (t, string.sub (str, start))
return t
end
|
-- do not touch anything below or I will cry ~Wiz -- |
local nowplaying = ""
local requests = {
}
local http = game:GetService('HttpService')
local lists = http:JSONDecode(http:GetAsync("https://api.trello.com/1/boards/"..trelloboard.."/lists"))
for _,v in pairs(lists) do
if v.name == "Pop" then
local items = http:JSONDecode(http:GetAsync("https://api.trello.com/1/lists/"..v.id.."/cards"))
print(#items)
for _,v in pairs(items) do
if v.name:match(":") ~= nil then
local s,f = string.find(v.name,":")
table.insert(songs, string.sub(v.name,f+1))
end
end
end
end
function shuffleTable(t)
math.randomseed(tick())
assert(t, "shuffleTable() expected a table, got nil" )
local iterations = #t
local j
for i = iterations, 2, -1 do
j = math.random(i)
t[i], t[j] = t[j], t[i]
end
end
shuffleTable(songs)
local songnum = 0
function script.Parent.musicEvents.getSong.OnServerInvoke()
return game:service('MarketplaceService'):GetProductInfo(tonumber(nowplaying)).Name
end
script.Parent.musicEvents.purchaseSong.OnServerEvent:connect(function(p)
if p.userId > 0 then
game:GetService("MarketplaceService"):PromptProductPurchase(p, productId)
end
end)
local votes = {
}
function makesong()
script.Parent.Parent.Parent.Body.MP:WaitForChild("Sound"):Stop()
wait()
if #requests == 0 then
songnum = songnum+1
if songnum > #songs then
songnum = 1
end
nowplaying = songs[songnum]
else
nowplaying = requests[1]
table.remove(requests,1)
end
local thisfunctionssong = nowplaying
script.Parent.Parent.Parent.Body.MP.Sound.SoundId = "rbxassetid://"..thisfunctionssong
wait()
script.Parent.Parent.Parent.Body.MP.Sound:Play()
script.Parent.musicEvents.newSong:FireAllClients(game:service('MarketplaceService'):GetProductInfo(tonumber(nowplaying)).Name)
votes = {}
wait(script.Parent.Parent.Parent.Body.MP.Sound.TimeLength)
if "rbxassetid://"..nowplaying == "rbxassetid://"..thisfunctionssong then
makesong()
end
end
function countVotes()
local c = 0
for _,v in pairs(votes) do
if v[2] == true then
c = c +1
end
end
local remainder = #game.Players:GetPlayers() - #votes
local percent = (c + (remainder/2))/#game.Players:GetPlayers()
script.Parent.musicEvents.voteChange:FireAllClients(percent)
if percent <= 0.2 then
--skip song
makesong()
end
return
end
script.Parent.musicEvents.voteYes.OnServerEvent:connect(function(p)
for _,v in pairs(votes) do
if v[1] == p.Name then
v[2] = true
countVotes()
return
end
end
table.insert(votes, {p.Name, true})
countVotes()
end)
script.Parent.musicEvents.voteNo.OnServerEvent:connect(function(p)
for _,v in pairs(votes) do
if v[1] == p.Name then
v[2] = false
countVotes()
return
end
end
table.insert(votes, {p.Name, false})
countVotes()
end)
|
-- Game Variables |
GameSettings.intermissionDuration = 10
GameSettings.roundDuration = 30
GameSettings.minimumPlayers = 1
GameSettings.transitionStart = 3
GameSettings.transitionEnd = 3
GameSettings.pointValues = {
-- Value types must match folder names to award points correctly
LowPoints = 0,
MediumPoints = 10,
HighPoints = 15,
}
GameSettings.roundWalkSpeed = 10
GameSettings.mapName = "Arena"
return GameSettings
|
--- Creates a new spring
-- @param initial A number or Vector3 (anything with * number and addition/subtraction defined)
-- @param[opt=os.clock] clock function to use to update spring |
function Spring.new(initial, clock)
local target = initial or 0
clock = clock or os.clock
return setmetatable({
_clock = clock;
_time0 = clock();
_position0 = target;
_velocity0 = 0*target;
_target = target;
_damper = 1;
_speed = 1;
}, Spring)
end
|
--[[
Fired when PostGame is entered, throwing out a player state update, as well as transitioning the player state
]] |
function Transitions.onEnterPostGame(stateMachine, event, from, to, playerComponent)
Logger.trace(playerComponent.player.Name, " state change: ", from, " -> ", to)
playerComponent:updateStatus("currentState", to)
PlayerPostGame.enter(stateMachine, playerComponent)
end
|
--// Services |
local Workspace = game:GetService("Workspace")
local Players = game:GetService("Players")
|
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data |
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
return plrData.Classes.Super.Viper.Scourge.Value ~= true
end
|
-- Assign hotkeys for prism selection |
AssignHotkey({ 'LeftShift', 'K' }, Targeting.PrismSelect);
AssignHotkey({ 'RightShift', 'K' }, Targeting.PrismSelect);
|
-- print(headLoc) |
local hasAnyWater, WaterForce, WaterDirection = game.Workspace.Terrain:GetWaterCell(headLoc.x, headLoc.y, headLoc.z) |
--[[
Contains markers for annotating objects with types.
To set the type of an object, use `Type` as a key and the actual marker as
the value:
local foo = {
[Type] = Type.Foo,
}
]] |
local Symbol = require(script.Parent.Symbol)
local strict = require(script.Parent.strict)
local Type = newproxy(true)
local TypeInternal = {}
local function addType(name)
TypeInternal[name] = Symbol.named("Roact" .. name)
end
addType("Binding")
addType("Element")
addType("HostChangeEvent")
addType("HostEvent")
addType("StatefulComponentClass")
addType("StatefulComponentInstance")
addType("VirtualNode")
addType("VirtualTree")
function TypeInternal.of(value)
if typeof(value) ~= "table" then
return nil
end
return value[Type]
end
getmetatable(Type).__index = TypeInternal
getmetatable(Type).__tostring = function()
return "RoactType"
end
strict(TypeInternal, "Type")
return Type
|
--Protected Turn 3--: Standard GYR with a protected turn for three signal directions, two on one road and one on intersecting road |
--USES: Signal1, Signal1a, Signal2, Signal2a, Turn1, Turn1a, Turn2
while true do
PedValues = script.Parent.Parent.PedValues
SignalValues = script.Parent.Parent.SignalValues
TurnValues = script.Parent.Parent.TurnValues |
-- Tips |
DEFAULT_FORCED_GROUP_VALUES["tip"] = 1
function Icon:setTip(text)
assert(typeof(text) == "string" or text == nil, "Expected string, got "..typeof(text))
local realText = text or ""
local isVisible = realText ~= ""
local textSize = textService:GetTextSize(realText, 12, Enum.Font.GothamSemibold, Vector2.new(1000, 20-6))
self.instances.tipLabel.Text = realText
self.instances.tipFrame.Size = (isVisible and UDim2.new(0, textSize.X+6, 0, 20)) or UDim2.new(0, 0, 0, 0)
self.instances.tipFrame.Parent = (isVisible and activeItems) or self.instances.iconContainer
self.tipText = text
local tipMaid = Maid.new()
self._maid.tipMaid = tipMaid
if isVisible then
tipMaid:give(self.hoverStarted:Connect(function()
if not self.isSelected then
self:displayTip(true)
end
end))
tipMaid:give(self.hoverEnded:Connect(function()
self:displayTip(false)
end))
tipMaid:give(self.selected:Connect(function()
if self.hovering then
self:displayTip(false)
end
end))
end
self:displayTip(self.hovering and isVisible)
return self
end
function Icon:displayTip(bool)
if userInputService.TouchEnabled and not self._draggingFinger then return end
-- Determine caption visibility
local isVisible = self.tipVisible or false
if typeof(bool) == "boolean" then
isVisible = bool
end
self.tipVisible = isVisible
-- Have tip position track mouse or finger
local tipFrame = self.instances.tipFrame
if isVisible then
-- When the user moves their cursor/finger, update tip to match the position
local function updateTipPositon(x, y)
local newX = x
local newY = y
local camera = workspace.CurrentCamera
local viewportSize = camera and camera.ViewportSize
if userInputService.TouchEnabled then
--tipFrame.AnchorPoint = Vector2.new(0.5, 0.5)
local desiredX = newX - tipFrame.Size.X.Offset/2
local minX = 0
local maxX = viewportSize.X - tipFrame.Size.X.Offset
local desiredY = newY + THUMB_OFFSET + 60
local minY = tipFrame.AbsoluteSize.Y + THUMB_OFFSET + 64 + 3
local maxY = viewportSize.Y - tipFrame.Size.Y.Offset
newX = math.clamp(desiredX, minX, maxX)
newY = math.clamp(desiredY, minY, maxY)
elseif IconController.controllerModeEnabled then
local indicator = TopbarPlusGui.Indicator
local newPos = indicator.AbsolutePosition
newX = newPos.X - tipFrame.Size.X.Offset/2 + indicator.AbsoluteSize.X/2
newY = newPos.Y + 90
else
local desiredX = newX
local minX = 0
local maxX = viewportSize.X - tipFrame.Size.X.Offset - 48
local desiredY = newY
local minY = tipFrame.Size.Y.Offset+3
local maxY = viewportSize.Y
newX = math.clamp(desiredX, minX, maxX)
newY = math.clamp(desiredY, minY, maxY)
end
--local difX = tipFrame.AbsolutePosition.X - tipFrame.Position.X.Offset
--local difY = tipFrame.AbsolutePosition.Y - tipFrame.Position.Y.Offset
--local globalX = newX - difX
--local globalY = newY - difY
--tipFrame.Position = UDim2.new(0, globalX, 0, globalY-55)
tipFrame.Position = UDim2.new(0, newX, 0, newY-20)
end
local cursorLocation = userInputService:GetMouseLocation()
if cursorLocation then
updateTipPositon(cursorLocation.X, cursorLocation.Y)
end
self._hoveringMaid:give(self.instances.iconButton.MouseMoved:Connect(updateTipPositon))
end
-- Change transparency of relavent tip instances
for _, settingName in pairs(self._groupSettings.tip) do
local settingDetail = self._settingsDictionary[settingName]
settingDetail.useForcedGroupValue = not isVisible
self:_update(settingName)
end
end
|
--[[Shutdown]] |
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") then
script.Parent:Destroy()
end
end)
|
--GreenEgg-- |
Event.Hitbox.Touched:Connect(function(hit)
if hit.Parent:IsA("Tool") and hit.Parent.Name == ToolRequired2 then
if game.ReplicatedStorage.ItemSwitching.Value == true then
hit.Parent:Destroy()
end
Event.Hitbox.GreenGearHint:Destroy()
Event.GreenGear.Transparency = 0
Event.Glass.Insert:Play()
Event.LocksLeft.Value = Event.LocksLeft.Value - 1
script.Disabled = true
end
end)
Event.Hitbox.ClickDetector.MouseClick:Connect(function(plr)
if plr.Backpack:FindFirstChild(ToolRequired2) then
if game.ReplicatedStorage.ItemSwitching.Value == true then
plr.Backpack:FindFirstChild(ToolRequired2):Destroy()
end
Event.Hitbox.GreenGearHint:Destroy()
Event.GreenGear.Transparency = 0
Event.Glass.Insert:Play()
Event.LocksLeft.Value = Event.LocksLeft.Value - 1
script.Disabled = true
end
end)
|
--UI |
local feedbackMain = script.Parent.FeedbackMain
|
--print(animName .. " * " .. idx .. " [" .. origRoll .. "]") |
local anim = animTable[animName][idx].anim
if (toolAnimInstance ~= anim) then
if (toolAnimTrack ~= nil) then
toolAnimTrack:Stop()
toolAnimTrack:Destroy()
transitionTime = 0
end |
-- play the animation |
currentAnimTrack:Play(transitionTime)
currentAnim = animName
currentAnimInstance = anim |
--Unsprung Weight |
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- 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
|
-- Same extra's apply down here as well. |
game.Players.ChildRemoved:Connect(function(player)
if not pcall (function()
game.StarterGui:SetCore("ChatMakeSystemMessage", {
Text = ""..player.Name.. " has left the game.";
Color = Color3.fromRGB(170, 0, 0);
Font = Enum.Font.GothamBold;
FontSize = Enum.FontSize.Size18;
})
end) then
print ("Error")
end
end)
|
--------| Reference |-------- |
local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local Assets = game.ReplicatedStorage:WaitForChild("Assets")
local EasingStyle = _L.Settings.UIEasingStyle
|
--[[Steering]] |
Tune.SteerInner = 36 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 37 -- Outer wheel steering angle (in degrees)
Tune.SteerSpeed = .12 -- Steering increment per tick (in degrees)
Tune.ReturnSpeed = .1 -- Steering increment per tick (in degrees)
Tune.SteerDecay = 320 -- Speed of gradient cutoff (in SPS)
Tune.MinSteer = 10 -- Minimum steering at max steer decay (in percent)
Tune.MSteerExp = 1 -- Mouse steering exponential degree
--Steer Gyro Tuning
Tune.SteerD = 1000 -- Steering Dampening
Tune.SteerMaxTorque = 50000 -- Steering Force
Tune.SteerP = 100000 -- Steering Aggressiveness
|
--[[
Gets the child corresponding to a given key, respecting Roact's rules for
children. Specifically:
* If `elements` is nil or a boolean, this will return `nil`, regardless of
the key given.
* If `elements` is a single element, this will return `nil`, unless the key
is ElementUtils.UseParentKey.
* If `elements` is a table of elements, this will return `elements[key]`.
]] |
function ElementUtils.getElementByKey(elements, hostKey)
if elements == nil or typeof(elements) == "boolean" then
return nil
end
if Type.of(elements) == Type.Element then
if hostKey == ElementUtils.UseParentKey then
return elements
end
return nil
end
if typeof(elements) == "table" then
return elements[hostKey]
end
error("Invalid elements")
end
return ElementUtils
|
--///////////////////////// Constructors
--////////////////////////////////////// |
function module.new(CommandProcessor, ChatWindow)
local obj = setmetatable({}, methods)
obj.GuiObject = nil
obj.ChatBarParentFrame = nil
obj.TextBox = nil
obj.TextLabel = nil
obj.GuiObjects = {}
obj.eGuiObjectsChanged = Instance.new("BindableEvent")
obj.GuiObjectsChanged = obj.eGuiObjectsChanged.Event
obj.TextBoxConnections = {}
obj.InCustomState = false
obj.CustomState = nil
obj.TargetChannel = nil
obj.CommandProcessor = CommandProcessor
obj.ChatWindow = ChatWindow
obj.TweenPixelsPerSecond = 500
obj.TargetYSize = 0
obj.AnimParams = {}
obj.CalculatingSizeLock = false
obj.ChannelNameColors = {}
obj.UserHasChatOff = false
obj:InitializeAnimParams()
ChatSettings.SettingsChanged:connect(function(setting, value)
if (setting == "ChatBarTextSize") then
obj:SetTextSize(value)
end
end)
coroutine.wrap(function()
local success, canLocalUserChat = pcall(function()
return Chat:CanUserChatAsync(LocalPlayer.UserId)
end)
local canChat = success and (RunService:IsStudio() or canLocalUserChat)
if canChat == false then
obj.UserHasChatOff = true
obj:DoLockChatBar()
end
end)()
return obj
end
return module
|
-- << VARIABLES >>
--local frame = main.gui.MainFrame.Pages.Settings | |
--created by
------------------------------------------
--Clear And Enter |
function Clear()
print("Cleared")
Input = ""
end
script.Parent.Clear.ClickDetector.MouseClick:connect(Clear)
function Enter()
if Input == Code then
print("Entered")
Input = ""
local door = script.Parent.Parent.Door
door.CanCollide = false
door.Transparency = door.Transparency + 0.1
wait(0.1)
door.Transparency = door.Transparency + 0.1
wait(0.1)
door.Transparency = door.Transparency + 0.1
wait(0.1)
door.Transparency = door.Transparency + 0.1
wait(0.1)
door.Transparency = door.Transparency + 0.1
wait(0.1)
door.Transparency = door.Transparency + 0.1
wait(0.1)
door.Transparency = door.Transparency + 0.1
wait(0.1)
door.Transparency = 0.8
wait(3)--
door.Transparency = door.Transparency - 0.1
wait(0.1)
door.Transparency = door.Transparency - 0.1
wait(0.1)
door.Transparency = door.Transparency - 0.1
wait(0.1)
door.Transparency = door.Transparency - 0.1
wait(0.1)
door.Transparency = door.Transparency - 0.1
wait(0.1)
door.Transparency = door.Transparency - 0.1
wait(0.1)
door.Transparency = door.Transparency - 0.1
wait(0.1)
door.Transparency = 0
door.CanCollide = true
return end
Input = ""
print("Wrong Code")
end
script.Parent.Enter.ClickDetector.MouseClick:connect(Enter)
|
--[[Transmission]] |
Tune.TransModes = {"Semi"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "RPM" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 4.06 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3.80 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 3.80 , -- Reverse, Neutral, and 1st gear are required
}
Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
-- print(animName .. " " .. idx .. " [" .. origRoll .. "]") |
local anim = animTable[animName][idx].anim
-- switch animation
if (anim ~= currentAnimInstance) then
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop(transitionTime)
currentAnimTrack:Destroy()
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)
end
end
|
-- @outline // PUBLIC METHODS |
function Camera:GetCFrame(dt)
local Character = System.LocalPlayer.Character
local HRP = Character and Character:FindFirstChild("HumanoidRootPart")
if not Character or not HRP then return Cam.CFrame end
-- Compute camera rotation
local MouseDelta = UIS:GetMouseDelta()
Camera.Rotation = Camera.Rotation + MouseDelta * 0.01 * UserSettings().GameSettings.MouseSensitivity
-- Compute camera position
local HeadPosition = HRP.Position + Vector3.yAxis * 2
return CFrame.new(HeadPosition) * CFrame.fromEulerAnglesYXZ(-Camera.Rotation.Y, -Camera.Rotation.X, 0)
end
|
--[[**
ensures Roblox Region3 type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]] |
t.Region3 = primitive("Region3")
|
--| Main (copy script(below) by ytb Sakura_ChanYT) |-- |
Remote.PhongDev.OnServerEvent:Connect(function(LocalPlayer)
delay(2.05, function()
for i,v in pairs(workspace:GetDescendants()) do
if v:IsA("Model") and v:FindFirstChild("Humanoid") and v ~= LocalPlayer.Character and v.PrimaryPart and (LocalPlayer.Character.PrimaryPart.Position - v.PrimaryPart.Position).Magnitude <= Distance and v.Humanoid.Health > 0.1 then
v.Humanoid:TakeDamage(Damage)
local VeloCity = Instance.new("BodyVelocity",v.PrimaryPart) -- KnockBack
VeloCity.MaxForce = Vector3.new(90000,900000,900000)
VeloCity.Velocity = v.PrimaryPart.CFrame.LookVector * math.random(-50,75) + v.PrimaryPart.CFrame.XVector * math.random(-50,75)
Debris:AddItem(VeloCity,0.40)
end
end
end)
end)
|
-- Do NOT change anything in the script if you want it to work, unless you know how to script... | |
-- Player specific convenience variables |
local MyPlayer = nil
local MyCharacter = nil
local MyHumanoid = nil
local MyTorso = nil
local MyMouse = nil
local rot = {"100","200","300","400","500","-100","-200","-300","-400","-500"}
local pi = {"1","1","1","1.05","0.95"}
local RecoilAnim
local RecoilTrack = nil
local IconURL = Tool.TextureId -- URL to the weapon icon asset
local DebrisService = game:GetService('Debris')
local PlayersService = game:GetService('Players')
local FireSound
local OnFireConnection = nil
local OnReloadConnection = nil
local DecreasedAimLastShot = false
local LastSpreadUpdate = time()
|
--------------------) Settings |
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 0 -- cooldown for use of the tool again
ZoneModelName = "Fresh tentacles" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage |
--// F key, HornOn |
mouse.KeyDown:connect(function(key)
if key=="h" then
veh.Lightbar.middle.Airhorn:Play()
veh.Lightbar.middle.Wail.Volume = 0
veh.Lightbar.middle.Yelp.Volume = 0
veh.Lightbar.middle.Priority.Volume = 0
end
end)
|
-- add a wait till character is loaded in
--local rumble = require(replicatedStorage.modules.RumbleSupport) |
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = gamecams.MenuCam.CFrame
wait(.2)
Controls:Disable() -----Disable Controls
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
wait()
script.Parent.Enabled = true
if uis.GamepadEnabled then
guiService.SelectedObject = script.Parent.frame.play
replicatedStorage.settings.SleepButton.Value = "ButtonR2"
--replicatedStorage.settings.system.Value = "Console"
elseif uis.TouchEnabled then
replicatedStorage.settings.SleepButton.Value = "Touch"
--replicatedStorage.settings.system.Value = "Phone"
else -- PC
replicatedStorage.settings.SleepButton.Value = "Space"
--replicatedStorage.settings.system.Value = "PC"
end
script.Parent.frame.Settings.Frame.SleepKey.value.Text = replicatedStorage.settings.SleepButton.Value |
------------------------------------------------------------------------------------------------------------------------------
-- In production scripts that you are writing that you know you will write properly, you should not do this.
-- This is included exclusively as a result of this being an example script, and users may tweak the values incorrectly. |
assert(MAX_BULLET_SPREAD_ANGLE >= MIN_BULLET_SPREAD_ANGLE, "Error: MAX_BULLET_SPREAD_ANGLE cannot be less than MIN_BULLET_SPREAD_ANGLE!")
if (MAX_BULLET_SPREAD_ANGLE > 180) then
warn("Warning: MAX_BULLET_SPREAD_ANGLE is over 180! This will not pose any extra angular randomization. The value has been changed to 180 as a result of this.")
MAX_BULLET_SPREAD_ANGLE = 180
end
|
--returns the wielding player of this tool |
function getPlayer()
local char = Tool.Parent
return game:GetService("Players"):GetPlayerFromCharacter(Character)
end
function Toss(direction)
local OriginalWalkSpeed = Humanoid.WalkSpeed
OriginalWalkSpeed = OriginalWalkSpeed
Humanoid.WalkSpeed = 0
local handlePos = Vector3.new(Tool.Handle.Position.X, 0, Tool.Handle.Position.Z)
local spawnPos = Character.Head.Position
spawnPos = spawnPos + (direction * 5)
Tool.Handle.Transparency = 1
local Object = Tool.Handle:Clone()
Object.Parent = workspace
Object.Transparency = 0
Object.Swing.Pitch = math.random(90, 110)/100
Object.Swing:Play()
Object.CanCollide = true
Object.CFrame = Tool.Handle.CFrame
Object.Velocity = (direction*AttackVelocity) + Vector3.new(0,AttackVelocity/7.5,0)
Object.Fuse:Play()
Object.Sparks.Enabled = true
local rand = 11.25
Object.RotVelocity = Vector3.new(math.random(-rand,rand),math.random(-rand,rand),math.random(-rand,rand))
Object:SetNetworkOwner(getPlayer())
local ScriptClone = DamageScript:Clone()
ScriptClone.FriendlyFire.Value = FriendlyFire
ScriptClone.Damage.Value = AttackDamage
ScriptClone.Parent = Object
ScriptClone.Disabled = false
local tag = Instance.new("ObjectValue")
tag.Value = getPlayer()
tag.Name = "creator"
tag.Parent = Object
Humanoid.WalkSpeed = OriginalWalkSpeed
Tool:Destroy()
end
Remote.OnServerEvent:Connect(function(player, mousePosition)
if not AttackAble then return end
AttackAble = false
if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then
Remote:FireClient(getPlayer(), "PlayAnimation", "Animation")
end
local targetPos = mousePosition.p
local lookAt = (targetPos - Character.Head.Position).unit
Toss(lookAt)
LeftDown = true
end)
function onLeftUp()
LeftDown = false
end
Tool.Equipped:Connect(function()
Character = Tool.Parent
Humanoid = Character:FindFirstChildOfClass("Humanoid")
end)
Tool.Unequipped:Connect(function()
Character = nil
Humanoid = nil
end)
|
-- ROBLOX FIXME: Can we define ClientChatModules statically in the project config |
pcall(function() ChatLocalization = require((game:GetService("Chat") :: any).ClientChatModules.ChatLocalization :: any) end)
if ChatLocalization == nil then ChatLocalization = {} end
if not ChatLocalization.FormatMessageToSend or not ChatLocalization.LocalizeFormattedMessage then
function ChatLocalization:FormatMessageToSend(key,default) return default end
end
local errorTextColor = ChatSettings.ErrorMessageTextColor or Color3.fromRGB(245, 50, 50)
local errorExtraData = {ChatColor = errorTextColor}
local function GetWhisperChannelPrefix()
if ChatConstants.WhisperChannelPrefix then
return ChatConstants.WhisperChannelPrefix
end
return "To "
end
local function GetWhisperChannelId(userName)
return GetWhisperChannelPrefix() .. userName
end
local function Run(ChatService)
local function CanCommunicate(fromSpeaker, toSpeaker)
if RunService:IsStudio() then
return true
end
local fromPlayer = fromSpeaker:GetPlayer()
local toPlayer = toSpeaker:GetPlayer()
if fromPlayer and toPlayer then
local success, canChat = pcall(function()
return Chat:CanUsersChatAsync(fromPlayer.UserId, toPlayer.UserId)
end)
return success and canChat
end
return false
end
local function DoWhisperCommand(fromSpeaker, message, channel)
local speaker = ChatService:GetSpeaker(fromSpeaker)
local otherSpeakerInputName = message
local sendMessage = nil
if (string.sub(message, 1, 1) == "\"") then
local pos = string.find(message, "\"", 2)
if (pos) then
otherSpeakerInputName = string.sub(message, 2, pos - 1)
sendMessage = string.sub(message, pos + 2)
end
else
local first = string.match(message, "^[^%s]+")
if (first) then
otherSpeakerInputName = first
sendMessage = string.sub(message, string.len(otherSpeakerInputName) + 2)
end
end
local otherSpeakerName, otherSpeakerError
--Get the target user's UserName from the input (which could be userName or displayName)
if ChatSettings.PlayerDisplayNamesEnabled and ChatSettings.WhisperByDisplayNameEnabled then
otherSpeakerName, otherSpeakerError = DisplayNameHelpers.getUserNameFromChattedName(otherSpeakerInputName, fromSpeaker, speaker:GetNameForDisplay())
else
otherSpeakerName, otherSpeakerError = DisplayNameHelpers.getUserNameFromChattedName(otherSpeakerInputName, fromSpeaker, nil)
end
local otherSpeaker = ChatService:GetSpeaker(otherSpeakerName)
if otherSpeakerError == DisplayNameHelpers.CommandErrorCodes.ChattingToSelf then
speaker:SendSystemMessage(ChatLocalization:FormatMessageToSend("GameChat_PrivateMessaging_CannotWhisperToSelf","You cannot whisper to yourself."), channel, errorExtraData)
elseif otherSpeakerError == DisplayNameHelpers.CommandErrorCodes.NoMatches then
local msg = ChatLocalization:FormatMessageToSend(
"GameChat_MuteSpeaker_SpeakerDoesNotExist",
string.format("Speaker '%s' does not exist.", tostring(otherSpeakerInputName)),
"RBX_NAME",
tostring(otherSpeakerName))
speaker:SendSystemMessage(msg, channel, errorExtraData)
elseif otherSpeakerError == DisplayNameHelpers.CommandErrorCodes.MultipleMatches then
local matchingUsersText = DisplayNameHelpers.getUsersWithDisplayNameString(otherSpeakerInputName, fromSpeaker)
speaker:SendSystemMessage(ChatLocalization:FormatMessageToSend("InGame.Chat.Response.DisplayNameMultipleMatches", "Warning: The following users have this display name: "), channel, errorExtraData)
--Send a second message with a list of names so that the localization formatter doesn't prune it
speaker:SendSystemMessage(matchingUsersText, channel, errorExtraData)
elseif otherSpeaker then
local channelObj = ChatService:GetChannel(GetWhisperChannelId(otherSpeakerName))
if channelObj then
if not CanCommunicate(speaker, otherSpeaker) then
speaker:SendSystemMessage(ChatLocalization:FormatMessageToSend("GameChat_PrivateMessaging_CannotChat","You are not able to chat with this player."), channel, errorExtraData)
return
end
if (not speaker:IsInChannel(channelObj.Name)) then
speaker:JoinChannel(channelObj.Name)
end
if (sendMessage and (string.len(sendMessage) > 0) ) then
speaker:SayMessage(sendMessage, channelObj.Name)
end
speaker:SetMainChannel(channelObj.Name)
else
local msg = ChatLocalization:FormatMessageToSend(
"GameChat_MuteSpeaker_SpeakerDoesNotExist",
string.format("Speaker '%s' does not exist.", tostring(otherSpeakerInputName)),
"RBX_NAME",
tostring(otherSpeakerName))
speaker:SendSystemMessage(msg, channel, errorExtraData)
end
end
end
local function WhisperCommandsFunction(fromSpeaker, message, channel)
local processedCommand = false
if (string.sub(message, 1, 3):lower() == "/w ") then
DoWhisperCommand(fromSpeaker, string.sub(message, 4), channel)
processedCommand = true
elseif (string.sub(message, 1, 9):lower() == "/whisper ") then
DoWhisperCommand(fromSpeaker, string.sub(message, 10), channel)
processedCommand = true
end
return processedCommand
end
local function PrivateMessageReplicationFunction(fromSpeaker, message, channelName)
local sendingSpeaker = ChatService:GetSpeaker(fromSpeaker)
local extraData = sendingSpeaker.ExtraData
sendingSpeaker:SendMessage(message, channelName, fromSpeaker, extraData)
local toSpeaker = ChatService:GetSpeaker(string.sub(channelName, 4))
local fromSpeakerChannelId = GetWhisperChannelId(fromSpeaker)
if (toSpeaker) then
if (not toSpeaker:IsInChannel(fromSpeakerChannelId)) then
toSpeaker:JoinChannel(fromSpeakerChannelId)
end
toSpeaker:SendMessage(message, fromSpeakerChannelId, fromSpeaker, extraData)
end
return true
end
local function PrivateMessageAddTypeFunction(speakerName, messageObj, channelName)
if ChatConstants.MessageTypeWhisper then
messageObj.MessageType = ChatConstants.MessageTypeWhisper
end
end
ChatService:RegisterProcessCommandsFunction("whisper_commands", WhisperCommandsFunction, ChatConstants.StandardPriority)
local function GetWhisperChanneNameColor()
if ChatSettings.WhisperChannelNameColor then
return ChatSettings.WhisperChannelNameColor
end
return Color3.fromRGB(102, 14, 102)
end
ChatService.SpeakerAdded:connect(function(speakerName)
local speaker = ChatService:GetSpeaker(speakerName)
local speakerDisplayName
if ChatSettings.PlayerDisplayNamesEnabled and speaker:GetPlayer() then
speakerDisplayName = speaker:GetNameForDisplay() .. "(@" .. speakerName .. ")"
else
speakerDisplayName = speakerName
end
local toSpeakerChannelId = GetWhisperChannelId(speakerName)
if (ChatService:GetChannel(toSpeakerChannelId)) then
ChatService:RemoveChannel(toSpeakerChannelId)
end
local channel = ChatService:AddChannel(toSpeakerChannelId)
channel.Joinable = false
channel.Leavable = true
channel.AutoJoin = false
channel.Private = true
channel.WelcomeMessage = ChatLocalization:FormatMessageToSend("GameChat_PrivateMessaging_NowChattingWith",
"You are now privately chatting with " .. speakerDisplayName .. ".",
"RBX_NAME",
tostring(speakerDisplayName))
channel.ChannelNameColor = GetWhisperChanneNameColor()
channel:RegisterProcessCommandsFunction("replication_function", PrivateMessageReplicationFunction, ChatConstants.LowPriority)
channel:RegisterFilterMessageFunction("message_type_function", PrivateMessageAddTypeFunction)
end)
ChatService.SpeakerRemoved:connect(function(speakerName)
local whisperChannelId = GetWhisperChannelId(speakerName)
if (ChatService:GetChannel(whisperChannelId)) then
ChatService:RemoveChannel(whisperChannelId)
end
end)
end
return Run
|
--Made by Luckymaxer |
Character = script.Parent
Humanoid = Character:FindFirstChild("Humanoid")
Debris = game:GetService("Debris")
WindDirection = script:FindFirstChild("WindDirection")
Force = script:FindFirstChild("Force")
Parts = {}
BaseColor = BrickColor.new("Royal purple")
Color = BaseColor.Color
Gravity = 196.20
Duration = 3
Classes = {
BasePart = {
BrickColor = BaseColor,
Material = Enum.Material.Plastic,
Reflectance = 0,
Transparency = 0.75,
},
FileMesh = {
TextureId = "",
},
DataModelMesh = {
VertexColor = Vector3.new(Color.r, Color.g, Color.b),
},
CharacterMesh = {
BaseTextureId = 0,
OverlayTextureId = 0,
},
Shirt = {
ShirtTemplate = "",
},
Pants = {
PantsTemplate = "",
},
FaceInstance = {
Texture = "",
},
Sparkles = {
SparkleColor = Color,
Enabled = false,
},
Fire = {
Color = Color,
SecondaryColor = Color,
Enabled = false,
},
Smoke = {
Color = Color,
Enabled = false,
},
Light = {
Color = Color,
Enabled = false,
},
ParticleEmitter = {
Color = ColorSequence.new(Color, Color),
Enabled = false,
}
}
Fire = script:FindFirstChild("Fire")
Objects = {}
RemovedObjects = {}
FakeParts = {}
Hats = {}
Tools = {}
Particles = {}
function DestroyScript()
Debris:AddItem(script, 0.5)
end
function TweenNumber(Start, Goal, Time)
return ((Goal - Start) / Time)
end
function Decorate(Object)
local ObjectData = {
Object = nil,
Properties = {},
}
for i, v in pairs(Classes) do
if Object:IsA(i) then
if Object:IsA("CharacterMesh") then
local Mesh = Instance.new("SpecialMesh")
Mesh.MeshType = Enum.MeshType.FileMesh
Mesh.MeshId = ("http://www.roblox.com/asset/?id=" .. Object.MeshId)
for ii, vv in pairs(Character:GetChildren()) do
if vv:IsA("BasePart") and Object.BodyPart.Name == string.gsub(vv.Name, " ", "") then
Mesh.Parent = vv
table.insert(RemovedObjects, {Object = Object, NewObject = Mesh, Parent = Object.Parent})
Object.Parent = nil
end
end
elseif Object:IsA("BasePart") and Object.Transparency >= 1 then
else
ObjectData.Object = Object
for ii, vv in pairs(v) do
local PropertyValue = nil
local PropertyValueSet = false
pcall(function()
PropertyValue = Object[ii]
PropertyValueSet = true
Object[ii] = vv
end)
if PropertyValueSet then
ObjectData.Properties[ii] = PropertyValue
end
end
end
end
end
table.insert(Objects, ObjectData)
end
function Redesign(Parent)
for i, v in pairs(Parent:GetChildren()) do
if v ~= script then
Decorate(v)
Redesign(v)
end
end
end
if not Humanoid or not WindDirection then
DestroyScript()
return
end
for i, v in pairs(Character:GetChildren()) do
if v:IsA("Hat") or v:IsA("Tool") then
local FakeObject = v:Clone()
Decorate(FakeObject)
table.insert(((v:IsA("Hat") and Hats) or Tools), v)
for ii, vv in pairs(FakeObject:GetChildren()) do
if vv:IsA("BasePart") then
local FakePart = vv:Clone()
FakePart.Name = v.Name
table.insert(FakeParts, FakePart)
FakePart.Parent = Character
FakePart.CFrame = vv.CFrame
end
end
end
end
Humanoid:UnequipTools()
for i, v in pairs({Hats, Tools}) do
for ii, vv in pairs(v) do
vv.Parent = nil
end
end
Redesign(Character)
local GhostModel = Instance.new("Model")
GhostModel.Name = "GhostModel"
for i, v in pairs(Character:GetChildren()) do
if v:IsA("BasePart") then
if v.Name ~= "HumanoidRootPart" then
local FakePart = v:Clone()
FakePart.Name = "Part"
FakePart.CanCollide = false
for ii, vv in pairs(FakePart:GetChildren()) do
if not vv:IsA("DataModelMesh") then
vv:Destroy()
end
end
table.insert(FakeParts, FakePart)
local Mass = (v:GetMass() * Gravity ^ 2)
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.maxForce = Vector3.new(Mass, Mass, Mass)
BodyVelocity.velocity = (WindDirection.Value * Force.Value)
BodyVelocity.Parent = FakePart
FakePart.Parent = GhostModel
local FireParticle = Fire:Clone()
FireParticle.Enabled = true
table.insert(Particles, FireParticle)
FireParticle.Parent = FakePart
end
v:Destroy()
end
end
Spawn(function()
local Start = Classes.BasePart.Transparency
local End = 1
local Time = 0.75
local Rate = (1 / 30)
local Frames = (Time / Rate)
for i = 1, Frames do
local Transparency = (Start + TweenNumber(Start, End, (Frames / (i + 1))))
for ii, vv in pairs(FakeParts) do
if vv and vv.Parent then
vv.Transparency = Transparency
end
end
wait(Rate)
end
for i, v in pairs(Particles) do
v.Enabled = false
end
end)
Debris:AddItem(GhostModel, 5)
GhostModel.Parent = game:GetService("Workspace")
|
-- move the banto to the newfound goal |
walk:Play()
bg.CFrame = CFrame.new(banto.PrimaryPart.Position,goal)
bp.Position = (CFrame.new(banto.PrimaryPart.Position,goal)*CFrame.new(0,0,-100)).p
local start = tick()
repeat wait(1/2)
local ray = Ray.new(banto.PrimaryPart.Position,Vector3.new(0,-1000,0)) |
-- this function creates a function that will repeatedly call a function while the key is held |
local function HandleHoldDown(functionToHold)
local LastPressed = 0
return function(inputObject)
local CurrentTime = tick()
LastPressed = CurrentTime
while inputObject.UserInputState == Enum.UserInputState.Begin and Enabled and LastPressed == CurrentTime do
functionToHold()
wait(0.15)
end
end
end
local KnobModule = require(script.Parent.Knob)
local ReverserModule = require(script.Parent.Reverser)
local VisualizeModule = require(script.Parent.Visualization)
local AddressModule = require(script.Parent.Address)
local FunctionsModule = require(script.Parent.Functions)
|
--[[Misc]] | --
Tune.LoadDelay = 1 -- Delay before initializing chassis (in seconds, increase for more reliable initialization)
Tune.AutoStart = true -- Set to false if using manual ignition plugin
Tune.AutoUpdate = true -- Automatically applies minor updates to the chassis if any are found.
-- Will NOT apply major updates, but will notify you of any.
-- Set to false to mute notifications, or if using modified Drive.
Tune.Debug = false -- Enable to see all of the chassis parts upon initialization.
-- Useful for tuning the chassis until perfect.
-- Will turn on any value with the label (Debug)
|
--------LEFT DOOR -------- |
game.Workspace.doorleft.l11.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l12.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l13.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l41.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l42.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l43.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l71.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l72.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l73.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l21.BrickColor = BrickColor.new(133)
game.Workspace.doorleft.l22.BrickColor = BrickColor.new(133)
game.Workspace.doorleft.l23.BrickColor = BrickColor.new(133)
game.Workspace.doorleft.l51.BrickColor = BrickColor.new(133)
game.Workspace.doorleft.l52.BrickColor = BrickColor.new(133)
game.Workspace.doorleft.l53.BrickColor = BrickColor.new(133)
game.Workspace.doorleft.l31.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l32.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l33.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l61.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l62.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l63.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.pillar.BrickColor = BrickColor.new(106) |
----------------------------------------------------------------------------------------------- |
script.Parent:WaitForChild("Speedo")
script.Parent:WaitForChild("Tach")
script.Parent:WaitForChild("ln")
script.Parent:WaitForChild("Gear")
script.Parent:WaitForChild("Speed")
local player=game.Players.LocalPlayer
local mouse=player:GetMouse()
local car = script.Parent.Parent.Car.Value
car.DriveSeat.HeadsUpDisplay = false
local _Tune = require(car["A-Chassis Tune"])
local _pRPM = _Tune.PeakRPM
local _lRPM = _Tune.Redline
local currentUnits = 1
local revEnd = math.ceil(_lRPM/1000)
|
--[[[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 = nil ,
ToggleABS = nil ,
ToggleTransMode = nil ,
ToggleMouseDrive = nil ,
--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 ,
}
|
--[[Output Scaling Factor]] |
local hpScaling = _Tune.WeightScaling*12
local FBrakeForce = _Tune.FBrakeForce
local RBrakeForce = _Tune.RBrakeForce
local PBrakeForce = _Tune.PBrakeForce
if not workspace:PGSIsEnabled() then
hpScaling = _Tune.LegacyScaling*12
FBrakeForce = _Tune.FLgcyBForce
RBrakeForce = _Tune.RLgcyBForce
PBrakeForce = _Tune.LgcyPBForce
end
|
---Explosive Settings--- |
elseif Settings.Mode == "Explosive" and Settings.FireModes.Semi == true then
Gui.FText.Text = "Semi"
Settings.Mode = "Semi"
elseif Settings.Mode == "Explosive" and Settings.FireModes.Semi == false and Settings.FireModes.Burst == true then
Gui.FText.Text = "Burst"
Settings.Mode = "Burst"
elseif Settings.Mode == "Explosive" and Settings.FireModes.Semi == false and Settings.FireModes.Burst == false and Settings.FireModes.Auto == true then
Gui.FText.Text = "Auto"
Settings.Mode = "Auto"
end
Update_Gui()
end
if (key == "t") and Equipped and (not NVG or ArmaClone.AimPart:FindFirstChild("NVAim") == nil) then
if Aiming then
if ArmaClone:FindFirstChild("AimPart2") ~= nil then
if AimPartMode == 1 then
AimPartMode = 2
tweenFoV(Settings.ChangeFOV[2],120)
if Settings.FocusOnSight2 and Aiming then
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.75),{ImageTransparency = 0}):Play()
else
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
end
if Settings.ZoomAnim then
ZoomAnim()
Sprint()
end
elseif AimPartMode == 2 then
AimPartMode = 1
tweenFoV(Settings.ChangeFOV[1],120)
if Settings.FocusOnSight and Aiming then
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.75),{ImageTransparency = 0}):Play()
else
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
end
if Settings.ZoomAnim then
UnZoomAnim()
Sprint()
end
end
else
if AimPartMode == 1 then
AimPartMode = 2
tweenFoV(Settings.ChangeFOV[2], 120)
if Settings.FocusOnSight2 and Aiming then
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.75),{ImageTransparency = 0}):Play()
else
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
end
if Settings.ZoomAnim then
ZoomAnim()
Sprint()
end
elseif AimPartMode == 2 then
AimPartMode = 1
tweenFoV(Settings.ChangeFOV[1], 120)
if Settings.FocusOnSight and Aiming then
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.75),{ImageTransparency = 0}):Play()
else
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
end
if Settings.ZoomAnim then
UnZoomAnim()
Sprint()
end
end
end
else
if AimPartMode == 1 then
AimPartMode = 2
if Settings.FocusOnSight2 and Aiming then
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.75),{ImageTransparency = 0}):Play()
else
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
end
if Settings.ZoomAnim then
ZoomAnim()
Sprint()
end
elseif AimPartMode == 2 then
AimPartMode = 1
if Settings.FocusOnSight and Aiming then
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.75),{ImageTransparency = 0}):Play()
else
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
end
if Settings.ZoomAnim then
UnZoomAnim()
Sprint()
end
end
end
end
if (key == "[") and Equipped then
if Zeroing.Value > Zeroing.MinValue then
Zeroing.Value = Zeroing.Value - 50
ArmaClone.Handle.Click:play()
Update_Gui()
end
end
if (key == "]" ) and Equipped then
if Zeroing.Value < Zeroing.MaxValue then
Zeroing.Value = Zeroing.Value + 50
ArmaClone.Handle.Click:play()
Update_Gui()
end
end
if (key == "r") and Equipped and stance > -2 then
CancelReload = false
if StoredAmmo.Value > 0 and Settings.Mode ~= "Explosive" and not Reloading and Settings.ReloadType == 1 then
if Settings.IncludeChamberedBullet and Ammo.Value == Settings.Ammo + 1 or not Settings.IncludeChamberedBullet and Ammo.Value == Settings.Ammo and Chambered.Value == true then
return
end
MouseHeld = false
Can_Shoot = false
Reloading = true
if Safe then
Safe = false
stance = 0
Evt.Stance:FireServer(stance,Settings,Anims)
IdleAnim()
Update_Gui()
wait(.25)
end
ReloadAnim()
if Chambered.Value == false and slideback == true and Settings.FastReload == true then
ChamberBKAnim()
elseif Chambered.Value == false and slideback == false and Settings.FastReload == true then
ChamberAnim()
end
Sprint()
Update_Gui()
Can_Shoot = true
Reloading = false
elseif StoredAmmo.Value > 0 and Settings.Mode ~= "Explosive" and not Reloading and Settings.ReloadType == 2 then
if Settings.IncludeChamberedBullet and Ammo.Value == Settings.Ammo + 1 or not Settings.IncludeChamberedBullet and Ammo.Value == Settings.Ammo and Chambered.Value == true or CancelReload then
Sprint()
Update_Gui()
return
end
MouseHeld = false
Can_Shoot = false
Reloading = true
if Safe then
Safe = false
stance = 0
Evt.Stance:FireServer(stance)
Sprint()
Update_Gui()
wait(.25)
end
for i = 1,Settings.Ammo - Ammo.Value do
if StoredAmmo.Value > 0 and not CancelReload and Ammo.Value < Settings.Ammo and not AnimDebounce then
ShellInsertAnim()
end
end
if Chambered.Value == false and slideback == true and Settings.FastReload == true then
ChamberBKAnim()
elseif Chambered.Value == false and slideback == false and Settings.FastReload == true then
ChamberAnim()
end
Update_Gui()
Sprint()
CancelReload = false
Can_Shoot = true
Reloading = false
elseif StoredAmmo.Value > 0 and Settings.Mode ~= "Explosive" and Reloading and Settings.ReloadType == 2 and AnimDebounce then
if not CancelReload then
CancelReload = true
Sprint()
Update_Gui()
wait(.25)
end
elseif not Reloading and GLAmmo.Value > 0 and Settings.Mode == "Explosive" and GLChambered.Value == false then
MouseHeld = false
Can_Shoot = false
Reloading = true
GLReloadAnim()
GLChambered.Value = true
Sprint()
Update_Gui()
Can_Shoot = true
Reloading = false
end
end
if (key == "f") and Equipped and not Reloading and stance > -2 then
MouseHeld = false
Can_Shoot = false
Reloading = true
if Safe then
Safe = false
stance = 0
Evt.Stance:FireServer(stance,Settings,Anims)
IdleAnim()
Update_Gui()
--wait(.25)
end
if not slideback then
ChamberAnim()
else
ChamberBKAnim()
end
Sprint()
Update_Gui()
Can_Shoot = true
Reloading = false
end
if (key == "m") and Equipped and Settings.CanCheckMag and not Reloading and stance > -2 then
MouseHeld = false
Can_Shoot = false
Reloading = true
if Safe then
Safe = false
stance = 0
Evt.Stance:FireServer(stance,Settings,Anims)
IdleAnim()
Update_Gui()
--wait(.25)
end
CheckAnim()
Sprint()
Update_Gui()
Can_Shoot = true
Reloading = false
end
if (key == "h") and Equipped and ArmaClone:FindFirstChild("LaserPoint") then
if ServerConfig.RealisticLaser and ArmaClone.LaserPoint:FindFirstChild("IR") ~= nil then
if not LaserAtivo and not IRmode then
LaserAtivo = not LaserAtivo
IRmode = not IRmode
if LaserAtivo then
Evt.SVLaser:FireServer(Vector3.new(0,0,0),1,ArmaClone.LaserPoint.Color,ArmaClient)
Pointer = Instance.new('Part')
Pointer.Shape = 'Ball'
Pointer.Size = Vector3.new(0.2, 0.2, 0.2)
Pointer.Parent = ArmaClone.LaserPoint
Pointer.CanCollide = false
Pointer.Color = ArmaClone.LaserPoint.Color
Pointer.Material = Enum.Material.Neon
if ArmaClone.LaserPoint:FindFirstChild("IR") ~= nil then
Pointer.Transparency = 1
end
LaserSP = Instance.new('Attachment')
LaserSP.Parent = ArmaClone.LaserPoint
LaserEP = Instance.new('Attachment')
LaserEP.Parent = ArmaClone.LaserPoint
Laser = Instance.new('Beam')
Laser.Parent = ArmaClone.LaserPoint
Laser.Transparency = NumberSequence.new(0)
Laser.LightEmission = 1
Laser.LightInfluence = 0
Laser.Attachment0 = LaserSP
Laser.Attachment1 = LaserEP
Laser.Color = ColorSequence.new(ArmaClone.LaserPoint.Color,IRmode)
Laser.FaceCamera = true
Laser.Width0 = 0.01
Laser.Width1 = 0.01
if ServerConfig.RealisticLaser then
Laser.Enabled = false
end
else
Evt.SVLaser:FireServer(Vector3.new(0,0,0),2,nil,ArmaClient,IRmode)
Pointer:Destroy()
LaserSP:Destroy()
LaserEP:Destroy()
Laser:Destroy()
end
elseif LaserAtivo and IRmode then
IRmode = not IRmode
elseif LaserAtivo and not IRmode then
LaserAtivo = not LaserAtivo
if LaserAtivo then
Evt.SVLaser:FireServer(Vector3.new(0,0,0),1,ArmaClone.LaserPoint.Color,ArmaClient)
Pointer = Instance.new('Part')
Pointer.Shape = 'Ball'
Pointer.Size = Vector3.new(0.2, 0.2, 0.2)
Pointer.Parent = ArmaClone.LaserPoint
Pointer.CanCollide = false
Pointer.Color = ArmaClone.LaserPoint.Color
Pointer.Material = Enum.Material.Neon
if ArmaClone.LaserPoint:FindFirstChild("IR") ~= nil then
Pointer.Transparency = 1
end
LaserSP = Instance.new('Attachment')
LaserSP.Parent = ArmaClone.LaserPoint
LaserEP = Instance.new('Attachment')
LaserEP.Parent = ArmaClone.LaserPoint
Laser = Instance.new('Beam')
Laser.Parent = ArmaClone.LaserPoint
Laser.Transparency = NumberSequence.new(0)
Laser.LightEmission = 1
Laser.LightInfluence = 0
Laser.Attachment0 = LaserSP
Laser.Attachment1 = LaserEP
Laser.Color = ColorSequence.new(ArmaClone.LaserPoint.Color,IRmode)
Laser.FaceCamera = true
Laser.Width0 = 0.01
Laser.Width1 = 0.01
if ServerConfig.RealisticLaser then
Laser.Enabled = false
end
else
Evt.SVLaser:FireServer(Vector3.new(0,0,0),2,nil,ArmaClient,IRmode)
Pointer:Destroy()
LaserSP:Destroy()
LaserEP:Destroy()
Laser:Destroy()
end
end
else
LaserAtivo = not LaserAtivo
if LaserAtivo then
Evt.SVLaser:FireServer(Vector3.new(0,0,0),1,ArmaClone.LaserPoint.Color,ArmaClient)
Pointer = Instance.new('Part')
Pointer.Shape = 'Ball'
Pointer.Size = Vector3.new(0.2, 0.2, 0.2)
Pointer.Parent = ArmaClone.LaserPoint
Pointer.CanCollide = false
Pointer.Color = ArmaClone.LaserPoint.Color
Pointer.Material = Enum.Material.Neon
if ArmaClone.LaserPoint:FindFirstChild("IR") ~= nil then
Pointer.Transparency = 1
end
LaserSP = Instance.new('Attachment')
LaserSP.Parent = ArmaClone.LaserPoint
LaserEP = Instance.new('Attachment')
LaserEP.Parent = ArmaClone.LaserPoint
Laser = Instance.new('Beam')
Laser.Parent = ArmaClone.LaserPoint
Laser.Transparency = NumberSequence.new(0)
Laser.LightEmission = 1
Laser.LightInfluence = 0
Laser.Attachment0 = LaserSP
Laser.Attachment1 = LaserEP
Laser.Color = ColorSequence.new(ArmaClone.LaserPoint.Color,IRmode)
Laser.FaceCamera = true
Laser.Width0 = 0.01
Laser.Width1 = 0.01
if ServerConfig.RealisticLaser then
Laser.Enabled = false
end
else
Evt.SVLaser:FireServer(Vector3.new(0,0,0),2,nil,ArmaClient,IRmode)
Pointer:Destroy()
LaserSP:Destroy()
LaserEP:Destroy()
Laser:Destroy()
end
end
ArmaClone.Handle.Click:play()
end
if (key == "j") and Equipped and ArmaClone:FindFirstChild("FlashPoint") then
LanternaAtiva = not LanternaAtiva
ArmaClone.Handle.Click:play()
if LanternaAtiva then
Evt.SVFlash:FireServer(true,ArmaClient,ArmaClone.FlashPoint.Light.Angle,ArmaClone.FlashPoint.Light.Brightness,ArmaClone.FlashPoint.Light.Color,ArmaClone.FlashPoint.Light.Range)
ArmaClone.FlashPoint.Light.Enabled = true
else
Evt.SVFlash:FireServer(false,ArmaClient,nil,nil,nil,nil)
ArmaClone.FlashPoint.Light.Enabled = false
end
end
if (key == "u") and Equipped and ArmaClone:FindFirstChild("Silenciador") then
Silencer.Value = not Silencer.Value
ArmaClone.Handle.Click:play()
if Silencer.Value == true then
ArmaClone.Silenciador.Transparency = 0
ArmaClone.SmokePart.FlashFX.Brightness = 0
ArmaClone.SmokePart:FindFirstChild("FlashFX[Flash]").Rate = 0
Evt.SilencerEquip:FireServer(ArmaClient,Silencer.Value)
else
ArmaClone.Silenciador.Transparency = 1
ArmaClone.SmokePart.FlashFX.Brightness = 5
ArmaClone.SmokePart:FindFirstChild("FlashFX[Flash]").Rate = 1000
Evt.SilencerEquip:FireServer(ArmaClient,Silencer.Value)
end
end
if (key == "b") and Equipped and BipodEnabled and ArmaClone:FindFirstChild("BipodPoint") then
Bipod = not Bipod
if Bipod == true then
if ArmaClone.BipodPoint:FindFirstChild("BipodDeploy") ~= nil then
ArmaClone.BipodPoint.BipodDeploy:play()
end
else
if ArmaClone.BipodPoint:FindFirstChild("BipodRetract") ~= nil then
ArmaClone.BipodPoint.BipodRetract:play()
end
end
end
if (key == "n") and Laserdebounce == false then
if Player.Character then
local helmet = Player.Character:FindFirstChild("Helmet")
if helmet then
local nvg = helmet:FindFirstChild("Up")
if nvg then
Laserdebounce = true
delay(.8,function()
NVG = not NVG
if Aiming and ArmaClone.AimPart:FindFirstChild("NVAim") ~= nil then
if NVG then
tweenFoV(70,120)
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
else
if AimPartMode == 1 then
tweenFoV(Settings.ChangeFOV[1],120)
if Settings.FocusOnSight then
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.75),{ImageTransparency = 0}):Play()
else
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
end
elseif AimPartMode == 2 then
tweenFoV(Settings.ChangeFOV[2],120)
if Settings.FocusOnSight2 then
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.75),{ImageTransparency = 0}):Play()
else
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
end
end
end
end
Laserdebounce = false
end)
end
end
end
end
end)
|
--// Services |
local L_81_ = game:GetService('RunService').RenderStepped
local L_82_ = game:GetService('UserInputService')
|
----------------------------------------------- |
function findAllFlagStands(root)
local c = root:children()
for i=1,#c do
if (c[i].className == "Model" or c[i].className == "Part") then
findAllFlagStands(c[i])
end
if (c[i].className == "FlagStand") then
table.insert(stands, c[i])
end
end
end
function hookUpListeners()
for i=1,#stands do
stands[i].FlagCaptured:connect(onCaptureScored)
end
end
function onPlayerEntered(newPlayer)
if CTF_mode == true then
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local captures = Instance.new("IntValue")
captures.Name = "Captures"
captures.Value = 0
captures.Parent = stats
-- VERY UGLY HACK
-- Will this leak threads?
-- Is the problem even what I think it is (player arrived before character)?
while true do
if newPlayer.Character ~= nil then break end
wait(5)
end
stats.Parent = newPlayer
else
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local kills = Instance.new("IntValue")
kills.Name = "KOs"
kills.Value = 0
local cash = Instance.new("IntValue")
cash.Name = "Cash"
cash.Value = 0
local deaths = Instance.new("IntValue")
deaths.Name = "Wipeouts"
deaths.Value = 0
kills.Parent = stats
deaths.Parent = stats
cash.Parent = stats
-- VERY UGLY HACK
-- Will this leak threads?
-- Is the problem even what I think it is (player arrived before character)?
while true do
if newPlayer.Character ~= nil then break end
wait(5)
end
local humanoid = newPlayer.Character.Humanoid
humanoid.Died:connect(function() onHumanoidDied(humanoid, newPlayer) end )
-- start to listen for new humanoid
newPlayer.Changed:connect(function(property) onPlayerRespawn(property, newPlayer) end )
stats.Parent = newPlayer
end
end
function onCaptureScored(player)
local ls = player:findFirstChild("leaderstats")
if ls == nil then return end
local caps = ls:findFirstChild("Captures")
if caps == nil then return end
caps.Value = caps.Value + 1
end
findAllFlagStands(game.Workspace)
hookUpListeners()
if (#stands > 0) then CTF_mode = true end
game.Players.ChildAdded:connect(onPlayerEntered)
|
-- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")") |
end
end
-- preload anims
if PreloadAnimsUserFlag then
for i, animType in pairs(animTable) do
for idx = 1, animType.count, 1 do
Humanoid:LoadAnimation(animType[idx].anim)
end
end
end
end
|
-- Bind Events |
CaptureFlag.Event:Connect(OnCaptureFlag)
ReturnFlag.Event:Connect(OnReturnFlag)
return GameManager
|
-- ROBLOX deviation: matchers does not have MatchersObject type annotation and expect
-- does not have Expect type annotation
--[[
ROBLOX TODO: add default generic param when possible
original code:
export const setMatchers = <State extends MatcherState = MatcherState>(
]] |
local function setMatchers<State>(matchers: MatchersObject<State>, isInternal: boolean, expect): ()
for key, matcher in pairs(matchers) do
-- ROBLOX TODO: assign INTERNAL_MATCHER_FLAG to matchers
if not isInternal then
local CustomMatcher = {}
CustomMatcher.__index = CustomMatcher
setmetatable(CustomMatcher, AsymmetricMatcher)
CustomMatcher.new = function(inverse: boolean?, ...)
inverse = if inverse ~= nil then inverse else false
local self = AsymmetricMatcher.new({ ... }, inverse)
setmetatable(self, CustomMatcher)
return self
end
CustomMatcher.asymmetricMatch = function(self, other: any)
local pass = matcher(self:getMatcherContext(), other, unpack(self.sample)).pass
return if self.inverse then not pass else pass
end
CustomMatcher.toString = function(self)
if self.inverse then
return string.format("never.%s", key)
end
return tostring(key)
end
CustomMatcher.getExpectedType = function(self)
return "any"
end
CustomMatcher.toAsymmetricMatcher = function(self)
local sample = self.sample
local i = 1
local printval = ""
while i < #sample do
printval = printval .. tostring(sample[i]) .. ", "
i += 1
end
printval = printval .. tostring(sample[i])
return string.format("%s<%s>", self:toString(), printval)
end
-- ROBLOX deviation start: there is not Object.defineProperty equivalent in Lua
expect[key] = function(...)
return CustomMatcher.new(false, ...)
end
if not expect.never then
expect.never = {}
end
expect.never[key] = function(...)
return CustomMatcher.new(true, ...)
end
-- ROBLOX deviation end
end
end
Object.assign(_G[JEST_MATCHERS_OBJECT].matchers, matchers)
end
return {
INTERNAL_MATCHER_FLAG = INTERNAL_MATCHER_FLAG,
getState = getState,
setState = setState,
getMatchers = getMatchers,
setMatchers = setMatchers,
}
|
-- variables |
local hrp = script.Parent:WaitForChild("HumanoidRootPart");
local head = script.Parent:WaitForChild("Head");
local neck = head:WaitForChild("Neck");
local waist = script.Parent:WaitForChild("UpperTorso"):WaitForChild("Waist");
local neckC0 = neck.C0;
local waistC0 = waist.C0;
local target = script.Parent.Parent.Target;
|
--| More |-- |
local Camera = workspace.Camera
local DFOV = 70
local Info = TweenInfo.new(0.5)
|
-- ALL OF THE CREDITS GOES TO V_SUZUKI
-- ORIGINAL MODEL https://www.roblox.com/library/6990325381/tech
-- KINDA GLITCHY |
script:Remove() --self destruct
|
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!! |
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.Pin -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage
hitPart.Touched:Connect(function(hit)
if debounce == true then
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:FindFirstChild(hit.Parent.Name)
if plr then
debounce = false
hitPart.BrickColor = BrickColor.new("Bright red")
tool:Clone().Parent = plr.Backpack
wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
debounce = true
hitPart.BrickColor = BrickColor.new("Bright green")
end
end
end
end)
|
--EQUIP ANIMATION |
wait(0.1)
Animate(
CFrame.new(1.5, 0, 0) * CFrame.fromEulerAnglesXYZ(math.rad(0), math.rad(0), math.rad(0)) * CFrame.new(0,1.5,0)
,CFrame.new(-1.5, 0.1, 0.165-((0.065))) * CFrame.fromEulerAnglesXYZ(math.rad(-35)+(math.rad(15)), math.rad(-10), 0) * CFrame.new(0,1.5,0)
,CFrame.new(-1.5, -0.27+((0.37)), -1+((1.1))) * CFrame.fromEulerAnglesXYZ(math.rad(-123)+(math.rad(103)), math.rad(-10), 0) * CFrame.new(0,1.5,0)
,CFrame.new(0,0,0) * CFrame.fromEulerAnglesXYZ(0,0,0)
,0.2)
|
--/Sight |
module.SightZoom = 0 -- Set to 0 if you want to use weapon's default zoom
module.SightZoom2 = 0 --Set this to alternative zoom or Aimpart2 Zoom
|
-- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote |
local emoteNames = { wave = false, point = false, dance1 = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
function configureAnimationSet(name, fileList)
if (animTable[name] ~= nil) then
for _, connection in pairs(animTable[name].connections) do
connection:disconnect()
end
end
animTable[name] = {}
animTable[name].count = 0
animTable[name].totalWeight = 0
animTable[name].connections = {}
|
-- Functions |
local function onPlayerJoin(plr)
-- . . .
end
|
--[=[
@within TableUtil
@function Sync
@param srcTbl table -- Source table
@param templateTbl table -- Template table
@return table
Synchronizes the `srcTbl` based on the `templateTbl`. This will make
sure that `srcTbl` has all of the same keys as `templateTbl`, including
removing keys in `srcTbl` that are not present in `templateTbl`. This
is a _deep_ operation, so any nested tables will be synchronized as
well.
```lua
local template = {kills = 0, deaths = 0, xp = 0}
local data = {kills = 10, experience = 12}
data = TableUtil.Sync(data, template)
print(data) --> {kills = 10, deaths = 0, xp = 0}
```
:::caution Data Loss Warning
This is a two-way sync, so the source table will have data
_removed_ that isn't found in the template table. This can
be problematic if used for player data, where there might
be dynamic data added that isn't in the template.
For player data, use `TableUtil.Reconcile` instead.
]=] |
local function Sync<S, T>(srcTbl: S, templateTbl: T): T
assert(type(srcTbl) == "table", "First argument must be a table")
assert(type(templateTbl) == "table", "Second argument must be a table")
local tbl = table.clone(srcTbl)
-- If 'tbl' has something 'templateTbl' doesn't, then remove it from 'tbl'
-- If 'tbl' has something of a different type than 'templateTbl', copy from 'templateTbl'
-- If 'templateTbl' has something 'tbl' doesn't, then add it to 'tbl'
for k, v in pairs(tbl) do
local vTemplate = templateTbl[k]
-- Remove keys not within template:
if vTemplate == nil then
tbl[k] = nil
-- Synchronize data types:
elseif type(v) ~= type(vTemplate) then
if type(vTemplate) == "table" then
tbl[k] = Copy(vTemplate, true)
else
tbl[k] = vTemplate
end
-- Synchronize sub-tables:
elseif type(v) == "table" then
tbl[k] = Sync(v, vTemplate)
end
end
-- Add any missing keys:
for k, vTemplate in pairs(templateTbl) do
local v = tbl[k]
if v == nil then
if type(vTemplate) == "table" then
tbl[k] = Copy(vTemplate, true)
else
tbl[k] = vTemplate
end
end
end
return (tbl :: any) :: T
end
|
--[[**
ensures all keys in given table pass check
@param check The function to use to check the keys
@returns A function that will return true iff the condition is passed
**--]] |
function t.keys(check)
assert(t.callback(check))
return function(value)
local tableSuccess, tableErrMsg = t.table(value)
if tableSuccess == false then
return false, tableErrMsg or ""
end
for key in value do
local success, errMsg = check(key)
if success == false then
return false, string.format("bad key %s:\n\t%s", tostring(key), errMsg or "")
end
end
return true
end
end
|
-- Patrol configuration |
local PATROL_ENABLED = getValueFromConfig("PatrolEnabled")
local PATROL_RADIUS = getValueFromConfig("PatrolRadius")
|
--[=[
@class Comm
Remote communication library.
This exposes the raw functions that are used by the `ServerComm` and `ClientComm` classes.
Those two classes should be preferred over accessing the functions directly through this
Comm library.
]=] |
local Comm = {
Server = require(script.Server),
Client = require(script.Client),
ServerComm = require(script.Server.ServerComm),
ClientComm = require(script.Client.ClientComm),
}
|
--[[Susupension]] |
Tune.SusEnabled = true -- Sets whether suspension is enabled
--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 = .3 -- 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
Tune.FSpringOffset = { -- Suspension anchor point offset (relative to ABOVE anchor offset) (Avxnturador)
--[[Lateral]] 0 , -- positive = outward
--[[Vertical]] 0 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 500 -- Spring Dampening
Tune.RSusStiffness = 9000 -- Spring Force
Tune.RAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.RSusLength = 2 -- Suspension length (in studs)
Tune.RPreCompress = .3 -- 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]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
Tune.RSpringOffset = { -- Suspension anchor point offset (relative to ABOVE anchor offset) (Avxnturador)
--[[Lateral]] 0 , -- positive = outward
--[[Vertical]] 0 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = true -- Spring 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
|
-- Support for debounce |
function PlayCutscene()
if bin then
bin = false
Music:Play()
if ProtectTheCharacterWhilePlaying and ProtectTheCharacterWhilePlaying.Value and Player.Character then
CharacterProtector.Parent = Player.Character
end
Demo:Play()
end
end
Demo.EStop.Event:Connect(function()
wait_time(Debounce.Value)
CharacterProtector.Parent = nil
if PlayOnce then
if not PlayOnce.Value then
bin = true
end
else
bin = true
end
if StopMusicWhenFinished and StopMusicWhenFinished.Value then
Music:Stop()
if OnFinishedRemove then
for i,v in pairs(OnFinishedRemove:GetChildren()) do
if v:IsA("ObjectValue") then
if v.Value then
v.Value:Destroy()
end
end
end
end
end
end)
|
--declarations |
sp = script.Parent
local cover = sp.Cover
local covergui = sp.CoverGui
local maingui = sp.MainGui
local click = cover.ClickDetector
local handle = sp.Storage.Handle
local tool = sp.Storage.Cup
local repair = sp.Repair.TextButton
local repairtwo = true
local ready = true
|
------------------------------------------------------------------------
--
-- * used in luaK:exp2nextreg(), luaK:exp2anyreg(), luaK:storevar()
------------------------------------------------------------------------ |
function luaK:exp2reg(fs, e, reg)
self:discharge2reg(fs, e, reg)
if e.k == "VJMP" then
e.t = self:concat(fs, e.t, e.info) -- put this jump in 't' list
end
if self:hasjumps(e) then
local final -- position after whole expression
local p_f = self.NO_JUMP -- position of an eventual LOAD false
local p_t = self.NO_JUMP -- position of an eventual LOAD true
if self:need_value(fs, e.t) or self:need_value(fs, e.f) then
local fj = (e.k == "VJMP") and self.NO_JUMP or self:jump(fs)
p_f = self:code_label(fs, reg, 0, 1)
p_t = self:code_label(fs, reg, 1, 0)
self:patchtohere(fs, fj)
end
final = self:getlabel(fs)
self:patchlistaux(fs, e.f, final, reg, p_f)
self:patchlistaux(fs, e.t, final, reg, p_t)
end
e.f, e.t = self.NO_JUMP, self.NO_JUMP
e.info = reg
e.k = "VNONRELOC"
end
|
-----------------------------------------------------------------------------------------------------
-- Coin Animation |
local tweenService = game:GetService("TweenService")
local info = TweenInfo.new(
3, -- length (seconds)
Enum.EasingStyle.Back, -- easing style
Enum.EasingDirection.InOut, -- easing direction
-1, -- times repeated (-1 = infinite)
true, -- should it reverse
0 -- delay
)
local function coinAnimation(coin)
coin = coin.PrimaryPart
wait()
local goals = {
Orientation = Vector3.new(0, 360, 0);
Position = (coin.Position + Vector3.new(0, 1.5, 0));
}
local coinAnimation = tweenService:Create(coin, info, goals)
coinAnimation:Play()
end
|
-- Load tool completely before loading cached libraries |
local Tool = script.Parent;
local Indicator = Tool:WaitForChild 'Loaded';
while not Indicator.Value do
Indicator.Changed:wait();
end;
|
-- This DOESN'T Prevents to fire 'Unequip()' event, says it all the name,
-- auto-equip!
--Place this in a Tool. |
EnableBackpackGui = true -- Keep at true -_-
Weapon = script.Parent.Name
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse();
local char = player.Character
local tool = player.Backpack:FindFirstChild(""..Weapon.."")
db=1 |
--game:GetService("Players").PlayerAdded:Connect(function(player) |
--local character = player.Character or player.CharacterAdded:Wait()
--player.CharacterAdded:Connect(function(character)
--character_added(character)
--end)
|
--[[
Calls a callback on `andThen` with specific arguments.
]] |
function Promise.prototype:andThenCall(callback, ...)
local length, values = pack(...)
return self:andThen(function()
return callback(unpack(values, 1, length))
end)
end
|
--Turbocharger |
local BOV_Loudness = 1 --volume of the BOV (not exact volume so you kinda have to experiment with it)
local BOV_Pitch = 0.9 --max pitch of the BOV (not exact so might have to mess with it)
|
--[=[
Returns if a string ends with a postfix
@param str string
@param postfix string
@return boolean
]=] |
function String.endsWith(str: string, postfix: string): boolean
return str:sub(-#postfix) == postfix
end
|
-- ProfileStore object: |
local ProfileStore = {
--[[
Mock = {},
_profile_store_name = "", -- [string] -- DataStore name
_profile_store_scope = nil, -- [string] or [nil] -- DataStore scope
_profile_store_lookup = "", -- [string] -- _profile_store_name .. "\0" .. (_profile_store_scope or "")
_profile_template = {}, -- [table]
_global_data_store = global_data_store, -- [GlobalDataStore] -- Object returned by DataStoreService:GetDataStore(_profile_store_name)
_loaded_profiles = {[profile_key] = Profile, ...},
_profile_load_jobs = {[profile_key] = {load_id, loaded_data}, ...},
_mock_loaded_profiles = {[profile_key] = Profile, ...},
_mock_profile_load_jobs = {[profile_key] = {load_id, loaded_data}, ...},
--]]
}
ProfileStore.__index = ProfileStore
function ProfileStore:LoadProfileAsync(profile_key, not_released_handler, _use_mock) --> [Profile / nil] not_released_handler(place_id, game_job_id)
if self._profile_template == nil then
error("[ProfileService]: Profile template not set - ProfileStore:LoadProfileAsync() locked for this ProfileStore")
end
if type(profile_key) ~= "string" then
error("[ProfileService]: profile_key must be a string")
elseif string.len(profile_key) == 0 then
error("[ProfileService]: Invalid profile_key")
end
if type(not_released_handler) ~= "function" and not_released_handler ~= "ForceLoad" and not_released_handler ~= "Steal" then
error("[ProfileService]: Invalid not_released_handler")
end
if ProfileService.ServiceLocked == true then
return nil
end
WaitForPendingProfileStore(self)
local is_user_mock = _use_mock == UseMockTag
-- Check if profile with profile_key isn't already loaded in this session:
for _, profile_store in ipairs(ActiveProfileStores) do
if profile_store._profile_store_lookup == self._profile_store_lookup then
local loaded_profiles = is_user_mock == true and profile_store._mock_loaded_profiles or profile_store._loaded_profiles
if loaded_profiles[profile_key] ~= nil then
error("[ProfileService]: Profile " .. IdentifyProfile(self._profile_store_name, self._profile_store_scope, profile_key) .. " is already loaded in this session")
-- Are you using Profile:Release() properly?
end
end
end
ActiveProfileLoadJobs = ActiveProfileLoadJobs + 1
local force_load = not_released_handler == "ForceLoad"
local force_load_steps = 0
local request_force_load = force_load -- First step of ForceLoad
local steal_session = false -- Second step of ForceLoad
local aggressive_steal = not_released_handler == "Steal" -- Developer invoked steal
while ProfileService.ServiceLocked == false do
-- Load profile:
-- SPECIAL CASE - If LoadProfileAsync is called for the same key before another LoadProfileAsync finishes,
-- yoink the DataStore return for the new call. The older call will return nil. This would prevent very rare
-- game breaking errors where a player rejoins the server super fast.
local profile_load_jobs = is_user_mock == true and self._mock_profile_load_jobs or self._profile_load_jobs
local loaded_data
local load_id = LoadIndex + 1
LoadIndex = load_id
local profile_load_job = profile_load_jobs[profile_key] -- {load_id, loaded_data}
if profile_load_job ~= nil then
profile_load_job[1] = load_id -- Yoink load job
while profile_load_job[2] == nil do -- Wait for job to finish
Madwork.HeartbeatWait()
end
if profile_load_job[1] == load_id then -- Load job hasn't been double-yoinked
loaded_data = profile_load_job[2]
profile_load_jobs[profile_key] = nil
else
ActiveProfileLoadJobs = ActiveProfileLoadJobs - 1
return nil
end
else
profile_load_job = {load_id, nil}
profile_load_jobs[profile_key] = profile_load_job
profile_load_job[2] = StandardProfileUpdateAsyncDataStore(
self,
profile_key,
{
ExistingProfileHandle = function(latest_data)
if ProfileService.ServiceLocked == false then
local active_session = latest_data.MetaData.ActiveSession
local force_load_session = latest_data.MetaData.ForceLoadSession
-- IsThisSession(active_session)
if active_session == nil then
latest_data.MetaData.ActiveSession = {PlaceId, JobId}
latest_data.MetaData.ForceLoadSession = nil
elseif type(active_session) == "table" then
if IsThisSession(active_session) == false then
local last_update = latest_data.MetaData.LastUpdate
if last_update ~= nil then
if os.time() - last_update > SETTINGS.AssumeDeadSessionLock then
latest_data.MetaData.ActiveSession = {PlaceId, JobId}
latest_data.MetaData.ForceLoadSession = nil
return
end
end
if steal_session == true or aggressive_steal == true then
local force_load_uninterrupted = false
if force_load_session ~= nil then
force_load_uninterrupted = IsThisSession(force_load_session)
end
if force_load_uninterrupted == true or aggressive_steal == true then
latest_data.MetaData.ActiveSession = {PlaceId, JobId}
latest_data.MetaData.ForceLoadSession = nil
end
elseif request_force_load == true then
latest_data.MetaData.ForceLoadSession = {PlaceId, JobId}
end
else
latest_data.MetaData.ForceLoadSession = nil
end
end
end
end,
MissingProfileHandle = function(latest_data)
latest_data.Data = DeepCopyTable(self._profile_template)
latest_data.MetaData = {
ProfileCreateTime = os.time(),
SessionLoadCount = 0,
ActiveSession = {PlaceId, JobId},
ForceLoadSession = nil,
MetaTags = {},
}
end,
EditProfile = function(latest_data)
if ProfileService.ServiceLocked == false then
local active_session = latest_data.MetaData.ActiveSession
if active_session ~= nil and IsThisSession(active_session) == true then
latest_data.MetaData.SessionLoadCount = latest_data.MetaData.SessionLoadCount + 1
latest_data.MetaData.LastUpdate = os.time()
end
end
end,
},
is_user_mock
)
if profile_load_job[1] == load_id then -- Load job hasn't been yoinked
loaded_data = profile_load_job[2]
profile_load_jobs[profile_key] = nil
else
ActiveProfileLoadJobs = ActiveProfileLoadJobs - 1
return nil -- Load job yoinked
end
end
-- Handle load_data:
if loaded_data ~= nil then
local active_session = loaded_data.MetaData.ActiveSession
if type(active_session) == "table" then
if IsThisSession(active_session) == true then
-- Special component in MetaTags:
loaded_data.MetaData.MetaTagsLatest = DeepCopyTable(loaded_data.MetaData.MetaTags)
-- Case #1: Profile is now taken by this session:
-- Create Profile object:
local global_updates_object = {
_updates_latest = loaded_data.GlobalUpdates,
_pending_update_lock = {},
_pending_update_clear = {},
_new_active_update_listeners = Madwork.NewScriptSignal(),
_new_locked_update_listeners = Madwork.NewScriptSignal(),
_profile = nil,
}
setmetatable(global_updates_object, GlobalUpdates)
local profile = {
Data = loaded_data.Data,
MetaData = loaded_data.MetaData,
MetaTagsUpdated = Madwork.NewScriptSignal(),
GlobalUpdates = global_updates_object,
_profile_store = self,
_profile_key = profile_key,
_release_listeners = Madwork.NewScriptSignal(),
_hop_ready_listeners = Madwork.NewScriptSignal(),
_hop_ready = false,
_load_timestamp = os.clock(),
_is_user_mock = is_user_mock,
}
setmetatable(profile, Profile)
global_updates_object._profile = profile
-- Referencing Profile object in ProfileStore:
if next(self._loaded_profiles) == nil and next(self._mock_loaded_profiles) == nil then -- ProfileStore object was inactive
table.insert(ActiveProfileStores, self)
end
if is_user_mock == true then
self._mock_loaded_profiles[profile_key] = profile
else
self._loaded_profiles[profile_key] = profile
end
-- Adding profile to AutoSaveList;
AddProfileToAutoSave(profile)
-- Special case - finished loading profile, but session is shutting down:
if ProfileService.ServiceLocked == true then
SaveProfileAsync(profile, true) -- Release profile and yield until the DataStore call is finished
profile = nil -- nil will be returned by this call
end
-- Return Profile object:
ActiveProfileLoadJobs = ActiveProfileLoadJobs - 1
return profile
else
-- Case #2: Profile is taken by some other session:
if force_load == true then
local force_load_session = loaded_data.MetaData.ForceLoadSession
local force_load_uninterrupted = false
if force_load_session ~= nil then
force_load_uninterrupted = IsThisSession(force_load_session)
end
if force_load_uninterrupted == true then
if request_force_load == false then
force_load_steps = force_load_steps + 1
if force_load_steps == SETTINGS.ForceLoadMaxSteps then
steal_session = true
end
end
Madwork.HeartbeatWait() -- Overload prevention
else
-- Another session tried to force load this profile:
ActiveProfileLoadJobs = ActiveProfileLoadJobs - 1
return nil
end
request_force_load = false -- Only request a force load once
elseif aggressive_steal == true then
Madwork.HeartbeatWait() -- Overload prevention
else
local handler_result = not_released_handler(active_session[1], active_session[2])
if handler_result == "Repeat" then
Madwork.HeartbeatWait() -- Overload prevention
elseif handler_result == "Cancel" then
ActiveProfileLoadJobs = ActiveProfileLoadJobs - 1
return nil
elseif handler_result == "ForceLoad" then
force_load = true
request_force_load = true
Madwork.HeartbeatWait() -- Overload prevention
elseif handler_result == "Steal" then
aggressive_steal = true
Madwork.HeartbeatWait() -- Overload prevention
else
error(
"[ProfileService]: Invalid return from not_released_handler (\"" .. tostring(handler_result) .. "\")(" .. type(handler_result) .. ");" ..
"\n" .. IdentifyProfile(self._profile_store_name, self._profile_store_scope, profile_key) ..
" Traceback:\n" .. debug.traceback()
)
end
end
end
else
ActiveProfileLoadJobs = ActiveProfileLoadJobs - 1
return nil -- In this scenario it is likely the ProfileService.ServiceLocked flag was raised
end
else
Madwork.HeartbeatWait() -- Overload prevention
end
end
ActiveProfileLoadJobs = ActiveProfileLoadJobs - 1
return nil -- If loop breaks return nothing
end
function ProfileStore:GlobalUpdateProfileAsync(profile_key, update_handler, _use_mock) --> [GlobalUpdates / nil] (update_handler(GlobalUpdates))
if type(profile_key) ~= "string" or string.len(profile_key) == 0 then
error("[ProfileService]: Invalid profile_key")
end
if type(update_handler) ~= "function" then
error("[ProfileService]: Invalid update_handler")
end
if ProfileService.ServiceLocked == true then
return nil
end
WaitForPendingProfileStore(self)
while ProfileService.ServiceLocked == false do
-- Updating profile:
local loaded_data = StandardProfileUpdateAsyncDataStore(
self,
profile_key,
{
ExistingProfileHandle = nil,
MissingProfileHandle = nil,
EditProfile = function(latest_data)
-- Running update_handler:
local global_updates_object = {
_updates_latest = latest_data.GlobalUpdates,
_update_handler_mode = true,
}
setmetatable(global_updates_object, GlobalUpdates)
update_handler(global_updates_object)
end,
},
_use_mock == UseMockTag
)
CustomWriteQueueMarkForCleanup(self._profile_store_lookup, profile_key)
-- Handling loaded_data:
if loaded_data ~= nil then
-- Return GlobalUpdates object (Update successful):
local global_updates_object = {
_updates_latest = loaded_data.GlobalUpdates,
}
setmetatable(global_updates_object, GlobalUpdates)
return global_updates_object
else
Madwork.HeartbeatWait() -- Overload prevention
end
end
return nil -- Return nothing (Update unsuccessful)
end
function ProfileStore:ViewProfileAsync(profile_key, _use_mock) --> [Profile / nil]
if type(profile_key) ~= "string" or string.len(profile_key) == 0 then
error("[ProfileService]: Invalid profile_key")
end
if ProfileService.ServiceLocked == true then
return nil
end
WaitForPendingProfileStore(self)
while ProfileService.ServiceLocked == false do
-- Load profile:
local loaded_data = StandardProfileUpdateAsyncDataStore(
self,
profile_key,
{
ExistingProfileHandle = nil,
MissingProfileHandle = nil,
EditProfile = nil,
},
_use_mock == UseMockTag
)
CustomWriteQueueMarkForCleanup(self._profile_store_lookup, profile_key)
-- Handle load_data:
if loaded_data ~= nil then
-- Create Profile object:
local global_updates_object = {
_updates_latest = loaded_data.GlobalUpdates,
_profile = nil,
}
setmetatable(global_updates_object, GlobalUpdates)
local profile = {
Data = loaded_data.Data,
MetaData = loaded_data.MetaData,
MetaTagsUpdated = Madwork.NewScriptSignal(),
GlobalUpdates = global_updates_object,
_profile_store = self,
_profile_key = profile_key,
_view_mode = true,
_load_timestamp = os.clock(),
}
setmetatable(profile, Profile)
global_updates_object._profile = profile
-- Returning Profile object:
return profile
else
Madwork.HeartbeatWait() -- Overload prevention
end
end
return nil -- If loop breaks return nothing
end
function ProfileStore:WipeProfileAsync(profile_key, _use_mock) --> is_wipe_successful [bool]
if type(profile_key) ~= "string" or string.len(profile_key) == 0 then
error("[ProfileService]: Invalid profile_key")
end
if ProfileService.ServiceLocked == true then
return false
end
WaitForPendingProfileStore(self)
local wipe_status = StandardProfileUpdateAsyncDataStore(
self,
profile_key,
{
WipeProfile = true
},
_use_mock == UseMockTag
)
CustomWriteQueueMarkForCleanup(self._profile_store_lookup, profile_key)
return wipe_status
end
|
-- Only require on client
-- Example test-code at bottom of script |
local MAX_CONFETTI = 200
local REMOVE_OLD_AT_MAX = false -- Can be slow when max is hit
local MASTER_SCALE = 1
local CONFETTI_WIDTH = 40
local CONFETTI_HEIGHT = 25
local Z_INDEX = 80
local AVG_FLICKER_TIME = .5
local MAX_ROTATION_SPEED = 360
local NUDGE_CHANCE_PER_SECOND = 4
local NUDGE_SPEED = 100
local DRAG = .61
local GRAVITY = Vector2.new(0,150)
local CONFETTI_COLORS = {}
local GENERATED_COLORS = 8
local GENERATED_COLOR_SATURATION = .7--.5
local GENERATED_COLOR_VALUE = .9
local module = {}
local confettiCount = 0
local confettis = {}
local topbarOffset = (script.Parent.IgnoreGuiInset and game.GuiService:GetGuiInset()) or Vector2.new(0,0)
local killzone = script.Parent.AbsoluteSize.Y + topbarOffset.Y + 100
local screenWidth = script.Parent.AbsoluteSize.X
local random = math.random
local min = math.min
local sin = math.sin
local cos = math.cos
local tau = math.pi*2
local abs = math.abs
local confettiTemplate = Instance.new('Frame')
confettiTemplate.Size = UDim2.new(0,0,0,0)
confettiTemplate.ZIndex = Z_INDEX
confettiTemplate.AnchorPoint = Vector2.new(.5,.5)
confettiTemplate.BorderSizePixel = 0
function updateScreenSize()
killzone = script.Parent.AbsoluteSize.Y + 100
screenWidth = script.Parent.AbsoluteSize.X
end
updateScreenSize()
script.Parent:GetPropertyChangedSignal('AbsoluteSize'):connect(updateScreenSize)
for i=1,GENERATED_COLORS do
local color = Color3.fromHSV(
i/GENERATED_COLORS,
GENERATED_COLOR_SATURATION,
GENERATED_COLOR_VALUE
)
table.insert(CONFETTI_COLORS, color)
end
function randomDirection(speed)
local direction = random()*tau
return Vector2.new(sin(direction),cos(direction)) * (speed or 1)
end
function createConfetti(pos, vel)
local maxedOut = confettiCount >= MAX_CONFETTI
if maxedOut and REMOVE_OLD_AT_MAX and random() then
-- This is the best method I can figure for removing a random item from a dictionary of known length
local removeCoutndown = random(1,MAX_CONFETTI)
for confetti,_ in pairs(confettis) do
removeCoutndown = removeCoutndown - 1
if removeCoutndown <= 0 then
confetti:Destroy()
confettiCount = confettiCount - 1
confettis[confetti] = nil
maxedOut = confettiCount >= MAX_CONFETTI
break
end
end
end
if not maxedOut then
confettiCount = confettiCount + 1
local color = CONFETTI_COLORS[random(1,#CONFETTI_COLORS)]
local h,s,v = Color3.toHSV(color)
local darkColor = Color3.fromHSV(h,s,v*.7)
local rot = random()*360
local data = {
flickerTime = AVG_FLICKER_TIME*(.75+random()*.5),
rotVel = (random()*2-1) * MAX_ROTATION_SPEED,
rot = rot,
color = color,
darkColor = darkColor,
pos = (pos or Vector2.new(0,0)) + topbarOffset,
vel = vel or Vector2.new(0,0),
scale = (.5+random()*.5) * MASTER_SCALE
}
local confetti = confettiTemplate:Clone()
confetti.Rotation = rot
confetti.BackgroundColor3 = data.color
confettis[confetti] = data
confetti.Parent = script.Parent
end
end
function explode(count)
local pos = script.Parent.EffectFrame.AbsolutePosition + script.Parent.EffectFrame.AbsoluteSize * 0.5
local count = count
local speed = 700-- or 300
for i=1, count do
local vel = randomDirection(speed)*(random()^.5)
createConfetti(pos, vel)
end
end
function rain(count, speed)
local count = count or 50
local speed = speed or 20
for i=1, count do
local vel = randomDirection(speed)*(random()^.5)
local pos = Vector2.new(random()*screenWidth,random()*-100)
createConfetti(pos, vel)
end
end
game:GetService('RunService').Heartbeat:Connect(function(delta)
local t = tick()
local drag = DRAG^delta
for confetti, data in pairs(confettis) do
if confetti.Parent then
local scale = data.scale
local flickerPercent = (t/data.flickerTime)%1
if random() < NUDGE_CHANCE_PER_SECOND*delta then
data.rotVel = data.rotVel + ((random()*2-1)*180)
data.vel = data.vel + Vector2.new(NUDGE_SPEED*(random()*2-1), NUDGE_SPEED*(random()*.5))
end
data.vel = (data.vel * drag) + GRAVITY*delta*MASTER_SCALE
data.pos = data.pos + data.vel*delta
data.rotVel = data.rotVel * drag
data.rot = data.rot + data.rotVel*delta
confetti.BackgroundColor3 = flickerPercent > .5 and data.color or data.darkColor
confetti.Position = UDim2.new(0,data.pos.x,0,data.pos.y)
confetti.Size = UDim2.new(0,CONFETTI_WIDTH*scale,0,CONFETTI_HEIGHT*abs(sin(flickerPercent*tau))*scale)
confetti.Rotation = data.rot
if confetti.AbsolutePosition.Y > killzone then
confetti:Destroy()
confettiCount = confettiCount - 1
confettis[confetti] = nil
end
else
confettiCount = confettiCount - 1
confettis[confetti] = nil
end
end
end)
module.CreateConfetti = createConfetti --(pos, vel)
module.Explode = explode --(pos, count, speed)
module.Rain = rain --(count)
return module
|
--- Sets the place name label on the interface |
function Cmdr:SetPlaceName (name)
self.PlaceName = name
Interface.Window:UpdateLabel()
end
|
-- Decompiled with the Synapse X Luau decompiler. |
client = nil;
service = nil;
cPcall = nil;
Pcall = nil;
Routine = nil;
GetEnv = nil;
origEnv = nil;
logError = nil;
return function()
local u1 = nil;
local l__client__2 = client;
local u3 = nil;
local u4 = nil;
local u5 = nil;
local u6 = nil;
local u7 = nil;
local u8 = nil;
getfenv().client = nil;
getfenv().service = nil;
getfenv().script = nil;
local v1 = {
Init = function()
u1 = l__client__2.UI;
u3 = l__client__2.Anti;
u4 = l__client__2.Core;
u5 = l__client__2.Variables;
u6 = l__client__2.Functions;
u7 = l__client__2.Process;
u8 = l__client__2.Remote;
end,
RateLimits = {
Remote = 0.02,
Command = 0.1,
Chat = 0.1,
RateLog = 10
}
};
local l__type__9 = type;
local l__service__10 = service;
local l__unpack__11 = unpack;
function v1.Remote(p1, p2, ...)
local v2 = { ... };
u8.Received = u8.Received + 1;
if l__type__9(p2) == "string" then
if p2 == l__client__2.DepsName .. "GIVE_KEY" then
if not u4.Key then
u4.Key = v2[1];
l__client__2.Finish_Loading();
return;
end;
else
if u8.UnEncrypted[p2] then
return { u8.UnEncrypted[p2](...) };
end;
if u4.Key then
local v3 = u8.Decrypt(p2, u4.Key);
local v4 = p1.Mode == "Get" and u8.Returnables[v3] or u8.Commands[v3];
if v4 then
local v5 = { l__service__10.TrackTask("Remote: " .. v3, v4, v2) };
if not v5[1] then
logError(v5[2]);
return;
else
return { l__unpack__11(v5, 2) };
end;
end;
end;
end;
end;
end;
function v1.LogService(p3, p4)
end;
local l__string__12 = string;
local l__script__13 = script;
local l__tostring__14 = tostring;
function v1.ErrorMessage(p5, p6, p7)
if p5 and p5 ~= "nil" and p5 ~= "" and (not (not l__string__12.find(p5, "::Adonis::")) or not (not l__string__12.find(p5, l__script__13.Name)) or p7 == l__script__13) then
logError(l__tostring__14(p5) .. " - " .. l__tostring__14(p6));
end;
if (p7 == nil or not p6 or p6 == "") and p6 and not l__string__12.find(p6, "CoreGui.RobloxGui") then
end;
end;
function v1.Chat(p8)
if not l__service__10.Player or l__service__10.Player.Parent ~= l__service__10.Players then
u8.Fire("ProcessChat", p8);
end;
end;
function v1.CharacterAdded()
u1.GetHolder();
l__service__10.Events.CharacterAdded:fire();
end;
local l__next__15 = next;
local l__pcall__16 = pcall;
function v1.CharacterRemoving()
if u5.UIKeepAlive then
for v6, v7 in l__next__15, l__client__2.GUIs do
if v7.Class == "ScreenGui" or v7.Class == "GuiMain" or v7.Class == "TextLabel" then
if v7.CanKeepAlive and (not v7.Object:IsA("ScreenGui") or v7.Object.ResetOnSpawn) then
v7.KeepAlive = true;
v7.KeepParent = v7.Object.Parent;
v7.Object.Parent = nil;
elseif not v7.CanKeepAlive then
l__pcall__16(v7.Destroy, v7);
end;
end;
end;
end;
if u5.GuiViewFolder then
u5.GuiViewFolder:Destroy();
u5.GuiViewFolder = nil;
end;
if u5.ChatEnabled then
l__service__10.StarterGui:SetCoreGuiEnabled("Chat", true);
end;
if u5.PlayerListEnabled then
l__service__10.StarterGui:SetCoreGuiEnabled("PlayerList", true);
end;
local v8 = l__service__10.UserInputService:GetFocusedTextBox();
if v8 then
v8:ReleaseFocus();
end;
l__service__10.Events.CharacterRemoving:fire();
end;
l__client__2.Process = v1;
end;
|
-- Example: Call determineWinningMap after the voting period |
wait(20)
determineWinningMap()
|
--[[Weight and CG]] | --
Tune.Weight = 450 + 150 -- Bike weight in LBS
Tune.WeightBrickSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 3 ,
--[[Height]] 3 ,
--[[Length]] 8 }
Tune.WeightDistribution = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = 0.8 -- Center of gravity height (studs relative to median of the wheels)
Tune.WBVisible = false -- Makes the weight brick visible (Debug)
Tune.BalVisible = false -- Makes the balance brick visible (Debug)
|
-- Notice prompts |
local noticeFrame = Instance.new("ImageLabel")
noticeFrame.BackgroundTransparency = 1
noticeFrame.Name = "NoticeFrame"
noticeFrame.Position = UDim2.new(0.45, 0, 0, -2)
noticeFrame.Size = UDim2.new(1, 0, 0.7, 0)
noticeFrame.Visible = true
noticeFrame.ZIndex = 12--4
noticeFrame.ImageTransparency = 1
noticeFrame.ScaleType = Enum.ScaleType.Fit
noticeFrame.Parent = iconButton
noticeFrame.Active = false
local noticeLabel = Instance.new("TextLabel")
noticeLabel.Name = "NoticeLabel"
noticeLabel.BackgroundTransparency = 1
noticeLabel.Position = UDim2.new(0.25, 0, 0.15, 0)
noticeLabel.Size = UDim2.new(0.5, 0, 0.7, 0)
noticeLabel.Visible = true
noticeLabel.ZIndex = 13--5
noticeLabel.Font = Enum.Font.Arial
noticeLabel.Text = "0"
noticeLabel.TextTransparency = 1
noticeLabel.TextScaled = true
noticeLabel.Parent = noticeFrame
noticeLabel.Active = false
|
--use this to determine if you want this human to be harmed or not, returns boolean |
Explode()
|
--faketorso.Massless = true |
faketorso.Parent = viewmodel
viewmodel.PrimaryPart = fakeroot
viewmodel.WorldPivot = fakeroot.CFrame+fakeroot.CFrame.UpVector*5
viewmodel.Parent = nil
local fakelowertorso = nil
local waistclone = nil
local leftshoulderclone = nil
local rightshoulderclone = nil
local roothipclone = nil
|
--[[
Package link auto-generated by Rotriever
]] |
local PackageIndex = script.Parent.Parent.Parent._Index
local Package = require(PackageIndex["TestEZ-edcba0e9-2.4.1"]["TestEZ"])
return Package
|
-- In radian the maximum accuracy penalty |
local MaxSpread = 0.1 |
--[[ Functions ]] | --
local function to_str_arr(self, init)
if init then
self = string.sub(self, utf8.offset(self, init));
end;
local len = utf8.len(self);
if len <= 1999 then
return { n = len, s = self, utf8.codepoint(self, 1, #self) };
end;
local clen = math.ceil(len / 1999);
local ret = table.create(len);
local p = 1;
for i = 1, clen do
local c = table.pack(utf8.codepoint(self, utf8.offset(self, i * 1999 - 1998), utf8.offset(self, i * 1999 - (i == clen and 1998 - ((len - 1) % 1999 + 1) or - 1)) - 1));
table.move(c, 1, c.n, p, ret);
p += c.n;
end;
ret.s, ret.n = self, len;
return ret;
end;
local function from_str_arr(self)
local len = self.n or #self;
if len <= 7997 then
return utf8.char(table.unpack(self));
end;
local clen = math.ceil(len / 7997);
local r = table.create(clen);
for i = 1, clen do
r[i] = utf8.char(table.unpack(self, i * 7997 - 7996, i * 7997 - (i == clen and 7997 - ((len - 1) % 7997 + 1) or 0)));
end;
return table.concat(r);
end;
local function utf8_sub(self, i, j)
j = utf8.offset(self, j);
return string.sub(self, utf8.offset(self, i), j and j - 1);
end;
|
-- set up keyframe name triggers |
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
end
end |
-- Used to lock the chat bar when the user has chat turned off. |
function methods:DoLockChatBar()
if self.TextLabel then
if LocalPlayer.UserId > 0 then
self.TextLabel.Text = ChatLocalization:Get(
"GameChat_ChatMessageValidator_SettingsError",
"To chat in game, turn on chat in your Privacy Settings."
)
else
self.TextLabel.Text = ChatLocalization:Get(
"GameChat_SwallowGuestChat_Message",
"Sign up to chat in game."
)
end
self:CalculateSize()
end
if self.TextBox then
self.TextBox.Active = false
self.TextBox.Focused:connect(function()
self.TextBox:ReleaseFocus()
end)
end
end
function methods:SetUpTextBoxEvents(TextBox, TextLabel, MessageModeTextButton)
-- Clean up events from a previous setup.
for name, conn in pairs(self.TextBoxConnections) do
conn:disconnect()
self.TextBoxConnections[name] = nil
end
--// Code for getting back into general channel from other target channel when pressing backspace.
self.TextBoxConnections.UserInputBegan = UserInputService.InputBegan:connect(function(inputObj, gpe)
if (inputObj.KeyCode == Enum.KeyCode.Backspace) then
if (self:IsFocused() and TextBox.Text == "") then
self:SetChannelTarget(ChatSettings.GeneralChannelName)
end
end
end)
self.TextBoxConnections.TextBoxChanged = TextBox.Changed:connect(function(prop)
if prop == "AbsoluteSize" then
self:CalculateSize()
return
end
if prop ~= "Text" then
return
end
self:CalculateSize()
if (string.len(TextBox.Text) > ChatSettings.MaximumMessageLength) then
TextBox.Text = string.sub(TextBox.Text, 1, ChatSettings.MaximumMessageLength)
return
end
if not self.InCustomState then
local customState = self.CommandProcessor:ProcessInProgressChatMessage(TextBox.Text, self.ChatWindow, self)
if customState then
self.InCustomState = true
self.CustomState = customState
end
else
self.CustomState:TextUpdated()
end
end)
local function UpdateOnFocusStatusChanged(isFocused)
if isFocused or TextBox.Text ~= "" then
TextLabel.Visible = false
else
TextLabel.Visible = true
end
end
self.TextBoxConnections.MessageModeClick = MessageModeTextButton.MouseButton1Click:connect(function()
if MessageModeTextButton.Text ~= "" then
self:SetChannelTarget(ChatSettings.GeneralChannelName)
end
end)
self.TextBoxConnections.TextBoxFocused = TextBox.Focused:connect(function()
if not self.UserHasChatOff then
self:CalculateSize()
UpdateOnFocusStatusChanged(true)
end
end)
self.TextBoxConnections.TextBoxFocusLost = TextBox.FocusLost:connect(function(enterPressed, inputObject)
self:CalculateSize()
if (inputObject and inputObject.KeyCode == Enum.KeyCode.Escape) then
TextBox.Text = ""
end
UpdateOnFocusStatusChanged(false)
end)
end
function methods:GetTextBox()
return self.TextBox
end
function methods:GetMessageModeTextButton()
return self.GuiObjects.MessageModeTextButton
end
|
--------------------------------------------------------------------------------------------------------
-- Main code |
game.Players.CharacterAutoLoads = false
game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(c)
local t = time()
while ((not c:FindFirstChild("Humanoid")) and ((time()-t) < 10)) do wait(0.2) end -- Wait until Humanoid is present or amount of time waiting is more than 10 seconds
if ((time()-t) >= 10) then print("Timeout error") -- If for some reason the Humanoid isn't found in 10 seconds, break the loop. No need to be stuck in an endless and useless loop.
else
c.Humanoid.Died:connect(function()
if (type(OnDeath_Callback) == "function") then OnDeath_Callback(p) end
wait(SpawnDelayTime)
p:LoadCharacter(true)
end)
end
end)
wait(2)
p:LoadCharacter(true)
end)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.