Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why doesn't my team changing button work? I can't click on it.

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)




3 comments

0

Is this in a TextButton

0

Use a textbutton

0

Yeah. It is.

1 answer

✓ Accepted answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.