I am working on a game where I have a team change GUI, but for some reason I can't click on it. I put the script in a Script, not a LocalScript. I want it so I can click on the button, and then it changes my team, then resets me so I can go to my teams spawnpoint.
local Player = script.Parent.Parent.Parent function onClick() Player.TeamColor = BrickColor.new("Bright Blue") Player.Character.Humanoid.Health = 0 script.Parent.Parent.Parent:Destroy() end script.Parent.MouseButton1Click:connect(onClick)
Try using a LocalScript
. It's much more convenient when working with any UI's.
local Player = game.Players.LocalPlayer --You can define the player like this! function onClick() Player.TeamColor = BrickColor.new("Bright blue") --Lowercase 'blue' Player.Character:BreakJoints() --You can kill the player like this end script.Parent.MouseButton1Click:connect(onClick)