Continuing from my previous post, what would be the best way to return Datastore information to a player? I’m mainly asking about a one-time pass for when a player joins the server.
Basically, the way my system works is that there are 2 modules: one on the server, responsible for fetching the data and letting server-side script access it, and one on the client, which needs a way to receive the data from the server through a signal, and allow client-side scripts to access it too.
I thought about using a remote function to let the client request their data, but I’m concerned about networking abuse (exploiters, unnecessary requests, etc.). I also considered using a remote event that fires from server to client, but once again - not sure about the likelihood of the data making it to the client.
I feel like the remote function request method might be the best case here. What do you think?
Thanks for reading
The problem isn’t about crashing the Datastore service, but about how to reliable pass a player’s Datastore information to them.
I’m conflicted on whether I should invoke a remote function from the client to request that data (while it’s already loaded on the server) with the risk of it being abused (intentionally or not), or fire a remote event from the server to the client, with the probability of it not going through (especially when the player’s game is still loading).
RemoteEvents try until it goes through, there shouldn’t be any issue there.
It would also be fine using a RemoteFunction from the client to request data from the server.
You could do this to insure that the data exists on the client:
local data
repeat data = RemoteFunction:InvokeServer() until data
Then cache the data from the datastore on the server and return that, instead of returning DataStore:GetAsync() directly.
The correct answer to this post is to either send the whole DataObject to client via RemoteEvents or send change commands, and send key, value pairs to client. (When data is changed)