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!
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.