Killicon issue

I created killicons for my swep added file autorun/killicons.lua wih text


killicon.Add( "weapon_hb", "VGUI/kills/kill_hb", Color( 255, 80, 0, 255 ) )
killicon.Add( "weapon_hbhs", "VGUI/kills/kill_hbhs", Color( 255, 80, 0, 255 ) )
killicon.Add( "weapon_hbrs", "VGUI/kills/kill_hbrs", Color( 255, 80, 0, 255 ) )

Killicons work, but i have such error


[ERROR] addons/aac honey badger pdw/lua/autorun/killicons.lua:1: attempt to index global 'killicon' (a nil value)
  1. unknown - addons/aac honey badger pdw/lua/autorun/killicons.lua:1

How to solve it?

You’re getting errors because your killicons.lua file is being run both clientside and serverside, but the killicon library only exists clientside. You can fix that either by moving your file into autorun/client or by enclosing your code between an “if CLIENT then … end” block.