Help with derma/vgui?

why does it keep telling me


Cheese.lua:1: attempt to index global 'vgui' (a nil value)


local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 70,80 )
DermaPanel:SetSize( 250, 250 )
DermaPanel:SetTitle( "Console commands" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()
 
local CheckBoxThing = vgui.Create( "DCheckBoxLabel", DermaPanel )
CheckBoxThing:SetPos( 10,50 )
CheckBoxThing:SetText( "God Mode" )
CheckBoxThing:SetConVar( "sbox_godmode" ) -- ConCommand must be a 1 or 0 value
CheckBoxThing:SetValue( 1 )
CheckBoxThing:SizeToContents() 

My code^ just learning at the moment…

You are probably doing that on the server, vgui is only available on the client.

so having it in the shared is just stupid?

Basically, yes.

You can either move it to client, or check for CLIENT in your shared file.

[lua]if CLIENT then
–vgui here
end[/lua]

and what does it mean if it just tells me
“Client\cheeses.lua:1: attempt to index global ‘vgui’ (a nil value)”

[editline]06:10PM[/editline]

never mind it stopped giving me error codes its just not at all working now…

[editline]06:11PM[/editline]

it comes up as a tiny little derma box in the corner with untitled as the title.

[editline]06:14PM[/editline]

immovable i might add…


if CLIENT then
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 50,50 )
DermaPanel:SetSize( 200, 250 )
DermaPanel:SetTitle( "Testing Derma Stuff" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()
 
local CheckBoxThing = vgui.Create( "DCheckBoxLabel", DermaPanel )
CheckBoxThing:SetPos( 10,50 )
CheckBoxThing:SetText( "God Mode" )
CheckBoxThing:SetConVar( "sbox_godmode" ) -- ConCommand must be a 1 or 0 value
CheckBoxThing:SetValue( 1 )
CheckBoxThing:SizeToContents()
 
end

[editline]07:10PM[/editline]

ok dosn’t show up at all any more…

halp?

If it was running before and giving the vgui error and now you have it wrapped in if CLIENT then … end, and it’s not doing anything, what can you tell from this set of circumstances? You can tell that it’s probably not running on the client. Make sure it’s client side and that it’s running, maybe by putting some prints in there.

If you were to read the sticky that clearly states to read it before posting (http://www.facepunch.com/showthread.php?t=868561)

You would of been able to find a tutorial series on Lua Instances and how panels work.

i am actually using a tutorial and trying to figure out why what the wiki says, dosnt work …

iss it possible for an addon to break the derma vgui…?

All the tutorials on Derma on the Wiki are usually not working. Look near the bottom for “Not tested to work” or something.