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

My team change gui doesn't work when I click?

I tried making a script where if you click a GUI button it changes your team, but it doesn't do anything. Here is the script.

function Click(mouse)  
script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("New Yeller") 
end 

script.Parent.MouseButton1Click:connect(Click) 

2 answers

Hey in the future, please specify what the hell those 5 .Parent's lead to. Thanks, anyway don't bother doing it on the client. You should fire a remote instead.

The script under the gui button:

script.Parent.MouseButton1Down:Connect(function()
   game.ReplicatedStorage:WaitForChild("TeamEvent", 3):FireServer()
end)

And make a script in serverscriptservice, here would be the content of that script:

local desiredteam = whateverthehellyouwant
-- an example for the above could be like game.Teams.Yellow
local r = Instance.new("RemoteEvent")
r.Parent = game.ReplicatedStorage
r.OnServerEvent:Connect(function(p)
   p.Team = desiredteam
end)

instead of function click(mouse), try this.

	(name of button).Mouse1Click:Connect(function()
	script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("New Yeller")
	end
	 
	script.Parent.MouseButton1Click:connect(function()

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