• Why doesn't this hide the vgui element
    2 replies, posted
For some reason It doesn't hide the element on the var changing Hid1 = 0; function DrawScrollMenu(Enable) if (Enable == 0) then  hook.Add( "DrawOverlay", "Scroll", function() wrapper = vgui.Create("DPanel") wrapper:SetSize(150,250) wrapper:SetPos((ScrW() / 100),(ScrH() / 9.5)) wrapper:SetBackgroundColor(Color(98, 116, 166, 139)) if Hid1 == 1 then  wrapper:SetVisible(true); else wrapper:SetVisible(false); end end ); end end
You're calling Panel:SetVisible with false. Also you're making a DPanel every frame, you only have to make it once.
Thanks It wan't working cause I was mass creating it hook.Add( "DrawOverlay", "Scroll", function() if (wrapper == nil) then wrapper = vgui.Create("DPanel") wrapper:SetSize(150,250) wrapper:SetPos((ScrW() / 100),(ScrH() / 9.5)) wrapper:SetBackgroundColor(Color(98, 116, 166, 139)) end if Hid1 == 1 then  wrapper:SetVisible(true); else wrapper:SetVisible(false); end end );
Sorry, you need to Log In to post a reply to this thread.