local ds = game:GetService("DataStoreService"):GetDataStore("Levels")
game.Players.PlayerAdded:Connect(function(player)
local key = "Levels-"..player.UserId
local folder = player:WaitForChild('leaderstats')
local int = Instance.new("IntValue",folder)
int.Name = "Levels"
int.Value = 1
local save = ds:GetAsync(key)
if save then
int.Value = save
end
int.Changed:Connect(function(player)
ds:SetAsync(key,int.Value)
end)
end)
This script used to work, but why won't it work? [Script to save Levels]

Space

Lastly, pause the game and then start it again to check if your level changed.