Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is SetAsync on a datastore never finishing?

So I have a simple function to save data. After a while of going through my script I found that it has to be the SetAsync function that is causing my data to not save/load properly as the GetAsync function works fine, just returning nil.

local function SaveData(id, data)
    print("Test1")--Prints
    local s, m = pcall(function()
        print("Test2")--Prints
        PlayerData:SetAsync("User_"..id, data)
        print("Test3")--Doesn't print
    end)
    print("Test4")--Doesn't print
    if m then
        warn(m)
    end
    print(s)
end

As you can see the function moves through up until it reaches the SetAsync function of the PlayerData datastore. Im not quite sure why this is happening and I have tried many things to try to fix it in other parts of my script.

1 answer

"PlayerData:SetAsync("User_"..id, data)" is definitely the issue. Can you show the error? It is throwing some kind of error. Maybe you are playing in studio and didn't enable api services? Test the game in RobloxPlayer.

2 comments

0

No error. I have enabled api services, and data saving used to work.

0

Show the full script. I can see PlayerData isn't referenced in this script. Can I help if you won't show us? Show the FULL script or go elsewhere.

This discussion is preserved as it was. New answers, comments, and votes are closed.