leader stats script
- Change all the words that say cash with your name of your currency, Even "DataCash" it would be "Data What ever you currency is called"
local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("DataCash") -- Change this with a different name.
game.Players.PlayerAdded:Connect(function(Player)
local Leaderstats = Instance.new("Folder", Player)
Leaderstats.Name = "leaderstats"
local Currency = Instance.new("IntValue", Leaderstats)
Currency.Name = "Cash" -- Change "Cash" with your currency.
Currency.Value = 0
local Data = DataStore:GetAsync(Player.UserId)
if Data then
Currency.Value = Data -- Change this if you have added more currencies.
end
end)
game.Players.PlayerRemoving:Connect(function(Player)
DataStore:SetAsync(Player.UserId, Player.leaderstats.Cash.Value) -- Change "Cash" with your currency.
end)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Part/Money block script - Change all the words that say cash with your name of your currency
script.Parent.Touched:Connect(function(hit)
local player = hit.Parent
local gameplayer = game.Players:GetPlayerFromCharacter(player)
gameplayer.leaderstats.Cash.Value = gameplayer.leaderstats.Cash.Value + 100 script.Parent:Destroy()
end)
![](https://i.ytimg.com/vi/VKkniKpfn2I/mqdefault.jpg)