I'm making a team change GUI, but the problem is when you change your team, in the game, you don't respawn you just stay where you are and change teams, until you die. So I made it so that when you change your team, you die, but I can't figure out how to generalize a player. Here's the script:
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
player.TeamColor = BrickColor.new("Bright red")
game.Workspace.player.Name.Humanoid.Health = 0
player:LoadCharacter()
end)
but, that player.Name won't work can you please help?
Thank you!

3 comments
Also, as a side note, since you already killed the player you don't really need "Player:LoadCharacter()" however you may have your own reasons so I decided to leave that line in for you.
thanks so much, I didn't know about that, and that will be really helpful!
Don't forget to accept the answer if it works, thanks and good luck! :-)