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

What does the if execute after?

Asked by 6 years ago
Edited 6 years ago
while true do
    wait (1)
    script.Parent.Text = "Spinning."
    wait (1)
    script.Parent.Text = "Spinning.."
    wait (1)
    script.Parent.Text = "Spinning..."
    if 
        game.Workspace.YesOrNo.Value == 1 then

script.Parent.Text = "Congratulations!"
break 

    end

It would only say "Congratulations!" after the last "Spinning..." How do i make it do it as soon as the YesOrNo.Value is 1 and not wait?

1 answer

Log in to vote
0
Answered by 6 years ago

I'm assuming you're using an IntValue. From the Wiki:

Description: Fired whenever the Value of the IntValue is changed.

-- Put this outside of your while loop
game.Workspace.YesOrNo.Changed:Connect(function(changedValue)
    if changedValue == 1 then
        script.Parent.Text = "Congratulations! You one!(pun intended)"
    end
end)
Ad

Answer this question