Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- start with this:
- local InventoryAmmo = (player.inventory[player.equipment.ammo].count or 0)
- -- break it up into this:
- local inventory = player.inventory
- local equipment = player.equipement
- local ammo = equipment.ammo
- local temp = inventory[ammo]
- local count = temp.count
- local InventoryAmmo = count or 0
- -- the error happens at count = temp.count, so temp must be nil. fix it by adding "or {}"
- local inventory = player.inventory
- local equipment = player.equipement
- local ammo = equipment.ammo
- local temp = inventory[ammo] or {}
- local count = temp.count
- local InventoryAmmo = count or 0
- -- replace count:
- local InventoryAmmo = temp.count or 0
- -- replace temp, in order to make it work you have to add parens:
- local InventoryAmmo = (inventory[ammo] or {}).count or 0
- -- and then the rest is easy:
- local InventoryAmmo = (player.inventory[player.equipement.ammo] or {}).count or 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement