Basically, I'm trying to save 2 Datas, but it's not working, For Points, it works, data is saved.
But for the Wins, it doesn't why?
local DATASTORE = game:GetService("DataStoreService"):GetDataStore("DATASTORE")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local wins = Instance.new("IntValue")
wins.Name = "wins"
wins.Parent = leaderstats
local Points = Instance.new("IntValue")
Points.Name = "Points"
Points.Parent = player
local data
local winsData
local dataSaved, notSaved = pcall(function()
data = DATASTORE:GetAsync(player.UserId.."-Points")
winsData = DATASTORE:GetAsync(player.UserId.."-Wins")
end)
if dataSaved then
Points.Value = data
wins.Value = winsData
print("Data Loaded")
else
print("Data not saved")
warn(notSaved)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local dataSaved, notSaved = pcall(function()
DATASTORE:SetAsync(player.UserId.."-Points", player.Points.Value)
DATASTORE:SetAsync(player.UserId.."-Wins", player.leaderstats.Wins.Value)
end)
if dataSaved then
print("Data Saved")
else
print("Data not saved")
end
end)

4 comments
Uh im not familiar with saving data with Tables, so this didn't really help
I edited the answer. If you want to reduce requests, and also save your data, then use an array/table.
I don't use dictionaries, only tables. That's cuz I'm cool.
Okay maybe I use dictionaries sometimes :p