How to use "OR" in repeat loop

how can I script this properly in this code?

until player.leaderstats.Level.Value < 100 or "When closebutton is clicked"

so the loop will close and further overload is prevented.

local clicked = false

local connection 
connection = button.MouseButton1Click:Connect(function()
	clicked = true
end)

repeat
	-- 
until player.leaderstats.Level.Value < 100 or clicked
1 Like

Thank you! the code works perfectly fine and it does not crash my game anymore :slight_smile:

image

This is the tweening loop I am trying to stop xd

I forgot to mention that you will want to disconnect the connection that was created.

local clicked = false

local connection 
connection = button.MouseButton1Click:Connect(function()
	clicked = true
	connection:Disconnect()
end)

repeat
	-- 
until player.leaderstats.Level.Value < 100 or clicked

adding the :Disconnect() gives error to the code…

am i missing something?