Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I change the reverse speed?

Asked by 2 years ago

Hey there! I was making a car from a tutorial then changing some codes to make it more better! (organizing and making it simple for me and my friends to make random things lol) but I encountered an issue, I want to make my car go slow when you reverse Here is my code! (This is the main code that makes the car move and stuff)

local leftwheel = script.Parent.Parent.WheelConstraints.LeftWheel
local leftwheel2 = script.Parent.Parent.WheelConstraints.LeftWheel2
local rightwheel = script.Parent.Parent.WheelConstraints.RightWheel
local rightwheel2 = script.Parent.Parent.WheelConstraints.RightWheel2
local Steer = script.Parent.Parent.SteerConstraint
local Speed = script.Parent.Parent.CarProperties.Mph.Value * 1.609 * 2/3 + 1
local SteeringSpeed = script.Parent.Parent.CarProperties.SteeringSpeed.Value

script.Parent.Changed:Connect(function(property)
    leftwheel.AngularVelocity = Speed * script.Parent.Throttle
    leftwheel2.AngularVelocity = Speed * script.Parent.Throttle
    rightwheel.AngularVelocity = Speed * -script.Parent.Throttle
    rightwheel2.AngularVelocity = Speed * -script.Parent.Throttle
    Steer.TargetAngle = SteeringSpeed * script.Parent.Steer
end)

I have never made this kind of thing so It's my first time! so really would like it if you were able to help me!

Answer this question