just a simple script of data save i found from dev forum and it isn't working, i haven't fully learned about data saving yet anything wrong? it prints out that it saved successfully tho```lua
local dts = game:GetService("DataStoreService")
local ds = dts:GetDataStore("mydatastore")
game.Players.PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Folder")
leaderstats.Parent = plr
leaderstats.Name = "leaderstats"
local coins = Instance.new("IntValue")
coins.Parent = leaderstats
coins.Name = "Coins"
coins.Value = 0
local playerid = "Player_"..plr.UserId
local data = ds:GetAsync(playerid)
if data then
coins.Value = data['Coins']
else
coins.Value = 0
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
local saving = {
Coins = plr.leaderstats.Coins.Value
}
local playerid = "Player_"..plr.UserId
local success, err = pcall(function()
ds:GetAsync(playerid, saving)
end)
if success then
print("Saved!")
else
print("failed to save")
end
end)```
** You are now Level 7! **