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

Leaderstats error??? [data store]

Asked by 10 years ago

This has no error, and its in a GUI but the wait(function() end) will not respond.

local DS=game:GetService("DataStoreService"):GetDataStore("AnsweredCorrect") 
print'got DS'

function DATA_Service_UPDATE()
local plr=script.Parent.Parent.Parent

    local key = 'user_'..plr.userId
    print'got key'

    wait(function() -- This doesnt respond, but it doesnt error. :/ Im not sure what the error is.
    -- Any idea?
    DS:UpdateAsync(key, function(oldValue)
         print'Updated Ansy()'
        local newValue = oldValue or 0 print'oldValue or 0'

            newValue = game.Players[plr.Name]['leaderstats']['Correct Guess\'s & Credits'].Value

                        print'leaderstats + 0'

                    game.Players[plr.Name]['leaderstats']['Correct Guess\'s & Credits'].Value=(newValue)

                    print'added stats'
                print(newValue)

            return newValue
        end)
    print'returned oldValue or 0'
    end)
end

Answer this question