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

Why is leaderstats not saving?

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago

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.

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. pinkcust2vids 2 — 4y
0
uhhhh PLplayz999 14 — 4y
0
There is a problem.. ROBLOX has changed their website and whole create page PLplayz999 14 — 4y
Ad

Answer this question