Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Datastore does not save when player leaves?

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

1 comment

0

What is the point of only saving a value if you are not loading it?

1 answer

✓ Accepted answer

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.

3 comments

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

0

The url does not seem to work ^^^

0

Oh, Ok, still it was answered long ago.

This discussion is preserved as it was. New answers, comments, and votes are closed.