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

Is there a way to find if there is an idle player?

I could make a script that could find out when the idle animation plays, but It doesn't work. There is a way to see if there is an idle player but It checks for players that have been idle for 2 min. How could you change it to 5 seconds instead of 2 min?

game.Players.Player.Idled:connect(function(time)
     print("Player has been idle for " .. time .. " seconds")
end)

1 comment

0

You could write your own custom event using ticks and UserInputService.

2 answers

✓ Accepted answer

Yes there is a way, I don't feel like scripting it but make a mouse move script that resets a counter the counter goes up every seconds and after a certain amount it goes to idle mode. This value aka the seconds idled should be reset by keydown and moved all mouse functions. So relatively easy.

Example

local player = game.Players.LocalPlayer
repeat wait() until player.Character
local mouse = player:GetMouse()
local seconds = script.Parent.Parent.Seconds
function moved() 
seconds.Value = 0
end

function down()
seconds.Value = 0
end

mouse.KeyDown:connect(down)
mouse.Moved:connect(moved)

Inside the seconds there should be

while true do
wait()
if seconds.Value<60 then
seconds.Value=seconds.Value+1
wait(1)
end

end

Sadly no, if you look at the Roblox Wiki page for this event, then you'll see that the only duration is every two minutes. Sorry about that.

2 comments

0

I got the script from the wiki. I already know It takes 2 min that's why I asked it.

0

And I answered. Your question was "Is there a way to find if there is an idle player?" the answer (besides what you pointed out) is no

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