Chat Commands help

I am trying to get it so if I type /ttt or /TTT in my darkrp server it will connect to my TTT server and vice versa. This is my code in main.lua



function TTTServer(pl,text,public)
	if string.StartWith(text,"/ttt") == true or string.StartWith(text, "/TTT") == true then
		if IsValid(pl) then
			pl:ConCommand("connect 74.91.116.24:27015")
		end
	end
end
hook.Add("PlayerSay","switchtoTTT",TTTServer)
AddChatCommand("/ttt", TTTServer)
AddChatCommand("/TTT", TTTServer)


When I type /ttt or /TTT and it doesn’t show up so it registers as a command but it doesn’t work. I get this in console after typing it:



FCVAR_SERVER_CAN_EXECUTE prevented server running command: connect


I dunno why you are doing AddChatCommand() even thought you are checking for the text at the beginning of the function.
[lua] if string.StartWith(text,"/ttt") == true or string.StartWith(text, “/TTT”) == true then[/lua]
Either get rid of that line and the hook or the AddChatCommand line.

Also I believe the error made it quite straight.
The server is preventing the usage of “connect” command.