Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is it possible to make a wait that's forever long?

I've been making some debounce things with some scripts I've been using and I was wondering if It's possible to make a wait function go on for infinity so the script won't look messy. For an example:



db = true

script.Parent.MouseClick:connect(function()
	if db == true then
		db = false
		
		-- do stuff		
		
	end
	wait(9999999999999999) -- until can be pressed again
	db = true
end)



Obviously, I don't need a wait longer than that but my point is, is there any possible way to make a wait run forever without having to have it be "999999999999999999" It makes the script look messy.

1 answer

✓ Accepted answer

A debounce is not what you need for this. :) What you need is to disable the script after it has been activated.

db = true
 
script.Parent.MouseClick:connect(function()
    if db == true then
        db = false
 
        -- do stuff     
 
    end
end)

I'm not very good with scripting but I believe this eliminates the possibility of it becoming enabled again, because db stays false. I hope i'm right about this but i'm just using logic. :b

3 comments

0

Thanks!

1

Why not disconnect the listener?

0

^ Either way is fine, to be honest.

This discussion is preserved as it was. New answers, comments, and votes are closed.