I want to change a NumberValue's value whenever the car goes backwards and forwards.
The NumberValue
local MS = seat.Speed.Value
The function that has to change the NumberValue's value.
local function onChanged(property) if property == "Throttle" then LD.AngularVelocity = MS * seat.Throttle RD.AngularVelocity = -MS * seat.Throttle if seat.Throttle >= 0 then MS = 77 print("going forward") else MS = 30 print("going backward") end end if property == "Steer" then LS.TargetAngle = SA * seat.Steer RS.TargetAngle = SA * seat.Steer end end seat.Changed:Connect(onChanged)
You do
seat.Speed.Value = 50 -- Can be any value
If you store the value into a variable, it only stores the number not the actual instance, you have to do NumberValue.Value = 30
not MS = 30