So I am having trouble changing a players team. It might sound simple but it really isn't working when I try this VERY easy script. Help?
local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:Connect(function() local teamName = ("TSE") player.TeamColor = BrickColor.new("Really black") player.LoadCharacter() script.Parent.Parent.Enabled = false end)
LoadCharacter
on the client, when it is server-side only. You are also changing the team on the client, and it will not replicate because of this. A fix would be to use RemoteEvent
s.-- Server script, place in ServerScriptService local ChangeTeam = Instance.new("RemoteEvent") ChangeTeam.Name = "ChangeTeam" ChangeTeam.Parent = game:GetService("ReplicatedStorage") ChangeTeam.OnServerEvent:Connect(function(plr, teamColor) plr.TeamColor = teamColor plr:LoadCharacter() end) -- back in your localscript VVVV local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:Connect(function() local teamName = "TSE" game:GetService("ReplicatedStorage").ChangeTeam:FireServer( BrickColor.new("Really black") ) script.Parent.Parent.Enabled = false end)