It is used to replace ValueObjects like BooleanValue and more because using ValueObjects just add to the instance count which increases the memory usage and because you can store multiple values using this module. Those are a few of the benefits
I doubt this saves up on a lot of memory when you’ve replicated the use behaviour in a module script. Your module might actually take up more memory per object than using traditional value instances. Whilst also removing the ease of access of having ValueInstances in the game environment.
I think you overestimate how much data an instance takes up, especially ValueObjects. They have a lot of functions but they’re all inherited from the global Instance class anyway so adding more ValueObjects isn’t expensive. I understand instances like parts, scripts and remote events may be more expensive and they need that for their functionality. ValueObjects on the other hand have one function and that is to hold a single value.
As far as I know, this wouldn’t save alot of memory but Values still take more memory than this, and the usecase for this module is not to share the object, but to detect changes in the values for one script, it is also better to use one object with multiple values for a script.
Including the memory cost it would take to add a module and all its extended functions it wouldn’t start improving memory usage until you start using a lot of ValueObjects. Also if all these FakeValueObjects are in one script surely its just better to use a function to change a value instead of connecting to events all inside one script.
your use case
local value = FakeUpdatedModule.new()
value:Set('boolean', true)
value:GetPropertyChangedSignal('boolean'):Connect(function()
print(value:GetValue('boolean'))
-- do code
end)
surely its just better to
local thing = {}
function updateValue(index, value)
thing[index] = value
-- do code
end
updateValue('boolean', true)
One ModuleScript (consisting of a bunch of tables and functions) would not take much more than an Instance, even if it doesn’t do much, better safe than sorry.
It is also very unlikely to use a little amount of ValueObjects, and when you start using more of these, it becomes a problem. Which this module helps with.
All of this module combined uses less memory than a normal ValueObject, and to respond to the code you’ve given, because the module doesn’t take more than ValueObjects, there is no problem with using it and it has more accessibility and it is easy to use like a normal ValueObject.
50 of my module also takes less than ValueObjects, this is tested so i can confirm.