• closebutton makes script errors
    2 replies, posted
local closebutton = vgui.Create( "DButton", self ) closebutton:SetText( "X" ) closebutton:SetSize( 25, 25) closebutton:SetPos( self:GetSize() - 81, 6 ) closebutton.Paint = function( self, w, h ) surface.SetDrawColor(0,0,0,0) surface.DrawRect( 0,0, w, h ) surface.DrawOutlinedRect( 2, 2, w-4, h-4) end closebutton.DoClick = function(self) self:SetEnabled(false) panel:AlphaTo(0,0.2,0,function() panel:Remove() end) end here is the error [ERROR] addons/gay/lua/darkrp_modules/loadout/cl_stash.lua:28: attempt to index global 'self' (a nil value)   1. unknown - addons/gay/lua/darkrp_modules/loadout/cl_stash.lua:28    2. doInclude - [C]:-1     3. loadModules - gamemodes/starwarsrp/gamemode/libraries/modificationloader.lua:102      4. Call - gamemodes/starwarsrp/gamemode/libraries/modificationloader.lua:147       5. unknown - gamemodes/starwarsrp/gamemode/cl_init.lua:53 the hell happend?
'self' isn't defined when you set it's position. You should put this in PANEL:Init.
Yep, no errors, but it doesnt show up
Sorry, you need to Log In to post a reply to this thread.