im trying to make a main menu spawn/play button that once clicked it spawns you and the main menu camera fx stops but the camera fx loop seems to be bugged badly. even after removing the extra code from the while loop and the clicked function this simple code just refuses to work the way it should
local debounce = false
local respawned = false
script.Parent.TextButton.MouseButton1Click:Connect(function()
if debounce == false then
respawned = true
print("respawned!")
end
end)
while respawned ~= true do
print(respawned)
wait()
end
print("done")
expected result
false
false
respawned!
done
actual result
AFTER FURTHER TESTING
THIS BREAKS LOGIC EVEN MORE
local debounce = false
local respawned = false
script.Parent.TextButton.MouseButton1Click:Connect(function()
if debounce == false then
debounce = true
respawned = true
while true do
print("2 "..tostring(respawned))
wait()
end
end
end)
while respawned ~= true do
print("1 "..tostring(respawned))
wait()
end
EXPECTED RESULT
1 false
1 false
2 true
1 true
2 true
1 true
ACTUAL RESULT
AFTER FURTHER TESTING
THEY MADE ME INSTALL EVIL ROBLOX STUDIO OR SOMETHING
local TEST = false
script.Parent.TextButton.MouseButton1Click:Connect(function()
TEST = true
end)
while TEST == false do
print(TEST)
wait()
end
print("DONE")
how does the loop end yet continue at the same time