Team Change Updating Playerlist

Hey there, my goal is to create a custom playerlist. I have made simple designs (will be changed later on to be more flashy) and have gotten the playerlist to update for new players and already existing players. I have added a team change update, where when a player changes team, it will update the playerlist and place it below the correct team. It also shows the rank for that team.

The issue is the team update is local. Only you, the localplayer can see your own team change, but no one else can. The same thing happens when a different player changes team, you wouldn’t be able to see them changing teams.

I have looked at DevForums and found only local solutions, and even tried my own solution via remote events / functions.

https://gyazo.com/ac15ac662e8df21044ba204558124d13

local function onTeamChange(player)
	
	local PlayerSlot = player.PlayerGui.Leaderboard.ScrollingFrame:FindFirstChild(""..player.Name)
	
	if player.Team.Name == "Averis Division" then
		PlayerSlot.LayoutOrder = 0
		PlayerSlot.Rank.Text = averisranks[""..player.playerstats.averisrank.Value]-- Find player's rank for averis if switched to
	elseif player.Team.Name == "JPLTech" then
		PlayerSlot.LayoutOrder = 1
		PlayerSlot.Rank.Text = jpltechranks[""..player.playerstats.jpltechrank.Value]-- Find player's rank for jpltech if switched to
	elseif player.Team.Name == "Kokan Corporation" then
		PlayerSlot.LayoutOrder = 2
		PlayerSlot.Rank.Text = kokanranks[""..player.playerstats.kokanrank.Value]-- Find player's rank for kokan if switched to
	end
end

for _, player in ipairs(Players:GetPlayers()) do
	player:GetPropertyChangedSignal("Team"):Connect(function()
		onTeamChange(player)
		
	end)
end

All I need assistance on is how to update all clients to show that you switched teams. I have done RemoteEvents/Functions and maybe I just did it wrong.

You’ll need to create a remote event and pass the team the player wants to switch to in the arguments. Then, you can handle it on the server so it replicates to all clients.

1 Like

I’ll definitely try again, thank you for letting me know I was somewhat on the right path.

1 Like

A remote event definitely WAS the solution, thank you! I just did it wrong in the first place!