What's Wrong With My Team Change Script?

Hello. For a gamemode I’m working on, I’m making a code that I NEED to get working by the end of development for the gamemode. It’s a script that supposedly, upon the player typing into the chat “!rebels” or “!combine”, it changes their team. Just so you know, nothing is wrong with my code for the teams themselves, they work fine and changing to the team via the console commands I created(called set_team and set_team2) also works. However, it’s just this code that doesn’t work, here it is:

function ISaid( ply, text, public )
    if text == "!combine" then 
                RunConsoleCommand( "set_team", "1" )
                return false
	if text == "!rebels" then
                 RunConsoleCommand( "set_team2", "1" )	
	hook.Add( "PlayerSay", "ISaid", ISaid )

Note: I put this code in shared.lua.

PlayerSay doesn’t return a boolean, and you also probably want to use OnPlayerChat client-side instead. Just make sure the player saying it is LocalPlayer.

PlayerSay is server side, and you are trying to run client side code (RunConsoleCommand).

Either replace RunConsoleCommand with ply:ConCommand, and remove the arguments, or make the hook OnPlayerChat and make sure the script is client side.

hook.Add( "PlayerSay", "ChangeChatTeam", function( ply, text )

	if ( string.sub( text, 1, 7 ) == "!rebels" ) then
		ply:SetTeam( 1 )   
        elseif ( string.sub( text, 1, 8 ) == "!combine" ) then
               ply:SetTeam( 2 )
end )

Edit: Dam, I’m late to the party