Join my new discord: / discord Join my new roblox group: https://www.roblox.com/groups/5821166... script:
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("BoolValue", player)
leaderstats.Name = "leaderstats"
local Cash = Instance.new("IntValue", leaderstats)
Cash.Name = "Cash"
Cash.Value = 0
local DataStore = game:GetService("DataStoreService"):GetDataStore("SaveCash")
local Key = player.UserId
local Data = DataStore:GetAsync(Key)
if Data then
Cash.Value = Data
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local Key = player.UserId
DataStore:SetAsync(Key,player.leaderstats.Cash.Value)
end)