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
local r = Instance.new("RemoteEvent")
r.Parent = game.ReplicatedStorage
r.OnServerEvent:Connect(function(p)
p.Team = desiredteam
end)