I know of the changed event, but say that I had a self-made class as follows:
local Inventory = {}
Inventory.__index = Inventory
function Inventory.new()
local inventory = {}
setmetatable(inventory, Inventory)
inventory.coins = 10
return inventory
end
Is it possible to bind a function to fire when inventory.coins has been changed?
local Inventory = {}
Inventory.__index = Inventory
function Inventory.new()
local inventory = {}
setmetatable(inventory, Inventory)
inventory.coins = 10
inventory.coins.Changed:Connect(inventory.coinsChanged)
return inventory
end
function Inventory:coinsChanged()
end