I wrote this script inside a text button which is inside a GUI, but it does not work. It is supposed to change their team when they click it, then respawn them so they spawn on that team.
local plr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
plr.TeamColor = BrickColor.new("Rust")
wait(1)
plr.Character.Humanoid.Health = 0
end)

1 comment
the script wont work if its a localscript