So my friend and I are making a game where we throw cookies at each other and I needed to make a team change script so I followed a tutorial and it kind of works when I click red or blue it just sets my team to neutral. Thanks!
Script in server script service:
game.ReplicatedStorage["Change Team"].OnServerEvent:Connect(function(player,teamColor) player.TeamColor = teamColor player:LoadCharacter() end)
local script in my gui:
local RemoteEvent = game.ReplicatedStorage["Change Team"] local menuButton = script.Parent:WaitForChild("TextButton") local frame = script.Parent:WaitForChild("Frame") local BlueColor = "Really Blue" local RedColor = "Really Red" frame.blue.MouseButton1Click:Connect(function() RemoteEvent:FireServer(BrickColor.new(BlueColor)) end) frame.red.MouseButton1Click:Connect(function() RemoteEvent:FireServer(BrickColor.new(RedColor)) end) menuButton.MouseButton1Click:Connect(function() frame.Visible = not frame.Visible end)
The second word of the BrickColor names should not have a capital letter.
Please reference this article on how BrickColor names are capitalized.