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)
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)