I'm sorry, I use Google translator!
local DataStore = game:GetService("DataStoreService"):GetDataStore("PlayerStats") game.Players.PlayerAdded:connect(function(player) local playerKey = "user_" .. player.userId local leaderstats = Instance.new("Model") leaderstats.Name = "leaderstats" leaderstats.Parent = player local Wins = Instance.new("IntValue") Wins.Name = "Wins" Wins.Value = DataStore:GetAsync(playerKey) Wins.Parent = leaderstats print(playerKey) while wait(5) do for _, player in ipairs(game.Players:GetPlayers()) do if player:FindFirstChild("leaderstats") then player.leaderstats.Wins.Value = player.leaderstats.Wins.Value + 1 DataStore:SetAsync(playerKey, Wins) end end end end)
if you remove the "DataStore: GetAsync (playKey)", the leaderboard will show Wins, but will not save
But if you leave this line, it will not save, as well as leaderboard will not show Wins
You're sending the actual IntValue to the datastore. Line 19 should read:
DataStore:SetAsync(playerKey, Wins)
Are you looking at the output window? It should give you some sort of error about writing the wrong type of data to an IntValue.