Team changes, but only displays for you

Me and some friends are creating a game. We’ve created a LocalScript inside a TextButton that changes your team once clicked. However, on the leaderboard, it only shows your own user on that specific team. Here is my script

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local team = game.Teams.CATS -- Change "Cats" to the team name

script.Parent.MouseButton1Click:Connect(function()
	character.HumanoidRootPart.CFrame = workspace.CatSpawn.CFrame
	player.Team = team
	script.Parent.Parent.Parent.Visible = false
	player:LoadCharacter()
end)

Like you said, your changing teams in a local script, that means it will only happen on the client, not the server

If I change it to a regular script, it stops working

Have a different script for changing teams

you need to use :FireServer() and change the player team via Server

https://developer.roblox.com/en-us/api-reference/class/RemoteEvent

Add a RemoteEvent to Replicated Storage.

Server:

local event = game:GetService("ReplicatedStorage").RemoteEvent

local team = game.Teams.CATS 

game.Players.PlayerAdded:Connect(function(p)
	
	local character = p.Character or p.CharacterAdded:Wait()

	local function Clicked()
		character.HumanoidRootPart.CFrame = workspace.CatSpawn.CFrame
		p.Team = team
		p:LoadCharacter()
	end
	event.OnServerEvent:Connect(Clicked)
end)

Local:

local event = game:GetService("ReplicatedStorage").RemoteEvent

script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.Parent.Visible = false
	event:FireServer()
end)