Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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

Log in to vote
1
Answered by 6 years ago

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

0
Thanks! jack8699 15 — 6y
1
Why not disconnect the listener? TheeDeathCaster 2368 — 6y
0
^ Either way is fine, to be honest. Mayk728 855 — 6y
Ad

Answer this question