How do I change a players team and reset them when they click a GUI button?
I'm trying to make it where the player returns to the "lobby". Meaning they need to change team to "lobby" and then reset so they spawn back. I've tried multiple times but they never work.
Here is the code I'm currently using for the button:
1 | local plr = game.Players.LocalPlayer |
3 | script.Parent.MouseButton 1 Click:Connect( function () |
5 | plr.TeamColor = "Dark stone grey" |
(I have a feeling that I'm not defining/calling the player correctly)
Here's the code I tried using a method from this site:
01 | local plr = game.Players.LocalPlayer.Name |
02 | repeat wait() until plr.Character |
03 | local chr = plr.Character |
04 | local hum = chr:WaitForChild( "Humanoid" ) |
07 | script.Parent.MouseButton 1 Click:Connect( function () |
09 | plr.TeamColor = "Dark stone grey" |