Nevermind this request

As a Roblox developer, it is currently too hard (uses unnecessary memory, anyway) to know what value a Value Instance used to have if the change is not essentially predictable, or the game's scripts simply aren't written to remember them. It would be much easier if Roblox could fire also the Value's old value after its new value in the Changed signal.

RBXScriptSignal Changed (property value, property oldvalue)

script.StringValue.Value = 5

script.StringValue.Changed:connect(function(newval, oldval)
print(newval, oldval) – Prints (5,0)
end)

The way my game is set up, I need Value Instances to hold data to be read by multiple scripts. I’m currently using a hacky method of remembering their old values, but I feel this is a bit too data-heavy, so it would be better if Roblox could just tell me what the old values are before they change. This could also be a new method of checking security.

Alright, alright, I already have several people messaging me saying “duh it’s easy to remember the old value”. I just feel like it should be easier to know the old value without having to use up that much more memory to save it as a variable. I don’t know why I should have to waste memory recording the variables when I only need to know what it was before it changed. We may as well not fire the new value in the first place since you can already fetch it so easily, yes? Close the thread if you want.

2 Likes

What do you use the old value for?

1 Like

Mostly for the server to verify a player’s game statistics, to make sure that they aren’t changing too much or too little. I need the values to be visible by the client so this is largely for data protection.

OP gave a bad example, and is not a good case for why this would be useful. It’s already possible to know the old value by storing it in a variable every Changed fire, so we should be looking at why this would be more convenient than storing the old value in a variable. @dragonfrosting please try to tailor your feedback to this.

2 Likes

It’s really simple to track the last value of an object. I guess the biggest benefit of this feature would be to have a stateless event.

This seems like a pretty niche use case considering you can already do this yourself and it seems like this only applies in non FE games. It would be complicated to add and would cause events to fire slightly slower (more data to send over the Lua bridge) so I don’t think this feature is worth adding.

2 Likes

This seems like more of a misunderstanding of how resource usage works than a need for a feature. Resource usage is only a problem when it has a negative effect – not “it seems like I’m using too much”. The memory used by storing a few variables is negligible – saving this negligible amount of memory would cause a much more noticeable decrease in event speed because more data has to be sent across the network, as TheGamer101 mentioned.