3d2d button functionality

Need some help with making the actual button do something, im trying to make it give you x ammo but doesn’t work, no errors but the button doesnt do anything.


self.p = self.p or tdui.Create()
    
    local p = self.p
    local ply = LocalPlayer()
    -- Draw a button (text, font, x, y, w, h, [color])
    if p:Button("$500", "AmmoM", 65,9, 50, 50) then

    if SERVER then
       ply:GiveAmmo(60,"m9k_ammo_smg",true)
    end
          
    end
    p:Cursor()
    p:Render(posss + offset3, angss, 0.15)

oops wrong section:c