How to know how long the player was idle for

Hey devforum, I’m trying to make it so if you’re idle for at least 5 seconds another idle plays. But I’m wondering how I can get how long the player is idle for.

By the way, I don’t want a direct script. I’d like a guide and details on how to do it. Trying to learn from this :smile:

you can use Humanoid.StateChanged to know if the player went ideal then connect it to a function where you will add 1 to a variable every second, and return that variable once again when Humanoid.StateChanged is fired

1 Like

Try modifying this:

1 Like

Both of these worked, just made two versions but the solution in my opinion saved a lot of time.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.