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

What does the if execute after?

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

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)

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