So what I'm making is a game where you sell your deaths for coins but it has been stumping me for awhile I have been questing how to even make the deaths into coins by touching a block so that's why I don't have a script because I don't know how to start it or make it basically what mining sim does but with no backpack but from the leader-board.
How Do I sell something from the in-game leader-board and make it into a different currency?
2 answers
First of all you'll need to track Player Deaths.
Players.PlayerAdded:Connect(function(Player)
local Leaderstats = Instance.new("Folder")
Leaderstats.Name = "leaderstats"
local Deaths = Instance.new("IntValue")
Deaths.Name = "Deaths"
Deaths.Parent = Leaderstats
local Money = Instance.new("IntValue")
Money.Name = "Money"
Money.Parent = Leaderstats
Leaderstats.Parent = Player
Player.CharacterAdded:Connect(function(Character)
Character:WaitForChild("Humanoid").Died:Connect(function()
Deaths.Value = Deaths.Value + 1
end)
end)
end)
The code above creates the Leaderstats folder, Deaths value and Money value in the player which will be displayed on the PlayerList. When the Player dies, their Deaths Value is increased by 1.
Next, we'll need to attach some code to a Part so that when it's touched it'll convert the your Deaths into Money!
local Multiplier = 1
Part.Touched:Connect(function(Hit)
local Player = game:GetService("Players"):GetPlayerFromCharacter(Hit.Parent)
if Player then
local Leaderstats = Player.leaderstats
Leaderstats.Money.Value = Leaderstats.Money.Value + (Leaderstats.Deaths.Value * Multiplier)
Leaderstats.Deaths.Value = 0
end
end)
This code will convert your Deaths into Money. Right now you'll get the same amount of Money as your Deaths. You can increase the amount you get by per death by increasing the Multiplier.
Anything less than 1 will give you less Money, anything more than 1 will give you more Money.
so what you mean for the last script is that I get a block then I step on it and it converts my deaths in to coins?
This discussion is preserved as it was. New answers, comments, and votes are closed.

7 comments
Thx
so what you mean for the last script is that I get a block then I step on it and it converts my deaths in to coins?
Yes. Don't forget to mark it as the right answer if I helped.
oh and I have a Leaderboard do I need to use the leaderboard you made or the leaderboard I have?
It wont work.
Well you obviously have to change the code to work with your custom leaderboard.
I allready found something bye