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

Team change gui not changing my team in game?

Asked by 6 years ago

In my Roblox game I made a team change GUI and it works, in the Roblox Studio. When I publish it and play the game the GUI shows up but it wont change my team when I click it.

This is the exact script:

function Click(mouse)
script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Black")
script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
end 

script.Parent.MouseButton1Click:connect(Click) 
0
Is this a LocalScript or script? Rare_tendo 3000 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago
local plr = script.Parent.Parent.Parent.Parent.Parent.Name

script.Parent.MouseButton1Click:connect(function()
game.Players[plr].TeamColor = BrickColor.new("Crimson")
end)

Chanage the Colour and you dont have to have to make it kill players just make the gui Not visible by adding on

script.Parent.Visible = false
0
Wrong. MarceloFBentley 13 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

You need to have the team in the "Teams" folder, and the rest is as easy as this:

Player.TeamColor = game.Teams.ExampleTeam.TeamColor
function Click(mouse)
script.Parent.Parent.Parent.Parent.Parent.TeamColor = game.Teams.TEAMNAME.TeamColor
script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0 -- You don't need to do this, but use it if it is necessary 
end
script.Parent.MouseButton1Click:connect(Click) 

Answer this question