I recently made this datastore it works in my other game but not the game I’m currently working on can some one tell me wats wrong
starterMoney = 100
game.Players.PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = plr
local money = Instance.new("IntValue")
money.Name = "Money"
money.Value = dataStore:GetAsync(plr.UserId) or starterMoney
money.Parent = leaderstats
end)
game.Players.PlayerRemoving:Connect(function(plr)
dataStore:SetAsync(plr.UserId, plr.leaderstats.Money.Value)
end)