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

When I put this script into my team change GUI button it doesnt work when I press the button. Help?

local teamname = "(Captain)"
local button = script.Parent

local player = script.Parent.Parent.Parent.Parent.Parent
local gui = script.Parent.Parent.Parent

button.MouseButton1Click:connect(function()
player.TeamColor = BrickColor.new "(Really black)"
player.Character.Huminoid.Health = 0
gui.Enabled = false
gui.ResetOnSpawn = false

end)

Clicking does absolutely nothing.

3 comments

0

Why are you putting the teamcolor in quotation marks?

0

instead of player you can put in (function(player) and remove the local player or do game.Players.LocalPlayer

0

uhhh is your GUI in screen gui and u write local player try local Players that can work

2 answers

✓ Accepted answer

You were putting the quote marks and parentheses in the wrong order for the local teamname and player.TeamColor. Here is the fix.

local teamname = "Captain"
local button = script.Parent

local player = script.Parent.Parent.Parent.Parent.Parent
local gui = script.Parent.Parent.Parent

button.MouseButton1Click:connect(function()
player.TeamColor = BrickColor.new("Really black")
player.Character.Huminoid.Health = 0
gui.Enabled = false
gui.ResetOnSpawn = false

end)

5 comments

0

Not working!

0

should just be player.TeamColor = "Really black"

0

It only changes the team locally, and not server-wide, nobody else can see the team change. How do i fix???

0

if the game is filtering enabled (propert of workspace) you should send a message to the server to change the players team.

0

How would I do that?

You spelled "Humanoid" wrong on line 9 and you were incorrectly giving the Color3 Value that the player should be assigned to.

local button = script.Parent
local gui = script.Parent.Parent.Parent

local player = script.Parent.Parent.Parent.Parent.Parent

local teamname = "Captain"

button.MouseButton1Click:Connect(function()
	player.TeamColor = BrickColor.new("Really black")
	player.Character:FindFirstChild("Humanoid").Health = 0
	gui.Enabled = false
	gui.ResetOnSpawn = false
end)

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