So, I am not sure if I am doing it wrong, or it is broken or whatever, but I am trying to create a DMenu.
I am making a simple entity, which upon pressing USE on, will open a menu with weapons, weapon models, info etc. So far everything worked as I expected, weapons get added, clicking on them shows the info, double clicking gives you the weapon. For every weapon icon, I added a Menu, which upon right clicking the Icon should open the menu. But instead, it gives me the error: attempt to call method ‘Open’ (a nil value) . I tried different functions, like IconMenu:SetVisible(), which provided me with another error: Tried to use invalid object (type Panel) (Object was NULL or not of the right type). So, if anyone knows what can be the problem, please let me know. I honestly dont know what can be wrong.
This is how the menu looks so far (just basic stuff):
This is the code for the icon and menu part
local icon = vgui.Create( “DModelPanel”, BG )
icon:SetSize( BG:GetSize(), BG:GetSize())
local IconMenu = vgui.Create( "DMenu", BG ) IconMenu:AddOption("Test Option") icon.DoRightClick = function() IconMenu:Open() end