Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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.

2 comments

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.

0

Weird. I've done successful script disable and undisable scripts.

1 answer

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

1 comment

0

How exactly would I make it constantly check?

This discussion is preserved as it was. New answers, comments, and votes are closed.