Can anyone tell me why this RemoteEvent script respawn's the player but doesn't team them? I know I could use game.Players.LocalPlayer.TeamColor = game.Teams.TestTeam.TeamColor
or whatever but that doesn't work with FilteringEnabled. Any help appreciated.
Script for when it's fired(In a ServerScript in ServerScriptService):
local Event = game.ReplicatedStorage.ChangeTeam Event.OnServerEvent:connect(function(Player,Team) Player.TeamColor = Team.TeamColor -- wait(0.30) Player:LoadCharacter() end)
Script to fire it(In a LocalScript):
local Event = game.ReplicatedStorage.ChangeTeam script.Parent.MouseButton1Click:connect(function() Event:FireServer(game.Players.LocalPlayer,game.Teams.TestTeam) end)
It's because with RemoteEvents and RemoteFunctions, the Server automatically gather's the client who fired or invoked the object.
All you have to do is remove the first argument you placed in the FireServer function one line three of the LocalScript.
local Event = game.ReplicatedStorage.ChangeTeam script.Parent.MouseButton1Click:connect(function() Event:FireServer(game.Teams.TestTeam) end)