RunConsoleCommand wraps command arguments in quotes before it uses them.
Resulting in
connect "127.0.0.1:27015" instead of
connect 127.0.0.1:27015.
For most console commands, the quotes are fine. But the
connect command will consider the quotes as a part of the IP address. That’s why using
RunConsoleCommand with
connect gives you the "Bad server address" error.

You can use
Player:ConCommand if you don’t want arguments to be wrapped in quotes (example by iViscosity in the post above).
For security reasons, this still won’t work with
connect. Garry’s Mod will prevent the server from calling that command on the client.
The way most scripts bypass this: forcing the client to call
Player:ConCommand instead. In code, that would look like this:
ply:SendLua("LocalPlayer():ConCommand('connect 127.0.0.1:27015')")