Team PlayerAdded and PlayerRemoved events firing unnecessarily on the client

In certain cases, a Teams PlayerAdded and PlayerRemoved event will fire without reason only on the client side. This happens to a players previously joined team after setting themselves to Neutral, and joining a different team.

Reproduction Steps

  1. Create two (or more) teams
  2. Set a PlayerAdded and PlayerRemoved event to both teams on the client (to know when they fire)
As seen here
local Teams = game:GetService("Teams")

local Ruby = Teams:WaitForChild("Ruby")
local Amethyst = Teams:WaitForChild("Amethyst")

Ruby.PlayerAdded:Connect(function()
	print("Ruby Added CLIENT")
end)
Ruby.PlayerRemoved:Connect(function()
	print("Ruby Removed CLIENT")
end)

Amethyst.PlayerAdded:Connect(function()
	print("Amethyst Added CLIENT")
end)
Amethyst.PlayerRemoved:Connect(function()
	print("Amethyst Removed CLIENT")
end)
  1. During playtesting, assign your player to one of the teams.
  2. Set your player’s Neutral property to true to remove from all teams
  3. Assign your player to the other team.

Expected Behaviour
When the events are connected to the server, the expected result occurs
image

Actual Behaviour
The Client fires the PlayerAdded and PlayerRemoved event for the last team before firing the PlayerAdded event for the new team. (highlighted is the unwanted events firing)
image

This does not occur when you change the players team immediately without setting the player to Neutral first.

Repro Place Pressing the provided buttons in descending order will reproduce the issue
TeamIssue.rbxl (26.6 KB)

Issue Area: Roblox Player and Roblox Studio
Impact: Low
Frequency: Sometimes

Thanks for the report! We’ve filed a ticket to our internal database and we’ll follow up when we have an update for you.

1 Like