I use them to create a highly network efficient server to clients replication system which would take many dozens of lines to recreate without value objects.[/quote]
Explain?[/quote]
First of all, hooking .Changed is very efficient. Updating frame by frame is not, and can sometimes be more difficult to do than hooking .Changed.
Second, ROBLOX objects don’t replicate unless their data has changed. By creating what I call a “replicator,” a folder filled with value objects representing the transmittable data of an object. I can harmlessly update them as often as I like and it is network efficient because they don’t send the data to the clients unless it has changed.
It allows for easier debugging. “Why isn’t this working?” Just look right at the value.
If you’re doing networking right, and literally everything important is on the server, then it’s secure.[/quote]
What specifically are you doing where you have a choice between connecting an event or running a piece of code each frame?? Those seem like pretty different means to pretty different ends. I was suggesting that you use remotes which are far more secure. If a player locally changes the value of that value container then Changed will fire and your scripts will be running on bad info.
I don’t see why you can’t just check if the data has changed and then fire a remote. Then at least you get to choose if your “update” is ignored.
A classic double-edged sword. Easy to read, easy to write. For you and the exploiter.
Roblox uses distributed physics, which by that definition are not secure. If you’re sending information that your scripts use to affect the movement of the character then an exploiter could easily modify that information and gain an advantage.
To argue for remotes rather than against value containers, remotes can be used with discretion so you can choose who to replicate to. If data isn’t relevant to a certain player then hogging the network can be avoided.
Remotes can carry any value type including tables
Remote updates are queued so data can’t be lost (unless you’re sending a ludicrous amount of data). Value containers don’t queue so data will be lost if you change it again before the next network step.
local tabVal = {}
local val = #tabVal
-- I see what you mean, after thinking about it, but you can do it on your own I guess?
while wait(0.5) do
if #tabVal ~= val then
val = #tabVal;
-- do something
end
end;
What specifically are you doing where you have a choice between connecting an event or running a piece of code each frame?? Those seem like pretty different means to pretty different ends. I was suggesting that you use remotes which are far more secure. If a player locally changes the value of that value container then Changed will fire and your scripts will be running on bad info.
I don’t see why you can’t just check if the data has changed and then fire a remote. Then at least you get to choose if your “update” is ignored.
A classic double-edged sword. Easy to read, easy to write. For you and the exploiter.
Roblox uses distributed physics, which by that definition are not secure. If you’re sending information that your scripts use to affect the movement of the character then an exploiter could easily modify that information and gain an advantage.
To argue for remotes rather than against value containers, remotes can be used with discretion so you can choose who to replicate to. If data isn’t relevant to a certain player then hogging the network can be avoided.
Remotes can carry any value type including tables
Remote updates are queued so data can’t be lost (unless you’re sending a ludicrous amount of data). Value containers don’t queue so data will be lost if you change it again before the next network step.[/quote]
Literally only ever use it for Gui/Graphics information.
Here’s what you do. You have two objects, a RemoteFunction for fetching the table, and a RemoteEvent that fires every time you update the table. I’ve done this for Trade Hangout and it works nicely.
As Max has already pointed out the replication of a lua table has many caveats. Lua tables are mutable and can store references to other tables that also only exist in local machine memory. They can also store references to objects that only exist on the client, which create questions on how it would replicate.
Lua tables also have metamethods which is lua code that runs when certain operations are called on the table. How do you replicate that metamethod code from client to server? And if you do, isn’t it a possible code injection vector to accept code from the client like this?
As far as I know, this feature could only be partially supported and would end up being a pitfall for developers trying to debug their game.