Problem with RemoteEvent

**What happened
Hello everyone! So today I got a weird error so I thought it might be my mistake, i tried changing the team of a player from client to server with certain circumstances but couldn’t, so I’m asking you if you might know the reason or the solution to this. To understand my situation more please look at the scripts:

LocalScript

--//Variables
local frame = script.Parent
local player = game.Players.LocalPlayer
local remoteEvent = game.ReplicatedStorage.RemoteEvents.ChangeTeam
local button1 = frame.Army.TextButton
local ID = --Code of the group
button1.MouseButton1Click:Connect(function()
  if player:IsInGroup(ID) then
    remoteEvent:FireServer(player, "Forest green") --forest green is the color of the team which I have a spawn and actual team for
  end
end)

GlobalScript

local remoteEvent = game.ReplicatedStorage.RemoteEvents.ChangeTeam

remoteEvent.OnServerEvent:Connect(function(player, color)
  player.TeamColor = BrickColor.new(color)
  player:LoadCharacter()
end)

The error was “Color3 expected”, can anyone help?

I dont think thats right try this:

local remoteEvent = game.ReplicatedStorage.RemoteEvents.ChangeTeam

remoteEvent.OnServerEvent:Connect(function(player, color)
player.Team = game.Teams. --Put the team name here
player:LoadCharacter()
end)

EDIT:I dont think thats what u meant oops sorry

@NicoXerocious

remoteEvent:FireServer("Forest green")

you dont need to include the player object when firing the server
(only when firing clients)

but honestly just fire the server without sending anything, and just make the server check to see what group theyre in, otherwise this wont work as good as you think. (basically never trust the client)

on another note you might want to wait for your assets to load on the client before using them in local scripts. (by using WaitForChild)

--//Variables
local frame = script.Parent
local player = game.Players.LocalPlayer
local remoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvents"):WaitForChild("ChangeTeam")
local button1 = frame:WaitForChild("Army"):WaitForChild("TextButton")

button1.MouseButton1Click:Connect(function()
    remoteEvent:FireServer() 
end)
local remoteEvent = game.ReplicatedStorage.RemoteEvents.ChangeTeam
local ID = 1

remoteEvent.OnServerEvent:Connect(function(player)
    if player:IsInGroup(ID) then
        player.TeamColor = BrickColor.new("Forest green")
        player:LoadCharacter()
    end
end)

Here, you I believe you don’t need to use BrickColor.new(), but instead do this:

player.TeamColor = color

EDIT: If that doesn’t work, try this:

player.TeamColor = game.Teams[color].TeamColor

Im pretty sure that Forest green is a BrickColour
and there is no variable that is sent as a parameter in the local script

now you make a variable
player is automatically sent as a varibale
local script

button1.MouseButton1Click:Connect(function()
  if player:IsInGroup(ID) then
local colour = BrickColor.new("Forest Green")
    remoteEvent:FireServer(color) --forest green is the color of the team which I have a spawn and actual team for
  end
end)

–global script

local remoteEvent = game.ReplicatedStorage.RemoteEvents.ChangeTeam

remoteEvent.OnServerEvent:Connect(function(player, color)
  player.TeamColor = color
  player:LoadCharacter()
end)

ok so, its asking for a Color3 variable so you would want to do
– local script
button1.MouseButton1Click:Connect(function()
if player:IsInGroup(ID) then
local colour = “31, 128, 29” – equals forest green
remoteEvent:FireServer(color) – exclude the player because player is already a tuple.
end
end)

– server script

local remoteEvent = game.ReplicatedStorage.RemoteEvents.ChangeTeam

remoteEvent.OnServerEvent:Connect(function(player, color)
player.TeamColor = Color3.fromRGB(color)
player:LoadCharacter()
end)

– I havent tested this yet, so please tell me if it works or not.

@NicoXerocious

https://developer.roblox.com/en-us/api-reference/property/Team/TeamColor

brick color should be fine.

In the api, the brickcolor for teamcolors is read-only i believe, but can be set to color only.

you can do this

player.TeamColor = team.TeamColor

so theyre the same type and brick color should be fine for player.TeamColor