How to Instantly Break a While Loop on Value Change?

You could probably do something like this:

local status = script.Parent.Status

status.Changed:Connect(function()
	if status.Value then -- true
		repeat allBlues()
		wait(0.4)
		if status.Value then
			allReds()
			wait(0.4)
		end
		until not status.Value
	else -- false
		allOff()
	end
end)

3 Likes