How to detect if the player datas are all fully loaded?

So whenever a player is joined the server, a check thing will get player data nil

I want to know if there is any posible way to make the client script wait until player datas are fully loaded.



@batteryday is right but to an extent. You can use remote functions however datastores cannot be accessed by the client. But you can sort of access data from the client to an extent. I hope that clears any confusion. Sorry I’m not the best at explanations.

@Amritss is right but to an extent. The extent is that you can’t access DataStoreService from the client. That’s why @batteryday is correct that you need RemoteFunctions to ask the server to get data and then return it to the client. I hope that clears any confusions.

Here is a comprehensive example:

-- localscript

local data = RemoteFunction:InvokeServer() -- this will wait until the server returns data

The problem here is I want to know when all of player datas are loaded so the client script from PlayerGui can run

Or else, when I get Player data from Value, it will return nil

It depends on how your data system is set up. I use the old simple Attribute trick since that automatically replicates. If you are loading data right when a player loads:

--- Server script
     --- Load player data
     --- After everything is finished loading, set an attribute
     player:SetAttribute("DataLoaded", true)

In whatever client scripts you have:

--- Local script
local player = Players.LocalPlayer

--- Wait for the data to load in
if player:GetAttribute("DataLoaded") == nil then

--- Load the rest of the client script
local data = DataRemoteFunction:InvokeServer()

Alr ty, I will try this when I’m free

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.