Changing Server Script

I basically want the user to be able to change server when he presses a certain button on an menu I’ve created but I’m not sure on how to do it.

I found on the garry’s mod wiki, a function called JoinServer() but that doesn’t seem to work for me and I’m not sure why.

Any help?

run console command, connect


[editline]2nd May 2016[/editline]

LocalPlayer():ConCommand(“connect SERVERIP:PORT”)