Hi everyone! A small technical question. When it comes to sending data (The savefile of the player in this instance) to the client stored as tables, what is the best way exactly?
In my previous experiences I’ve been using a remote function to call the server for the entire new copy of the savefile 20-60 times a second. I have come to realize that this might not be the best way to save bandwidth.
I was thinking about using remote events that the server pass to the client everytime a value in the savefile is updated. This would of course result in a lot of remote events being fired, probably could end up being dozens a second if one singular value is being changed rapidly (Adding a debounce to the update of a singular value would be possible, like can max fire this values update 10 times a second or something along those lines).
I was wondering if anyone else has a solution to this problem of if my previous solution would be good enough?
Hello! I can try to help although I don’t know how helpful I’ll be.
Firing a remote event to the client 20-60 times a second is not a great way to handle it. I would suggest having a folder instance that has all the values inside it (for example in the workspace), and then just take the values from it on the client whenever you need the data.
However, this might not be the best depending on what you’re doing for your game. Could you maybe give us some more background information about what this data is for, what you’re doing with it, and how you’re currently handling it? (Including scripts)
I would create a state
it works by sending all of the player data to the client whenever a player joins and as soon as something updates replicate that to the state aswell
then whenever you want to use the data in let’s say a ui simply require the module and grab the replicatedprofile from there
ultimately you’d only want to send whats necessary and keep tabs on client (using memory not bandwidth), not a full table all the time on demand–though the more pressing matter is why you are insisting on doing that much in a single second.
I’ve never understood if remote events are demanding? Would using 100 remote events every second but only passing a small number (let’s say 0-9) be more demanding than sending 1 remote event every secong and passing 100 different numbers in the same one?
Each remote event / function opens a connection on both ends to listen to data, you should logically use them like you are using ModuleScripts, for their purpose. Image a RemoteEvent Named DataReplicator, it’s only purpose is to replicate data from server to client