```lua
`local AmmoModule = {}

AmmoModule.Players = {}

function AmmoModule:AddAmmo(player, ammoType, amount)
   local data = self.Players[player.UserId]
   data[ammoType] = math.clamp(
      (data[ammoType] or 0) + amount,
      0,
      250 * 10 -- se quiser limite geral
   )
end

function AmmoModule:RemoveAmmo(player, ammoType, amount)
   local data = self.Players[player.UserId]
   data[ammoType] = math.max((data[ammoType] or 0) - amount, 0)
end

function AmmoModule:GetAmmo(player, ammoType)
   return self.Players[player.UserId][ammoType] or 0
end

return AmmoModule

-- RECARREGAR
--[[
local disponivel = AmmoModule:GetAmmo(player, "9mm")
local falta = weapon.MaxAmmo - weapon.CurrentAmmo
local usar = math.min(disponivel, falta)

weapon.CurrentAmmo += usar
AmmoModule:RemoveAmmo(player, "9mm", usar)
]]
--Add Muni RemoteEvent:FireServer("AddAmmo", "9mm", 10)
-- entrar e sair
--[[
Player saindo:
DataStore:SetAsync(player.UserId, AmmoModule.Players[player.UserId])
AmmoModule.Players[player.UserId] = nil

Player entrando:
AmmoModule.Players[player.UserId] =
   DataStore:GetAsync(player.UserId) or {}
]]

`
```

![image.webp](https://trello.com/1/cards/6961b699424d845ef3cdc347/attachments/6997d1830ce8ccf29cc27686/previews/6997d1840ce8ccf29cc27694/download/image.webp)