hey, I have a problem. my data saves the same number and loads it all into the 3 children of the leaderstats.
my player added script (the end) are already there, as well as connecting it to the functions)
local DataStoreService = game:GetService("DataStoreService")
local Data = DataStoreService:GetDataStore("Data")
function onJoin(player)
local leaderstats = Instance.new('Folder',player)
leaderstats.Name = "leaderstats"
local cash = Instance.new("IntValue",leaderstats)
cash.Name = "some cash"
cash.Value = Data:GetAsync(player.UserId) or 0
local rebirth = Instance.new("IntValue", leaderstats)
rebirth.Name = "rebirths"
rebirth.Value = Data:GetAsync(player.UserId) or 0
local punches = Instance.new("IntValue",leaderstats)
punches.Name = "punches!1!1"
punches.Value = Data:GetAsync(player.UserId) or 0
here is my player removing script:
function hasLeft(player)
Data:SetAsync(player.UserId, player.leaderstats["some cash"].Value)
Data:SetAsync(player.UserId, player.leaderstats.rebirths.Value)
Data:SetAsync(player.UserId, player.leaderstats["punches!1!1"].Value)
end
game.Players.PlayerRemoving:Connect(hasLeft)
here is a screenshot of my issue: