Check when table value is changed

I simply want to be able to check when an index in a table is changed.

To put in context, I have a table in a module script that when changed I want to replicate to all clients by firing a remote event.

Depending on how are you planning to update the values, that’s where you can fire an event inside the updating logic.

1 Like

I know that is a way to do it but it doesn’t answer the question. I am changing it from multiple locations so doing this would be a bit of a pain.

My suggestion is that you can just create a function in your module script that handles the updating logic, stated in this post of a similar problem as yours.

1 Like

You could even make it a method of the table to save work.

local data = {} -- data goes in the table

data.Set = function(self, key, value)
    self[key] = value
    -- fire all clients
end

return data
data:Set("nextMode", "FreeForAll")
``|