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

Team-Change gui Script not working upon click, any help?

Thanks for any assistance

function onButtonClicked()
script.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Deep blue") 
script.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
end



script.Parent.MouseButton1Click:connect(onButtonClicked)

2 comments

0
  1. Make sure it's a local script
0

Thanks, that works

1 answer

inside a localscript(put in gui same place as current script):

local Event = game:GetService("ReplicatedStorage"):WaitForChild("ChangeTeamRemote")
function onButtonClicked()
Event:FireServer(BrickColor.new("Deep blue"))
end

script.Parent.MouseButton1Click:connect(onButtonClicked)

inside a script(put in serverscriptservice):

local Event = Instance.new("RemoteEvent")
Event.Parent = game:GetService("ReplicatedStorage")
Event.Name = "ChangeTeamRemote"
function EventFired(player,team)
	player.TeamColor = team
end
Event.OnServerEvent:Connect(EventFired)

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