Player.Team NOT Replicating correctly for LocalScripts when previously assigned Team is nil

Impact: High
Frequency: Constantly

Reproduction Steps:
GetPropertyChangedSignal Team.rbxl (26.1 KB)

Press play then press the TextButton and see the output

Source Code
-- Script
game.Players.PlayerAdded:Connect(function(player: Player)
	player:GetPropertyChangedSignal("Team"):Connect(function()
		print("Server:", player.Team)
	end)
	player:LoadCharacter()
end)

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player)
	player.Team = game.Teams.Red
	wait() -- we need to insert wait for Team to replicate properly, try removing the wait() and see what happens
	player.Team = nil -- will not work properly if Team is set to nil
	wait()
	player.Team = game.Teams.Blue
end)

-- LocalScript
local localPlayer = game.Players.LocalPlayer

localPlayer:GetPropertyChangedSignal("Team"):Connect(function()
	print("Client:",localPlayer.Team)
end)

script.Parent.MouseButton1Down:Connect(function()
	game.ReplicatedStorage:WaitForChild("RemoteEvent"):FireServer()
end)

Expected Behavior:
image

Expected behavior is for Player.Team to be changed to Red > nil > Blue

Actual Behavior:
image
Actual behavior is Player.Team changed to Red > nil > Red > Blue


Current workaround for this is to assign Player.Team to a placeholder Team instead of nil

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.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.