Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 8 years ago

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)




0
Is this in a TextButton MrMinecraft998887 87 — 8y
0
Use a textbutton DevingDev 346 — 8y
0
Yeah. It is. greenyboy4164821 30 — 8y

1 answer

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
8 years ago

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)
Ad

Answer this question