Team change command not working

Yeah, unfortunately you need to type the entire msg:sub(13):lower() even after the or keywords so it should really look like this:

game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(msg)
		warn("1")
		if msg:sub(prefix:len()+1,command:len()+prefix:len()):lower() == command then
			warn("2")
			if msg:sub(13):lower() == "st" or msg:sub(13):lower() == "sewer" or msg:sub(13):lower() == "sewerteam" then
				warn("3")
				if Player.TeamColor == Teams.ST then
					warn("4")
					NotificationEvent:FireClient(Player,ErrorMessage)
				elseif Player.TeamColor ~= Teams.ST then
					warn("4.5")
					Player.TeamColor = Teams.ST
				end
			elseif msg:sub(13):lower() == "c" or msg:sub(13):lower() == "civilian" or msg:sub(13):lower() == "civilianteam" then
				warn("5")
				if Player.TeamColor == Teams.C then
					warn("6")
					NotificationEvent:FireClient(Player,ErrorMessage)
				elseif Player.TeamColor ~= Teams.C then
					warn("6.5")
					Player.TeamColor = Teams.C
				end
			end
		end
	end)
end)
1 Like

Yes this actually was the problem, thanks.

Haha, no problem. Sorry it took that long to get your solution.

It’s okay though, i’m used to it from scripting my discord bot with late replies

1 Like