I recently redid the script to make it assign NetworkOwnership, it appeared that everything was running fine for a couple of hours - and randomly the input lag begins again.
Here is the current script:
Server Script:
script.Parent.EngineOff:Play()
local speed = 0
local accel = 2--originally 2
local TimeTillDestroy = 500
local timeSincelastOccupant = 0
local FLW = script.Parent.Parent.FrontLeftWheel
local FRW = script.Parent.Parent.FrontRightWheel
local BLW = script.Parent.Parent.BackLeftWheel
local BRW = script.Parent.Parent.BackRightWheel
-----
while wait() do
if script.Parent.Occupant then
local humanoid = script.Parent.Occupant
local player = game:GetService("Players"):GetPlayerFromCharacter(humanoid.Parent)
if player then
script.Parent:SetNetworkOwner(player)
end
if speed > 10 and script.Parent.Occupant.Parent.HumanoidRootPart.Velocity.magnitude < speed then
speed = script.Parent.Occupant.Parent.HumanoidRootPart.Velocity.magnitude
end
timeSincelastOccupant = 0
else
if timeSincelastOccupant > TimeTillDestroy then
script.Parent.Parent:Destroy()
end
script.Parent:SetNetworkOwnershipAuto()
speed = 0
timeSincelastOccupant = timeSincelastOccupant + 0.2
end
if script.Parent.Throttle == 1 then
FLW.HingeConstraint.AngularVelocity = speed
FRW.HingeConstraint.AngularVelocity = speed
BLW.HingeConstraint.AngularVelocity = -speed
BRW.HingeConstraint.AngularVelocity = -speed
if speed < 0 then
speed = speed+accel
elseif speed < 35 then--originally 35
speed = speed+accel/5
end
script.Parent.Parent.CarModel.BackLights1.Material = Enum.Material.SmoothPlastic
script.Parent.Parent.CarModel.BackLights1.BackLight.Enabled = false
elseif script.Parent.Throttle == -1 then
FLW.HingeConstraint.AngularVelocity = speed
FRW.HingeConstraint.AngularVelocity = speed
BLW.HingeConstraint.AngularVelocity = -speed
BRW.HingeConstraint.AngularVelocity = -speed
if speed >= 0 then
speed = speed-accel
elseif speed > -15 then
speed = speed-accel/5
end
script.Parent.Parent.CarModel.BackLights1.Material = Enum.Material.Neon
script.Parent.Parent.CarModel.BackLights1.BackLight.Enabled = true
else
FLW.HingeConstraint.AngularVelocity = speed
FRW.HingeConstraint.AngularVelocity = speed
BLW.HingeConstraint.AngularVelocity = -speed
BRW.HingeConstraint.AngularVelocity = -speed
if speed > 0 then
speed = speed-accel
elseif speed <= 1 and speed >= -1 then
speed = 0
end
script.Parent.Parent.CarModel.BackLights1.Material = Enum.Material.Neon
script.Parent.Parent.CarModel.BackLights1.BackLight.Enabled = true
end
script.Parent.EngineOff.PlaybackSpeed = 1+math.abs(speed)/20
script.Parent.Parent.FrontRightSteer.HingeConstraint.TargetAngle = script.Parent.Steer*17
script.Parent.Parent.FrontLeftSteer.HingeConstraint.TargetAngle = script.Parent.Steer*17
if game.Lighting.ClockTime > 6.5 and game.Lighting.ClockTime < 17.5 then
script.Parent.Parent.CarModel.HeadLights.Material = Enum.Material.SmoothPlastic
script.Parent.Parent.CarModel.HeadLights.HeadLight.Enabled = false
else
script.Parent.Parent.CarModel.HeadLights.Material = Enum.Material.Neon
script.Parent.Parent.CarModel.HeadLights.HeadLight.Enabled = true
end
end
This is the only script that makes the vehicle function the way it does, I’m not the most experienced with vehicle scripting by any means.
To experience the “input lag” - you can feel free to check it out in our game, there is car spawns located all around the map:
https://www.roblox.com/games/6425690762/Springbrook-RP-BETA#