I've heard that NumberValue doesn't really save on the leaderboard. I don't know if it's true or my script is just messed up or something like that. I need help with it. This is my leaderboard script, what do I do to make it save?
local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("SkinStats")
game.Players.PlayerAdded:Connect(function(Player)
local Leaderstats = Instance.new("Folder")
Leaderstats.Name = "leaderstats"
Leaderstats.Parent = Player
local JumpPower = Instance.new("NumberValue")
JumpPower.Name = "Jump Power"
JumpPower.Value = 0
JumpPower.Parent = Leaderstats
local Wins = Instance.new("IntValue")
Wins.Name = "Wins"
Wins.Value = 0
Wins.Parent = Leaderstats
local PremiumDouble = Instance.new("BoolValue")
PremiumDouble.Name = "PremiumDouble"
PremiumDouble.Parent = Player
local Data = DataStore:GetAsync(Player.UserId)
if Data then
JumpPower.Value = Data["Jump Power"]
Wins.Value = Data["Wins"]
end
end)
game.Players.PlayerRemoving:Connect(function(Player)
DataStore:SetAsync(Player.UserId, {
["Jump Power"] = Player.leaderstats:WaitForChild("Jump Power").Value;
["Wins"] = Player.leaderstats:WaitForChild("Wins").Value;
})
end)
