Is there a way to create a listener object and attach it to a value to see if the value changes? Seems like a silly question but sometimes simple things stump you.
:GetPropertyChangedSignal is your friend.
value:GetPropertyChangedSignal("Value"):Connect(function()
-- fires when the value changes
local newValue = value.Value
end)
What if it isn’t an instance and just a regular string type? I want to be able to use my custom type for the value. Or if I do use an Instance, do you know how to use the same reference to it across the client-server boundary?
You could have a Getter and Setter function where one returns the value and the other changes the value itself and fires a BindableEvent so you can listen for the changed value.
You cant track variable changes directly.
If you want a mechanism to detect if a table key changes, you can either use a Getter/Setter method system, or a metamethod if you want a more implicit system through the .key = value syntax.
The server and client memory is completely unrelated (for obvious reasons), the client cant access the server memory and vice versa because it’s two different computers.
When it comes to Instances, Roblox does some stuff under the hood to make it point to the same Instance, but its actually a different object memory wise.
For strings, they’re immutable anyway and dont work like strings in a more typical language like C++ or Rust.