while true do
--random code
wait(15)
--different code
wait(15)
end
´´´
How can I make it so at any time, if the event happens it will instantly stop? Event being :GetPropertyChangedSignal()
Thank you in advance
Do you need it to stop midway through the loop, or is it fine if it completes another iteration? If it’s fine to complete another iteration, you could set a variable to true, use that as the condition in the while loop, and only set it to false on :GetPropertyChangedSignal. Quick example:
local notFired = true
game:GetPropertyChangedSignal[[ChildAdded]]:Connect(function()
notFired = false
-- something else maybe
end)
while notFired do
--random code
wait(15)
--different code
wait(15)
end