Prob with derma

This is my first time with lua and i wanted to start out learn derma.

I created this script,

function testframe()
local frame1 = vgui.Create(“DFrame”)


concommand.Add(“testframe”, testframe)

but everytime i run the script i get this error,

autorun/Derma.lua:2: attempt to index global ‘vgui’ (a nil value)

Thanks, Jimmy.

Put the file in autorun/client and it should work, your getting this error because it is trying to run it serverside and vgui is not used serverside.

Well that got rid of that error but its now saying,

Unknown Command: 'suicide".

Its happening on all scripts not just derma.

Is there anything else in your code besides what you posted?

Nope, thats all everything that is in it.

Its saying " Unknown Command: suicide" for this script aswell,

function open()
RunConsoleCommand( “kill” )

concommand.Add( “suicide” , open )

but if i put the above script in autorun it works fine :confused:

Sounds like your scripts arn’t loading, could you describe what your running this on? Dedicated Server, SinglePlayer, ListenServer? And are you putting this in the lua folder or in an addon folder?

try doing

concommand.Add(“suicide”, function(Pl, Cmd, Args)

and see if it still errors.

Oh and yeah like the guy above me said, make sure it’s being run first.

I am running it in singleplayer and the scripts are both located in,

C:\Program Files\Steam\steamapps\chrismelling\garrysmod\garrysmod\lua\autorun\client

Its just strange how the suicide script worked in autorun but not in autorun\client

I recreated your conditions and mine seems to work, your files arn’t loading, make sure your file isn’t example.txt.lua or any other variation.

Edit: Just read that the suicide worked in autorun, leave it there if it does, only put files containing derma elements in autorun/client, sorry for the confusion.

Yea i only just it in client to test if it was the derma script or everything in general.

My files are called Sucide.lua and Derma.lua.

Everything working good?

Nope, still getting the Unknown Command: suicide for both scripts.

Maybe you missed my edit on the above post, you said the suicide.lua script worked in autorun but not autorun/client. Trying putting suicide.lua in autorun and leave derma.lua in autorun/client.

Nope, still getting Unknown Command: ‘testframe’.

Does any of these console messages look wrong?

maxplayers set to 1
Unknown command “sv_rollangle”
Unknown command “sv_unlag_fixstuck”
Lua initialized (Lua 5.1)
autorun/onScreenBB.lua:3: attempt to call global ‘ScrW’ (a nil value)
Registering gamemode ‘sandbox’ derived from ‘base’
ScriptEnforce is disabled
Executing listen server config file
exec: couldn’t exec listenserver.cfg
InitFastCopy: only 51% fast props. Bug?
Lua initialized (Lua 5.1)
AutoAim loaded.
Registering gamemode ‘sandbox’ derived from ‘base’
KeyValues Error: RecursiveLoadFromBuffer: got EOF instead of keyname in file settings/spawnlist/teletubbies_hl2mp.txt
1, (Entries), (4),
Sending 267 ‘User Info’ ConVars to server (cl_spewuserinfoconvars to see)
Redownloading all lightmaps
] testframe
Unknown Command: ‘testframe’

I thought the testframe one was working?

This needs to go into the client folder also becuase ScrW is a client value.
autorun/onScreenBB.lua attempt to call global ‘ScrW’ (a nil value)

Nope testframe has never been working, still getting the Unknown Command: ‘testframe’ message.

Onscreenbb should have nothing to do with it as its the esp i use but i moved it out of autorun just to test and it still errors.


I sent you a friends request so we can get this working faster. The name is Shane.

Derma.lua and suicide.lua are incredibly generic names. Some other addon may have a file with that name in that directory, overriding your version. Rename your version to, say, jimmy_dermatest.lua and jimmy_suicide.lua or something.

This might not be the problem but let’s be sure this isn’t the problem.

The problem was fixed by reinstalling gmod, not a clue what was breaking it as i had no addons installed.

Another easier method, is:

lua_openscript filename.lua - To open files serverside.
lua_openscript_cl filename.lua - To open files clientside.

This allows you to load scripts without reloading the map.