OnTableChanged - Know when your table key-value has been re-assigned

Just a super short post, this module will let you know when your key-value tables have been reassigned.

(same methods used in PSManager)

e.g:

local OnTableChanged = require(--[[path]])
local PlayerStats = {
    Cash = 100
}

OnTableChanged:ActivateTable(PlayerStats)

OnTableChanged(PlayerStats, 'Cash', function(updatedCash)
    print("Cash is now", updatedCash)
end)

while true do
    task.wait(1)
    PlayerStats.Cash += math.random(10, 100)
end

That’s about it, enjoy!

5 Likes