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

Why is leaderstats not saving?

I tried to save leaderstats, so I followed a tutorial, however it did not save, whatever I did. Please can somebody tell me what I've done wrong? (Script is placed in server script storage)


local datastore = game:GetService("DataStoreService")
local ds1 = datastore:GetDataStore("CashSaveSystem")

local function onPlayerJoin(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player
 
	local cash = Instance.new("IntValue")
	cash.Name = "Cash"
	cash.Parent = leaderstats
	
	 leaderstats.Cash.Value = ds1:GetAsync(player.UserId) or 0
	 ds1:SetAsync(player.UserId,cash.Value)
	print("dataLoaded")

	while true do
		wait(60)
		ds1:SetAsync(player.UserId, cash.Value)
		print("dataSaved")
	end
end
 
game.Players.PlayerAdded:Connect(onPlayerJoin)

Thanks in advance!

1 answer

Hello, You are thinking that you're using this script.

This Saving Script Needed API Services on. To make this work. You need to publish a place, click file,click close file I will say steps

Step 1: Go to My Games

Step 2: Click 3 dots on your place you published

Step 3: Click "Configure Game"

(It's will take you a ROBLOX Website (roblox.com))

Step 4: Enable "Enable Studio Access to API Services"

Step 5: Click Save

Done! If this steps are incorrect. this is script error.

3 comments

0

I have done this and it still isn't working. Please can you find out the scripting error and tell me please. Thanks for the help anyway.

0

uhhhh

0

There is a problem.. ROBLOX has changed their website and whole create page

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