I have already made a leaderboard script that randomly gives a player an amount of points, these points are the amount of lives the player has when he/she joins the game.
I don’t know how to deduct points from a leaderboard and I don’t know how to make the script deduct points (lives) from the player’s total when they die in the game.
(from falling off the map, sword fighting, etc)
When a player dies in the game I want the leaderboard to deduct one point (one life) from the counter and this continues every time the player dies until he/she has 0 lives.
I have no clue yet on how to start on putting these features in my script and I haven’t found this topic anywhere on Devforum.
Here’s my script that assigns a number to a player once they join and shows the number on the leaderboard
game.Players.PlayerAdded:Connect(function(players)
local leaderboard = Instance.new("BoolValue", players)
leaderboard.Name = "leaderstats"
local Lives = Instance.new("IntValue", leaderboard)
Lives.Name = "Lives"
Lives.Value = math.random(10,100)
print(Lives.Value)
players.CharacterAdded:Connect(function(character)
end)
end)
Can I make these features work in this script or do I have to make a separate script for it?
Do I need to make a death variable like my lives one?
**If someone could get me started or show me the full script that would make this feature possible that would solve my problem so I know how to make scripts like these again in the future.
Thanks for reading.