Greetings! I am creating a car completely from scratch, however, I have a small issue:
The car rotates pretty weirdly when I press W and S.
Here is my code:
local Seat = script.Parent.VehicleSeat
local BackLeft = script.Parent.BackLeft
local BackRight = script.Parent.BackRight
local FrontLeft = script.Parent.FrontLeft
local FrontRight = script.Parent.FrontRight
local SteeringAngle = 30
local Speed = 60
Seat:GetPropertyChangedSignal("Steer"):Connect(function()
FrontLeft.PartB.HingeConstraint.TargetAngle = SteeringAngle * Seat.Steer
FrontRight.PartB.HingeConstraint.TargetAngle = SteeringAngle * Seat.Steer
end)
Seat:GetPropertyChangedSignal("Throttle"):Connect(function()
FrontLeft.Tire.WheelConstraints.AngularVelocity = Speed * Seat.Throttle
FrontRight.Tire.WheelConstraints.AngularVelocity = Speed * Seat.Throttle
BackLeft.Tire.WheelConstraints.AngularVelocity = Speed * Seat.Throttle
BackRight.Tire.WheelConstraints.AngularVelocity = Speed * Seat.Throttle
end)
No errors in output.
If you can help, that would be great!