I'm using local scripts. It is a team change GUI. All works in studio, but not in a game. In-game it switches me to the selected team, but does not respawn me, or teleport me to the spawn position. The GUI does not disappear after I selected my team. As said before it works flawlessly on studio.
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
player.TeamColor = BrickColor.new("Really black")
player:LoadCharacter()
script.Parent.Parent.Parent.Enabled = false
end)
Any help would be appreciated, thanks!

3 comments
You should be handling anything that you want to replicate to all the players (anything you want them all to see) in a server script, not local.
I have tried doing this with server scripts, but then it completely did not work in the published game.
i edited my answer