Ideal way to pass datastore to client?

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 :slight_smile:

Just use a RemoteEvent. Spamming a RemoteEvent will not crash the datastore or whatever.

3 Likes

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.

2 Likes

RemoteEvents try until it goes through, there shouldn’t be any issue there.

Alright then, thanks! Just needed some reassurance because Roblox didn’t document that, and it felt like remote events didn’t pass through sometimes.

How is this ideal??? This has got to be the least ideal version

1 Like

Try to work on giving constructive critisism instead of just critisism. Who does your comment help?

1 Like

It should honestly help you first.

Yet you are using RemoteFunctions, what a joke

Yeah, I was giving him 2 options?

“RemoteEvents try until it goes through”

Also it client should never ensure the data exists

How else would you send data over to the client?

1 Like

I said ensure, the repeat until flow to invoke server and cause more bandwith, rather than one invoke and server ensuring data exists

If the data exists, it will only run the Invoke 1 time :person_shrugging:

1 Like

InvokeServer yields until the server returns a value so the script doesnt cause more bandwidth usage

The whole point of this topic is making sure the client gets the correct data
Please stop replying to topics without having any clue

And if data doesn’t exist, the client will keep asking server for data, yielding the whole game

if success and data then
return {Success = true, Data = data}
else
return {Success = false}
end
no need to return nil🥰🥰
crazy tech we have nowadays 🤯

and how is this verifying CLIENT has got the CORRECT data? LOL you are so…

also if you were the person with CLUE you would have just done return {Success = success, Data = data}
crazy tech we have nowadays :exploding_head:

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)

if success false
try again
if success false
try again
if success false
kick player
if success true
client has correct data

oh wow we are kicking player for horrible development? LOL, no wonder you didn’t code this and just sent plain text