I have players in both teams Red and Blue and i want that when i say "!end" all players be moved back into team white. Those are the colors not the names BTW... Name for team white is actually Trainee.
function End(msg) if msg == "!end" then a = game.Players:GetChildren() for i,v in pairs(a) do if v.TeamColor==BrickColor.new("Really Red") or v.TeamColor==BrickColor.new("ReallyBlue") then v.TeamColor = BrickColor.new("White") end end end end
How do i fix this plz hlep
ReallyBlue and Really Red do not exist, Lua is a case sensitive scripting language. There is a "Really blue" and "Really red" however.
It also does not appear there is a connection line, so you will want to add that.
function End(msg) if msg == "!end" then a = game.Players:GetChildren() for i,v in pairs(a) do if v.TeamColor==BrickColor.new("Really red") or v.TeamColor==BrickColor.new("Really blue") then --Lua IS CASE SENSITIVE! SPELLING MATTERS! v.TeamColor = BrickColor.new("White") end end end end game.Players.PlayerAdded:connect(function(plr) plr.Chatted:connect(End) end) --Connection line, connects to the player, then it connects to whatever the player chats.