Help with Ammo Box

Hello i have made a Simple Entity wich Opens a Menu when Pressing e on it. Now i have Created to Sliders Wich the Player can Slide to choose the Amount of Ammo they want ammokiste

I have also created a Save Button wich the Player have to Press to get the Ammo ammokiste2

My Problem is that won’t work to give the Ammo to the Player Here is The Code for the Slider =

Blockquote local MainMuniPanel = vgui.Create( “DFrame”, frame ) – Create a panel to parent it to
MainMuniPanel:SetTitle("")
MainMuniPanel:SetSize( frame:GetWide() / 4, frame:GetTall() / 12 ) – Set the size
MainMuniPanel:SetPos( frame:GetWide() / 16, frame:GetTall() / 2) – Center it
MainMuniPanel:MakePopup() – Make it a popup
MainMuniPanel:ShowCloseButton(false)
MainMuniPanel:SetDraggable(false)
MainMuniPanel.Paint = function()
draw.RoundedBox(0, 0, 0, frame:GetWide() / 4, frame:GetTall() / 12, Color(50,50,50,200))
end

	local SecMuniPanel = vgui.Create( "DFrame", frame )	-- Create a panel to parent it to
	SecMuniPanel:SetTitle("")
	SecMuniPanel:SetSize( frame:GetWide() / 4, frame:GetTall() / 12 )	-- Set the size
	SecMuniPanel:SetPos( frame:GetWide() / 16, frame:GetTall() / 3.5)			-- Center it
	SecMuniPanel:MakePopup()			-- Make it a popup
	SecMuniPanel:ShowCloseButton(false)
	SecMuniPanel:SetDraggable(false)
	SecMuniPanel.Paint = function()
		draw.RoundedBox(0, 0, 0, frame:GetWide() / 4, frame:GetTall() / 12, Color(50,50,50,200))
	end

	local MainMuni = vgui.Create( "DNumSlider", MainMuniPanel )
	MainMuni:SetPos( MainMuniPanel:GetWide() / 5.5, MainMuniPanel:GetTall() / 36 )				-- Set the position
	MainMuni:SetSize( 300, 100 )			-- Set the size
	MainMuni:SetText( "Gewehr Munition" )	-- Set the text above the slider
	MainMuni:SetMin( 0 )				 	-- Set the minimum number you can slide to
	MainMuni:SetMax( 2000 )				-- Set the maximum number you can slide to
	MainMuni:SetDecimals( 0 )				-- Decimal places - zero for whole number
	MainMuni:SetValue( LocalPlayer():GetAmmoCount( "AR2" ) )

	local RakMuni = vgui.Create( "DNumSlider", SecMuniPanel )
	RakMuni:SetPos( SecMuniPanel:GetWide() / 5.5, SecMuniPanel:GetTall() / 36 )				-- Set the position
	RakMuni:SetSize( 300, 100 )			-- Set the size
	RakMuni:SetText( "Explosions Munition" )	-- Set the text above the slider
	RakMuni:SetMin( 0 )				 	-- Set the minimum number you can slide to
	RakMuni:SetMax( 20 )				-- Set the maximum number you can slide to
	RakMuni:SetDecimals( 0 )				-- Decimal places - zero for whole number
	RakMuni:SetValue( LocalPlayer():GetAmmoCount( "RPG_Round" ) )

And here is The Code for the Save Button =

Blockquote local saveb = vgui.Create(“DButton”, frame)
saveb:SetSize(450, 100)
saveb:SetPos(frame:GetWide() / 2.5, frame:GetTall() / 1.5)
saveb:SetText("")
saveb.Paint = function()
draw.RoundedBox(8, 0, 0, 450, 100, Color(50,200,50,255))

		draw.SimpleText("Speichern", "Muni15", 160, 30, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
	end
	saveb.DoClick = function()

		surface.PlaySound("notify/notify.mp3")

		local muninotify = vgui.Create("DFrame")
	    muninotify:SetSize(ScrW() / 5.5, ScrH() / 5.5)
	    muninotify:SetPos(ScrW() / 1.25, ScrH() / 1.25)
	    muninotify:ShowCloseButton(false)
	    muninotify:SetDraggable(false)
	    muninotify:SetTitle("")
	    muninotify.Paint = function()
	    	draw.RoundedBox(0, 0, 0, muninotify:GetWide(), muninotify:GetTall(), Color(35,35,35,240))
	    	draw.RoundedBox(0, 0, 45, muninotify:GetWide(), muninotify:GetTall() / 64, Color(255,255,255,255))
	    	draw.DrawText("Munition Aufgefüllt", "Muni15", 35, 5, Color( 70, 133, 242, 255 ), TEXT_ALIGN_LEFT)
	    	draw.DrawText("Du hast deine Munition aufgefüllt", "Muni10", 25, 100, Color( 255,255,255,255 ), TEXT_ALIGN_LEFT)
	    end

		timer.Simple(3, function()
			muninotify:Close()
        end)

        LocalPlayer():SetAmmo(MainMuni:GetValue(), "AR2")
        LocalPlayer():SetAmmo(RakMuni:GetValue(), "RPG_Round")

		frame:Close()
		surface.PlaySound("ui/button.mp3")
	end

You have to set the ammo serverside too.

Blockquote

AddCSLuaFile( "cl_init.lua" ) -- Make sure clientside
AddCSLuaFile( "shared.lua" )  -- and shared scripts are sent.

include('shared.lua')

function ENT:Initialize()

self:SetModel( "models/lordtrilobite/starwars/props/hyperfuelbarrel02.mdl" )
self:PhysicsInit( SOLID_VPHYSICS )      -- Make us work with physics,
self:SetMoveType( MOVETYPE_VPHYSICS )   -- after all, gmod is a physics
self:SetSolid( SOLID_VPHYSICS )         -- Toolbox
self:SetUseType(SIMPLE_USE)

    local phys = self:GetPhysicsObject()
if (phys:IsValid()) then
	phys:Wake()
end
end

util.AddNetworkString("munitionmenu")
function ENT:Use( activator, caller )

net.Start("munitionmenu")
net.Send(caller)

end

function ENT:Think()

end

Ok and where? (My init/Server File)

Use Player:GiveAmmo - Garry's Mod Wiki .
you can get the entity from the use function and have a global variable for the ammo or just hard code it

function ENT:Use(activator,caller)
activator:GiveAmmo(5,"smg1")
activator:GiveAmmo(5,"buckshot")
activator:GiveAmmo(5,"pistol")
end