Hi

Today I encountered that my friend got a Snapchat while in the game. He then pressed the snapchat and went out of the game. When he entered the game again he came directly into the lobby and not into the game.

I could still see him on the leaderboard like he was in the game, but he was not. It seems like the GameTag is still alive when the player just switch app on the ipad, but when he goes into the Roblox app again he only gets into the lobby.

This mess up the game since the game thinks there are more players in the game than it actually is.

How can I avoid this to happen? Should PlayerRemoving take care of this? In my gameplay I loop to check if the players have a GameTag, if they don't have one they are removed from the game. It seems like the 'character' is still alive even though he is moved out to the lobby.

Before the game starts I add all players into a table

for i, player in pairs(game.Players:GetPlayers()) do
	if player then
		table.insert(plrs, player) --add each player into the plrs table
	end
end

In the gameloop I check if they are alive:

for i = GameLength,0,-1 do
	for j, player in pairs(plrs) do
		if player then
			character = player.Character
			if not character then
				--Left the game
			else
				if character:FindFirstChild("GameTag") then
					--They are still alive
				else
					--They are dead
					table.remove(plrs,j)
				end
			end
		else
			table.remove(plrs,j)
		end
	end
end

...But how can I effect this when player is removed (PlayerRemoving)? Hmmm... maybe a RemoteFunction or something... Because it is kinda hard to remove the player if there is no Character.

2 comments

0

You could check to see if the player has moved within a certain amount of time and kick them if they haven't. Roblox already does this, but I believe they only do this after 20 minutes.

0

But how can I check if the player has moved? I thought the check if the player has a GameTag is exactly that. I thought the player only have a GameTag while in the game. I he suddenly is out in the lobby the player should not have a GameTag anymore? Or am I missing something here?