youtube原地址:https://www.youtube.com/watch?v=erwx5FxsDTE
--Script
local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("MoneyStats") -- Change this with a random name.
game.Players.PlayerAdded:Connect(function(Player)
local Leaderstats = Instance.new("Folder")
Leaderstats.Name = "leaderstats"
Leaderstats.Parent = Player
local Currency = Instance.new("StringValue")
Currency.Name = "Money" -- Change this with your currency name.
Currency.Value = DataStore:GetAsync(Player.UserId) or "0"
Currency.Parent = Leaderstats
end)
game.Players.PlayerRemoving:Connect(function(Player)
DataStore:SetAsync(Player.UserId, Player.leaderstats.Money.Value)
end)