Hey! So I’m working on this sword fight game with my friend, and we wanted to kick people for being AFK for 5 minutes instead of 20 minutes. Is this possible?
1 Like
You can use the Player.Idled event and check if they idled for 5 minutes.
local player = game.Players.LocalPlayer
player.Idled:Connect(function(seconds)
local minutes = math.floor(seconds / 60)
if minutes >= 5 then
--player is idle for 5 minutes
player:Kick("You've been idle for 5 minutes.")
end
end)
2 Likes
This would be a LocalScript, right?
Yes. I’m certain player.Idled fires in LocalScripts.
GalaxyGourmet shard an Nice way to do so But I just wanted to share another way that is similar.
please let me know how to make my text look like a script I completely forgot how .
Anyways you can do the same but use mouse like this:
local mouse = game.Players.LocalPlayer:GetMouse()
then you could do
mouse.Idle:Connect(function()
end
and you know what happens next. Just wanted to share this!!
1 Like