Why does cause lua errors ?

why does this happen?

[ERROR] addons/darkrpmodification-master/lua/entities/job_center/cl_init.lua:99: attempt to call method ‘ConCommand’ (a nil value)

  1. DoClick - addons/darkrpmodification-master/lua/entities/job_center/cl_init.lua:99
  2. unknown - lua/vgui/dlabel.lua:218


local Citizen = vgui.Create( "DButton", DScrollPanel )
Citizen:SetText( "" )
Citizen:SetTextColor( Color( 255, 255, 255 ) )
Citizen:SetPos( 0, 75 )
Citizen:SetSize( 350, 70 )
Citizen.Paint = function( self, w, h )
	draw.RoundedBox( 10, 0, 0, w, 70, Color(0,0,0,75))
Citizen.DoClick = function()
	ply:ConCommand( "say /Owner" )


bad coding skills

yeha i was always bad at it

Don’t listen to him. It’s all fine except you didn’t set ply to be anything

[editline]17th September 2016[/editline]

Although you might want to name the panel you’re parenting the button to something other than DScrollPanel just in case it overrides something

local ply = LocalPlayer()

If you are going to do LocalPlayer():ConCommand() i’d recommend you to instead use: