Redirect clients

If a client join the server I want them to have a choice of server to join, I tried RunConsoleCommand(“connect”,“serverip”) but it always says something like bad host name event tought if I type it in console myself it connect fine, Any idea?

It would be RunConsoleCommand(“connect”, serverip) where serverip is a variable with your servers IP. Don’t put it in quotes, because quotes make it a string that’s saying that the IP is “serverip”. You want it to point to the variable that is serverip.

You misunderstand. In his example he removed the IP. His problem is that the RunConsoleCommand builds commands using quotes around each argument, whereas the connect function reads the quotes as part of the argument. Although possibly soon deprecated, he should use LocalPlayer():ConCommand( “connect [serverip]” ).

Ah, sorry, misunderstood what he was saying. Yeah, honestly I still prefer ConsoleCommand() to RunConsoleCommand(). I know it’ll be deprecated soon though. What makes RunConsoleCommand better?

Honestly have no idea. It’s a shame JoinServer is in the menu state, this is a perfect place to use it.

I helped him out with this over skype and told him to do exactly that. You have to network it clientside because connect is a blacklisted command for servers to run on clients (but you can still network and run it there, so that was useful). He said it worked fine.