Error when trying to execute console command

Hey, I am creating a script but came upon an error. Whenever a piece of code is trying to run a console command it gives me this error:

attempt to call field 'ConsoleCommand' (a nil value)

the line of code where this is executed is:

game.ConsoleCommand( "ulx adduser '""' superadmin
" )

Try this instead.

RunConsoleCommand( "ulx", "adduser",, "superadmin")

Should it not be RunConsoleCommand instead of game.ConsoleCommand?

But then that would run the console command as the player not the server. I would like it so it runs the console command in the server console.

It will run in the server console if it’s ran serverside.

I don’t see any reason why your original code did not work. You may have an addon overriding the game.ConsoleCommand function

Not really, he’s just running it on the client.
As can be inferred from this reply

You can’t run a command on the client from the server, that would let anyone crash any server they join :v:

Is this “script” supposed to be malicious or something? I can’t see why you’d want to grant someone superadmin through Lua

Oh, I understand what he’s trying to do now. You would have to network it to the server and then run it as a console command from there. What are you actually trying to do? Assuming it isn’t malicious, there is probably a better way of doing it.

Im trying to make an addon that links up the IPS Store page with Gmod. Since i use IPS for my server website. Thanks anyway :slight_smile:

Excuse my ignorance, but what is IPS? Doing a Google search reveals nothing of relevance… unless you are part of the Indian Police Service…