Is derma broken!?!?

This is REALLY starting to piss me off, every time i try to run a Derma script (a VERY simple derma script, even this one from a TUTORIAL won’t work)

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

    frame1:SetPos(100,100)
    frame1:SetSize(200,200)
    frame1:SetTitle("Test")
    frame1:MakePopup()

end
concommand.Add(“testframe”, testframe)

It get REALLY annoying, does anyone have any suggestions?

i already restarted gmod, notepad++, and my computer and it still gives me the same error.

Well where did you save the file?

What is the error you are getting?

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

i tried saving it in both the lua folder, and the lua\autorun folder (i know what autorun does, i made the script run on a console command)

Put it in lua/autorun/client and make sure that if you are testing it on a dedicated server, it’s sent to the client with this in a file in lua/autorun/server:
[lua]AddCSLuaFile( “autorun/client/yourscript.lua” )[/lua]

There you go, it needs to be in autorun/client. Because you just put it in autorun it tried to run on client and server when you put the command in, and the vgui library doesn’t exist on the server.

Please, next time just give us all the common sense information like your code, your error, anything else that’s relevant you can tell us. This is a common problem.

so what if i don’t want it to autorun?

do i just make a client folder and put it in there?

Then you use lua_openscript_cl on it.

now, i’m not just a noob, i’m an idiot.

[editline]07:10PM[/editline]

ok, but now do the console command doesn’t work, do i have to create a separate server-side script just for the console command?

No, you can create console commands clientside perfectly fine. Are you trying this on a dedicated server or a listen server?

singleplayer.