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

How to I detect if something is 'inactive' ?

So I'm trying to detect if the Surface GUI has been clicked in x amount of time (let's just say 5 seconds). If it is idle for x amount of seconds, then the GUI resets (I have that code done). I have no idea, I tried doing mouse.Idle() but that would be for the mouse, not the gui. Also the mouse is always idle when not moving, so that wouldn't work.

I mean, here is the code I tried, but its with mouse.Idle() that I know doesn't work

if mouse.Idle() then
	Reset()
end

Any tips or events I can do to detect it? Thanks

I did look at the object browser but no luck

2 comments

0

I think you can just have the idle normally, on press change, and wait(5) to use function reset()

0

Alright. I'll just do that. I plan to make my game very basic anyway lol

1 answer

✓ Accepted answer

Try this:

if mouse.Idle then
	Reset()
end

But make sure that you actually have that in a function or something if you want it to work. Otherwise, you'll wanna do:

mouse.Idle:connect(function()
	Reset()
end)

I suggest you use the one above to detect if the mouse is idle.

2 comments

0

Thanks. It works for what I need.

0

No problemo.

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