-- ScriptsCodes | Roblox Studio Luau utility -- Run: Open your own place in Roblox Studio, choose View > Command Bar, paste this file, and press Enter. -- Output: Results appear in the Studio Output window. Edit the sample values before running. local inventory = {coins = 20, keys = 1} local function canAfford(wallet, price) return type(price) == "number" and price >= 0 and (wallet.coins or 0) >= price end local function spend(wallet, price) if not canAfford(wallet, price) then return false end wallet.coins -= price return true end print(spend(inventory, 12), inventory.coins)