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!
