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