Team.PlayerRemoved fires while player is still on the team, if the player leaves the game

If a player leaves the game while on a team, team:GetPlayers() will still include them (for one frame). The expected behaviour is that they are no longer on the team (hence removed, not removing). This bug does not happen when explictly changing their team.

This is a small repro, a better one is attached below.

team.PlayerRemoved:Connect(function(player)
	print(#team:GetPlayers()) -- (number before leaving)
	wait()
	print("Amount after delay", #team:GetPlayers()) -- (number - 1)
end)

Repro.rbxl

5 Likes

I can reproduce as well, and this bug is still happening. People shouldn’t have to build their scripts around this behavior.