So I made a car completely using joints and constraints. However, I noticed that in order to operate like a car, I must make a script that operated the joints:
local seat = script.Parent local car = workspace:FindFirstChild("Car_"..script.Parent.Owner.Value) local function onChanged(property) if property == "Steer" then local SteerAngle = car.SteerAngle.Value car.Angle.Value = seat.Steer*SteerAngle end if property == "Throttle" then local MaxSpeed = car.MaxSpeed.Value car.Speed.Value = seat.Throttle*MaxSpeed end end
and another one to manages those values:
while wait() do local car = script.Parent local seat = script.Parent.Seat.Value local speed = car.Speed.Value local angle = car.Angle.Value script.Parent:FindFirstChild("FR").HingeConstraint.AngularVelocity = speed*seat.Throttle*-1 script.Parent:FindFirstChild("RR").HingeConstraint.AngularVelocity = speed*seat.Throttle*-1 script.Parent:FindFirstChild("FL").HingeConstraint.AngularVelocity = speed*seat.Throttle script.Parent:FindFirstChild("RL").HingeConstraint.AngularVelocity = speed*seat.Throttle script.Parent:FindFirstChild("Chassis").HingeConstraint.TargetAngle = angle*seat.Steer end
I am wondering why the motors are so delayed in functioning... On play solo, they work just fine, but on a test server, they are delayed by around 0.5 of a second.
Help would be much appreciated. Thanks in advance!
If this works on solo well but on a test server not as much you could be a victim of latency.
Ping and latency (same thing) are the milliseconds it takes to travel from Server:Client. If I'm not mistaken it's virtually reproduced even in ROBLOX Test servers. There are a multitudes of ways you could avoid this, to some limits. One of these would be to use a local script, which, as you can imagine, can lead to security issues but typically, are fine for most players.