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

DataStore doesn't save? Or is it just me and IntValues..

Asked by 5 years ago

Hey guys. I recently got into datastores (for saving data of course), and came across a crucial problem..

local popcornToSave = plr.leaderstats.Popcorn.Value

local success, err = pcall(function()

popcornSave:SetAsync(plr.userId, popcornToSave)

end)

if not success then

print("DATASTORE ERROR | " .. err .. " | Player UserID:" .. plr.userId)

else

print("Successfuly saved data!" .. popcornToSave)

end

Note: Take that 'plr' is defined as 'LocalPlayer', I have just cut off the function part. It is in the PlayerRemoved event by the way.

Now, the thing is, every time I leave the game, it prints "Successfuly saved data!0", even though I don't have 0 in my leaderstat! It's definitely not zero, as I can see it in the leaderstat..

Any help appreciated, and thanks in advance!

0
this is bad code ur making my head hurt User#24403 69 — 5y
0
Maybe it would be easier if you explain what the leaderstat is? voidofdeathfire 148 — 5y
0
Also thats not how you find a leaderstat voidofdeathfire 148 — 5y

Answer this question