Spawning an npc with vgui

Is there a way to spawn an npc with a vgui button?

There are console commands to spawn NPC’s, so it would probably be possible.

Can you tell me what the console command is please?

Esc -> options -> keyboard -> Advanced -> Enable Developer Console (`)!

And hit Ok, then press ` to open console.

“Console command”
Thanks anyways. I found it though. If anyone wants to know what it is, its
“gmod_spawnnpc npc_name”

[lua] Button1.DoClick = function()
RunConsoleCommand(“gmod_spawnnpc spawnnamehere”


Now figure out the 2 flaws in your code. Ready? GO!

  1. forgot the “)”
  2. … haven’t seen it yet will keep looking it over

[lua]RunConsoleCommand(command, arg1, arg2, arg3)[/lua]

Oh yes I forgot args, I’m not very good with them so I tend to forget.