Entities and Self

So I’m modifying a radio that was posted on the workshop to open a derma menu and the buttons in the menu are supposed to control the radios functions…




-- Code from radio's init file

net.Receive("radioon",function()
    local Mus = MUSIC[ math.random( 1, #MUSIC ) ]
        self.Sound = CreateSound(self.Entity, Mus.Snd )
        self.Sound:Play()
        self.On = true;
        self.Play = true;
        self.Duration = CurTime() + PAUSE + Mus.Dur
        self.Musicon = CurTime() + Mus.Dur
        self.Debug = 0
end)


net.Receive("radiooff",function() 
        self.Sound:Stop()
        self.On = false;
end)





-- Code from the cl_init file. Not as important but still a good help

turnonbutt.DoClick = function()
        net.Start("radioon")
        net.SendToServer()
end

turnoffbutt.DoClick = function()
    net.Start("radiooff")
    net.SendToServer()
end







-- the errors

[ERROR] addons/uwrpradio/lua/entities/uwrpradio/init.lua:105: attempt to index global 'self' (a nil value)
  1. func - addons/uwrpradio/lua/entities/uwrpradio/init.lua:105
   2. unknown - lua/includes/extensions/net.lua:32




[ERROR] addons/uwrpradio/lua/entities/uwrpradio/init.lua:105: attempt to index global 'self' (a nil value)
  1. func - addons/uwrpradio/lua/entities/uwrpradio/init.lua:105
   2. unknown - lua/includes/extensions/net.lua:32



Is there another way for me to run the off and on functions? Maybe in the ENT.Use? It needs to be done with the buttons in the derma tho…

EDIT:

I’m just retarded.