Is there a way to wait until a bool value = false?
Hi there, I'm currently trying to make a script that will set a vehicle seats maxspeed to 0 when it touches a sensor brick which has a bool value inside. The idea is that it would touch the brick and if the bool value inside the brick is false the seats maxspeed will go to 0 and then it would wait until the bool value changes to true at which point the vehicle seats maxspeed would return to its original value. Thanks :)
Here is the current script with the part that I'm not sure how to do written in internal commentary
01 | local sig = script.Parent.Parent |
05 | local occupation = script.Parent.BlockOccupied |
07 | script.Parent.Touched:connect( function (Part) |
08 | if Part.ClassName = = "VehicleSeat" then |
09 | if debounce = = false then |
11 | if occupation.Value = = true then |
16 | elseif occupation.Value = = false then |
18 | top.BrickColor = BrickColor.new( "Really black" ) |
19 | top.Material = "SmoothPlastic" |
20 | btm.BrickColor = BrickColor.new( "Really red" ) |
22 | occupation.Value = true |