Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Team Change Admin Commands?

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

1 answer

✓ Accepted answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.