So I made a GUI for changing teams. I have the script to change to the "Electric blue" team and the "Deep orange" team. It shows that it switches you, but in the game it's only you that have switched teams even though others have probably. Also, your chat is deep orange, since when you spawn in your team is automatically deep orange.
The script is in StarterGui.ScreenGui.Frame.Textbutton.Localscript
Script to switch to the Electric blue:
local player = game.Players.LocalPlayer repeat wait() until player.Character Character = player.Character Character:WaitForChild("Humanoid") script.Parent.MouseButton1Click:connect(function() player.TeamColor = BrickColor.new("Electric blue") game.Players.LocalPlayer.Character:MoveTo(Vector3.new(-103.8, 94.62, -159)) end)
The script for Deep orange is the same, just replace line 7 with player.TeamColor = BrickColor.new("Electric blue") with "Deep Orange"
I have a feeling it has something to do with WaitForChild, but I wasn't too sure, so I added the code in lines 2-4
EDIT: I have filtering enabled on, but it's still not switching the player's team's. Here's my local script:
local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() --Put the script into the textButton you want to click game.ReplicatedStorage.RemoteEvent:FireServer() end)
and here's my script that receives the remoteevent but it doesn't switch the teams still.
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player) player.TeamColor = BrickColor.new("Electric blue") --Change the name to the team you want. game.Workspace[player.Name].Torso:Destroy() --You can change it so that the player doesn't die to whatever you like. end)
What I use is a lot different but it still works.
local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() --Put the script into the textButton you want to click player.TeamColor = BrickColor.new('Electric blue') --Change the name to the team you want. game.Workspace[player.Name].Torso:Destroy() --You can change it so that the player doesn't die to whatever you like. end)
I hope this helps!