How to Break a loop with a condition?

Hey guys, Do you guys know how to break a loop when something changed, or is true
for example how would i break a loop

local debounce = false
spawn(function()
		while wait(1) do
			loadingText.Text = 'LOADING CLIENT'
			wait(1)
			loadingText.Text = 'LOADING CLIENT.'
			wait(1)
			loadingText.Text = 'LOADING CLIENT..'
			wait(1)
			loadingText.Text = 'LOADING CLIENT...'
			wait(1)
		end
	end)
	
	spawn(function()
		while wait(1) do
			for i = 0,1,.1 do
				wait(.01)
				saveicon.ImageTransparency = i
			end

			for i = 1,0,-.1 do
				wait(.01)
				saveicon.ImageTransparency = i
			end
		end
	end)

how would i break this loop if lets say the Debounce : true

if (Debounce) then break end

1 Like

if debounce then break end

Use an if statement, and if the system returns it true, then add the break.

if debounce == true then
    break
end

This is basically a sanity check. It is checking if the variable is true, and if it is it will break the loop. Otherwise, it will not break the loop, because the sanity of the variable was false.