Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is SetAsync on a datastore never finishing?

Asked by
Kroniso 20
6 years ago

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

Log in to vote
0
Answered by
H4X0MSYT 536 Moderation Voter
6 years ago
Edited 6 years ago

"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.

0
No error. I have enabled api services, and data saving used to work. Kroniso 20 — 6y
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. H4X0MSYT 536 — 6y
Ad

Answer this question