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!

3 comments
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.
uhhhh
There is a problem.. ROBLOX has changed their website and whole create page