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

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

Asked by 7 years ago
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.

0
Why are you putting the teamcolor in quotation marks? CondescendingReality 7 — 7y
0
instead of player you can put in (function(player) and remove the local player or do game.Players.LocalPlayer Lolamtic 63 — 7y
0
uhhh is your GUI in screen gui and u write local player try local Players that can work IcyMizu 122 — 7y

2 answers

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

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)

0
Not working! Hellst0rm -3 — 7y
0
should just be player.TeamColor = "Really black" abnotaddable 920 — 7y
0
It only changes the team locally, and not server-wide, nobody else can see the team change. How do i fix??? Hellst0rm -3 — 7y
0
if the game is filtering enabled (propert of workspace) you should send a message to the server to change the players team. abnotaddable 920 — 7y
0
How would I do that? Hellst0rm -3 — 7y
Ad
Log in to vote
0
Answered by
R_alatch 394 Moderation Voter
7 years ago

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)

Answer this question