How do you wait for data to be loaded?

I wanna wait until player data is actually loaded before applying the loading phase to players.

I don’t understand. Please use an example to specify for me clearer.

2 Likes

Do you mean Datastore? If so, you don’t have to. GetAsync is a yielding function, that is, next line of code won’t run until it finishes.

3 Likes

@Quwanterz He probably means that

You can create a bool value, [example] if you are making a loading screen; you can make it wait until it gets a response from the server.

local bool_path = player.BoolName

repeat game:GetService('RunService').Heartbeat:Wait() until bool_path.Value == true

Set the bool_path’s value to true when the data has been loaded [from the server]
The bool is located inside the player

Never do busy waiting, or any while blah do wait ends. Its a bad practice and should be avoided at any case

1 Like