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

while loop will not break when set to false ?

local float = true
while float == true do
	gui.back.title:TweenPosition(UDim2.new(0.114, 0,-0.151, 0),"Out","Quad",1,true)
	wait(1)
	gui.back.title:TweenPosition(UDim2.new(0.114, 0,-0.101, 0),"Out","Quad",1,true)
	wait(1)
end

gui.back.button.Activated:Connect(function()
 float = false
end

2 comments

0

use spawn(function() to thread the loop... duh or coroutines.. This is so that line 9 is able to work, the loop is not allowing that to happen, with spawn(function() it will work

0

Just use break lol.

2 answers

✓ Accepted answer

This is because you have to do the binding first then the while loop:

while wait() do

end

print("This will NEVER print because of that while loop")

Instead this would be much better:

print("Now we can print what we want and run the loop")
while wait() do

end

2 comments

0

^ or you can spawn the function

0

Thanks matey

Your code never reaches

gui.back.button.Activated:Connect(function()
	float = false
end

because it gets caught in the loop. Move your connect function before the loop starts.

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