Might as well try my luck here. Posted in questions but no answer yet. Only been two days but I'm kind of impatient
Icon.OnCursorExited and Entered both work fine. So does Icon.Paint.
for KeyIcon, Model in pairs (ModelList) do
local Icon = vgui.Create( "Spawnicon" )
Icon:SetModel( Model )
Icon:SetToolTip ("Spawn this!")
Icon.DoClick = function()
RunConsoleCommand( "gm_spawn", Model )
Icon.OnCursorEntered = function()
Hover[Icon] = true
Icon.OnCursorExited = function()
Hover[Icon] = false
Icon.Paint = function()
if Hover[Icon] == true then
draw.RoundedBox( 8, 0, 0, 64, 64, Color( 100, 0, 0, 200 ) )
draw.RoundedBox( 8, 0, 0, 64, 64, Color( 0, 0, 0, 200 ) )
DermaList:AddItem( Icon )
What doesn't work however is DoClick. Nothing happens when I press the icons (no errors either), Yet they get colored red when hovered perfectly fine and if I change the tooltip to "model" it'll display the appropriate model path.
DoClick simply Isn't working. If I were to create all the icons individually instead of a loop it'd work which doesn't make sense to me.
What am I missing here?