The Issue
Hi. Im making a VehicleSeat car, and i wanted to make a button that basically sets your speed, but is reversible. The thing is, i don’t really know how to put it into script. I already have a lot of ideas on how to do it, but not really how to actually script it. Some Ideas
I do know already some things about how i could go about writing this script. First of all, to change the speed of the car you only need this code:
seat.MaxSpeed = 30
And i also learned that if a value is set and the value makes it so that the VehicleSeat goes at a certain speed, the MaxSpeed cant change until the value changes.
So i thought that when the TextButton gets clicked, a function activates that detects if a value is 0, then it changes to 1. If the value is 1, the MaxSpeed changes. If the value is 0, the MaxSpeed goes back to normal. Please put your input on how i could script this. Why i made this
I made this thread because no other thread like it existed. I thank all replies that try to help! Have a great day.
local normal = 0
script.Parent.MouseButton1Down:Connect(function()
if normal == 0 then
normal = 1
seat.MaxSpeed = normal
else
normal = 0
seat.MaxSpeed = change
end
end)
I know how to do basic things, im not THAT bad at coding, so you dont really need the speed but if you want ig, 200 is normal and 70 is not normal, and the textbutton is called cautionlimiter
local seat = workspace.Seat --Define urself change this, find where seat is (ex: workspace.Car.Seat)
local normal = 0 --dont touch
script.Parent.MouseButton1Down:Connect(function()
if normal == 0 then
normal = 1
seat.MaxSpeed = 70
else
normal = 0
seat.MaxSpeed = 200
end
end)