Player script runs before leaderstats can fully load

  1. What do you want to achieve?
    I have a Player script that turns saved checkpoints green when players join the game. It uses IntValue in leaderstats to compare values to decide which checkpoint in the map should be green.
  2. What is the issue?
    The script runs before the leaderstats can fully load and read the unloaded IntValue as 0. What can I do beside using task.wait() ?

local checkpoint = player:WaitForChild(“leaderstats”):WaitForChild(“CheckPoint”)

have this script directly inside your datastore script so that its running off of the data that is recieved from the datastore GabrielG’s code wouldnt work because u mentioned its intvalue is 0 which means the object is loaded but the datastore didint get the data

Just insert :WaitForChild() when indexing the leaderstats folder and any value in it

I kinda fixed it, just let the intvalue have a bit time to load before calling the Checkpoints in workspace

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