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

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

Asked by 5 years ago

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)

0
1. Make sure it's a local script DeceptiveCaster 3761 — 5y
0
Thanks, that works Dullbuilderman26 11 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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)
Ad

Answer this question