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

Datastore does not save when player leaves?

Asked by 6 years ago

Hi there! My datastore save script won't work. But, when I execute it using the command line, it does. Any help is welcome.

local DataStoreService = game:GetService("DataStoreService")
local Wins = DataStoreService:GetDataStore("Wins")

game.Players.PlayerRemoving:connect(function(player)
    print('player left')
    local success, newName = pcall(function()
        return game:GetService("DataStoreService"):GetDataStore("Wins"):SetAsync(114962047, 55)
    end)

    if success then
        print("success")
    end
end)

Thanks in advance, Jonas

0
What is the point of only saving a value if you are not loading it? Timmerman73 85 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

You enabled API services?

If not, get to Develop.

Find the game you wanna edit, and press the gearbox nearby the "Edit" button.

Click "configure game"

Check the "Enable Studio Access to API Services".

And it should work.

0
If this works for you, please help me in this question i have: scriptinghelpers.org/questions/55484/how-to-make-a-clickdetector-script-that-does-this Chris75764 49 — 6y
0
The url does not seem to work ^^^ marketmanager1 52 — 6y
0
Oh, Ok, still it was answered long ago. Chris75764 49 — 6y
Ad

Answer this question