I made a script that waits until a value is true until changing the parent part’s properties. It won’t change anything even if the value is true. Here is the script:
inRound = game.ReplicatedStorage.InRound
part = script.Parent
part.Velocity = Vector3.new(0,0,0)
if inRound == true then
wait(5)
part.Velocity = Vector3.new(0,0,100)
else
part.Velocity = Vector3.new(0,0,0)
end
I’m assuming you’re a scripting rookie, which is 100% not a problem! I’m just making the notation so I can adapt to how I can help you.
There’s a method called :GetPropertyChangedSignal(PropertyName) which returns an event signal so we can connect a function to this which fires every time the specific property has been changed.
How you can use this:
inRound = game.ReplicatedStorage.InRound
part = script.Parent
part.Velocity = Vector3.new(0,0,0)
inRound:GetPropertyChangedSignal("Value"):Connect(function()
if inRound.Value then
-- we dont need to do inRound.Value == true because inRound.Value is already a boolean!
wait(5)
part.Velocity = Vector3.new(0,0,100)
else
part.Velocity = Vector3.new(0,0,0)
end
end
We can even simplify this!
Simplified
inRound = game.ReplicatedStorage.InRound
part = script.Parent
part.Velocity = Vector3.new(0,0,0)
inRound:GetPropertyChangedSignal("Value"):Connect(function()
part.Velocity = inRound.Value and Vector3.new(0,0,100) or Vector3.new(0,0,0)
end
Wow, I had no idea inRound and inRound.Value were different at all. I just assumed one was just a shorter way of saying it. One little detail completely changed the script! Thank you, this helps me a lot.