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

How do I fix this Script.Disabled/Script.Enabled script for my car?

Asked by 7 years ago

I'm trying to make a script that basically detects a vehicle seat's speed, and if it is greater than or equal to 30, then a script inside a part called "HitBox" is enabled. What am I doing wrong here?

if game.Workspace.BigCar.VehicleSeat.Velocity.Magnitude >= 30 then
    script.Parent.Parent.HitBox.Script.Disabled = false
end

Keep in mind that I tested the other script alone without this part and it works fine, it's just this part.

0
You should not enable and disable scripts since you have no control how it is done or what "state" that script is in. connect and disconnect events instead. User#5423 17 — 7y
0
Weird. I've done successful script disable and undisable scripts. TheBeaver101 28 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

the code is only being run once, you would have to keep checking for the speed because at the start, the speed is prob gonna be 0, and that's what the code will receive

0
How exactly would I make it constantly check? TheBeaver101 28 — 7y
Ad

Answer this question