local function w(w)if Enabled and(w and w.Parent)then local f=false local Q=game.Players:GetPlayerFromCharacter(w.Parent)if Q then for w,I in pairs(GunToRefillAmmo)do local n=Q.Backpack:FindFirstChild(I)or Q.Character:FindFirstChild(I)if n then local w=n:FindFirstChild("\071\117\110\083\099\114\105\112\116\095\083\101\114\118\101\114")local I=n:FindFirstChild("\083\101\116\116\105\110\103")if w and I then local n=require(I)if w.Ammo.Value<n.MaxAmmo and n.LimitedAmmoEnabled then Enabled=false f=true local I=(Ammo==math.huge or w.Ammo.Value+Ammo>=n.Ammo)and n.Ammo or w.Ammo.Value+Ammo w.Ammo.Value=I w.ChangeMagAndAmmo:FireClient(Q,n.AmmoPerMag,I)end end end end end if f then AmmoBox:Destroy()end end end AmmoBox.Touched:connect(w)
--==================================================

local function Enablerx2(Hit)
	if Enabled and Hit and Hit.Parent then
		local AmmoRefilled = false
		local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
		if Player then
			for _, GunName in pairs(GunToRefillAmmo) do
				local Gun = Player.Backpack:FindFirstChild(GunName) or Player.Character:FindFirstChild(GunName)
				if Gun then
					local GunScript = Gun:FindFirstChild("GunScript_Server")
					local Module = Gun:FindFirstChild("Setting")
					if GunScript and Module then
						local Module = require(Module)
						if GunScript.Ammo.Value < Module.MaxAmmo and Module.LimitedAmmoEnabled then
							Enabled = false
							AmmoRefilled = true
							local ChangedAmmo = (Ammo == math.huge or GunScript.Ammo.Value + Ammo >= Module.Ammo)
									and Module.Ammo
								or (GunScript.Ammo.Value + Ammo)
							GunScript.Ammo.Value = ChangedAmmo
							GunScript.ChangeMagAndAmmo:FireClient(Player, Module.AmmoPerMag, ChangedAmmo)
						end
					end
				end
			end
		end
		if AmmoRefilled then
			AmmoBox:Destroy()
		end
	end
end
AmmoBox.Touched:connect(Enablerx2)
