Wait Time To Kick Idle Players?

In my upcoming game, players take turns making their moves. However, I don’t want the experience to be ruined by a guy who forgot to turn off their PC when going to lunch. So, I’m thinking of treating idle players in two stages:

  1. All other players will vote for whether the player should be controlled or not. At least half of players most agree on this

  2. After a while, if the player still has not made a move, then they will automatically controlled.

I say controlled because I don’t want them to be kicked, I just simply want them to be taken over until they come back. This way if they simply wanted to leave it like that for a while, and then come back, they could still play. However, there are two things I am unsure of:

How much time should it take to call a vote?
How much time should it take to auto control?
And should there be an AI controlling the player, or not?

4 Likes

So you mean a time limit on making a move? Or maybe have a timer in the bottom of the screen saying how long you have left. You could make it where they can click a button to prove they’re not afk and say if they don’t click it, it could do something like put them in afk mode where their moves are made for them.

Yes. But I am saying that assuming that they don’t make a move, the fact that there is a timer on the turn won’t matter. And yes, I will have a button where they press or moves are made for them.

If they are afk for a certain time (indicated by the timer so they don’t get put in the mode while thinking which move to make) then it should automatically put them into that mode until they get back and start playing again. That’s what I think

Lets say that the player has not made a move for longer for than the wait time, that’s one strike
If the player gets three strikes, then you could just mark them as the player that lost, I would’nt use an AI to control the player because there is error in AI or the AI might make the player lost

Roblox will kick a player out of a game if they have been inactive for 20 minutes. But of course, in your scenario this is too much of a wait. I don’t think it’s necessary for an AI to control a player or a voting system to be implemented. Just have a script which will check when the player hasn’t moved within 5 minutes and then mark them as AFK (they won’t be able to join a match until they click the “AFK” GUI).

2 Likes

Yeah just mark them as AFK and don’t put them in the “playing” mode so they don’t join rounds and ruin the experience for others.

2 Likes

you can simply make a script where if the play hasn’t made a move in 5 mins then after every minute they will play an animation that wouldn’t get them kicked out of the game

I don’t think you should bypass Roblox’s systems. Simply mark the player as AFK if they haven’t moved in 2 or 5 minutes, this should block them from joining matches and keep them in the lobby until they click the “AFK” GUI. Roblox automatically kicks a player if they haven’t moved in 20 minutes to prevent AFK people ruining the experience for others. This should not be bypassed, as it is a crucial feature in the Roblox Player.

To clear up some confusion here, this is not in the lobby. If it was, I would not even care about marking them AFK, they can stay there all they want. However, what I don’t want is a deserter in the middle of the match, who just literally leaves their computer. Because this is a turn based game, I don’t want to eject them, but just simply remove player input until they come back.

Try this in a LocalScript

local UserInputService = game:GetService("UserInputService")
local AFKSeconds = 0 
local maxSeconds = 20 -- The AFK seconds to be kicked
local Reason = "AFK" -- Reason to be kicked

UserInputService.InputBegan:Connect(function()
	AFKSeconds = 0
end)

while wait(1) do
	AFKSeconds += 1
	if AFKSeconds == maxSeconds then
		game.Players.LocalPlayer:Kick(Reason)
		AFKSeconds = 0
	end
end

1 Like

Roblox automatically kicks people after not moving for 20 minutes. Although you can bypass this by clicking every so often. Best bet is so make a script to lower this. Maybe kick every 10 instead of 20?

Except you’re going to need to set up some remote events. Along with some local scripts.