I can't fix this error pls help.

This is my script.

[Lua]
hook.Add( “OnPlayerChat”, “HelloCommand”, function( ply, strText, bTeam, bDead )

strText = string.lower( strText )

if ( strText == "!wanted" ) then

DOAP = vgui.Create( “DFrame” )
DOAP:SetSize( 1000, 500 )
DOAP:SetText( “” )
DOAP:Center()
DOAP:SetTitle("")
DOAP:SetVisible( true )
DOAP:SetDraggable( false )
DOAP:ShowCloseButton( false )
DOAP:MakePopup()
DOAP.Paint = function(s, w, h)
draw.RoundedBox(5, 0, 0, w, h, Color(0,0,0))
draw.RoundedBox(5, 2, 2, w-4, h-4, Color(50, 50, 50))
end

local DOAT2 = vgui.Create( “DLabel” , DOAP )
DOAT2:SetPos( 465, 20 )
DOAT2:SetText( “Dead or Alive” )
DOAT2:SetSize(200, 20)

local DOAB = vgui.Create( “DButton” , DOAP )
DOAB:SetPos( 977, 3)
DOAB:SetText( “X” )
DOAB:SetSize( 20, 20 )
DOAB:SetTextColor( Color(255,255,255))
DOAB.Paint = function(s, w, h)
draw.RoundedBox(3,0,0,w,h,Color(255, 50, 50))
end
DOAB.DoClick = function()
DOAP:Close()
end

local DOAC = vgui.Create( “DComboBox” , DOAP )
DOAC:SetPos( 400, 150 )
DOAC:SetSize( 200, 20 )
DOAC:SetValue( “Player” )
for k, v in pairs( player.GetAll() ) do
DOAC:AddChoice ( tostring( v:Name() ) )
end

local DOAT = vgui.Create( “DLabel” , DOAP )
DOAT:SetPos( 460, 35 )
DOAT:SetText( “Wanted menu” )
DOAT:SetSize(200,200)

local DOAB2 = vgui.Create( “DButton” , DOAP )
DOAB2:SetPos( 390, 180)
DOAB2:SetText( “Wanted” )
DOAB2:SetSize( 100, 20 )
DOAB2:SetTextColor( Color(255,255,255))
DOAB2.Paint = function(s, w, h)
draw.RoundedBox(3,0,0,w,h,Color(255, 50, 50))
end
DOAB2.DoClick = function()

end

local DOAB3 = vgui.Create( “DButton” , DOAP )
DOAB3:SetPos( 510, 180)
DOAB3:SetText( “Unwanted” )
DOAB3:SetTextColor(Color(255,255,255))
DOAB3:SetSize( 100, 20 )
DOAB3:SetTextColor( Color(255,255,255))
DOAB3.Paint = function(s, w, h)
draw.RoundedBox(3,0,0,w,h,Color(50, 180, 50))
end
DOAB3.DoClick = function()

end

DOACH = vgui.Create(“DCheckBox”, DOAP)
DOACH:SetPos(495,250)
DOACH:Toggle()
function DOACH:OnChange( bVal )
if ( bVal ) then
DOACH2:SetValue()
DOACH3:SetValue()
end
end

DOACH2 = vgui.Create(“DCheckBox”, DOAP)
DOACH2:SetPos(145,250)
function DOACH2:OnChange( bVal )
if ( bVal ) then
DOACH:SetValue()
DOACH3:SetValue()
end
end

DOACH3 = vgui.Create(“DCheckBox”, DOAP)
DOACH3:SetPos(845,250)
function DOACH3:OnChange( bVal )
if ( bVal ) then
DOACH2:SetValue()
DOACH:SetValue()
end
end

local DOAT3 = vgui.Create( “DLabel” , DOAP )
DOAT3:SetPos( 140, 230 )
DOAT3:SetText( “Dead” )
DOAT3:SetSize(200, 20)

local DOAT4 = vgui.Create( “DLabel” , DOAP )
DOAT4:SetPos(475, 230)
DOAT4:SetText( “Dead or Alive” )
DOAT4:SetSize(200, 20)

local DOAT5 = vgui.Create( “DLabel” , DOAP )
DOAT5:SetPos( 840, 230 )
DOAT5:SetText( “Alive” )
DOAT5:SetSize(200, 20)

local DOATEXTE = vgui.Create( “DTextEntry”, DOAP )
DOATEXTE:SetPos( 410, 360 )
DOATEXTE:SetSize( 200, 20 )
DOATEXTE:SetText( “” )
DOATEXTE.OnEnter = function( self )
chat.AddText( self:GetValue() )
end

local DOATEXTE2 = vgui.Create( “DTextEntry”, DOAP )
DOATEXTE2:SetPos( 410, 420 )
DOATEXTE2:SetSize( 200, 20 )
DOATEXTE2:SetText( “” )
DOATEXTE2.OnEnter = function( self )
chat.AddText( self:GetValue() )
end

local DOAT6 = vgui.Create( “DLabel” , DOAP )
DOAT6:SetPos( 485, 340 )
DOAT6:SetText( “Price dead” )
DOAT6:SetSize(200, 20)

local DOAT7 = vgui.Create( “DLabel” , DOAP )
DOAT7:SetPos( 485, 400 )
DOAT7:SetText( “Price alive” )
DOAT7:SetSize(200, 20)
return true
end

end )
[/Lua]

And I always get this error message:

[Lua]
[ERROR] lua/autorun/panel.lua:3: attempt to index global ‘vgui’ (a nil value)

  1. v - lua/autorun/panel.lua:3
  2. unknown - lua/includes/modules/hook.lua:84
    [/Lua]

Please help I don’t want this addon to have errors. Thanks.

Try moving it to lua/autorun/client

Worked lol, thanks.