#ProfileStore, Wait until profile has loaded

1 messages · Page 1 of 1 (latest)

summer schooner
#

you cant necessarily but at top of the function you can yield the script using repeat loop and wait until they recieve their data.

#
local Players = game:GetService("Players");

local ReplicatedStorage = game:GetService("ReplicatedStorage");

Players.PlayerAdded:Connect(function(Player)
    
    local dataloaded = nil
    
    repeat
        if not Player then break; end;
    dataloaded = ReplicatedStorage.HasDataLoaded:Invoke(Player);
        task.wait();
    until dataloaded and dataloaded == true;
    if not Player then return; end;
    
    print("yay data loaded");
    
    -- continue here
    
end)```