How to make a death counter

Hello Fellow Developers!
First of all if your wondering. Yes I have been looking for videos, post sites etc. And I found no results. But my problem is that I want to make a script that will count all your deaths
example: I play a obby and then I fail/die then I want it to count it on the player leaderboard and say “Deaths: 0”
Please anyone help me with this I have been actually trying to find out how over a year and still no results.

Can’t you just listen to the player’s humanoid dying?

I want a counter in game to count how many times you have died. I can link a game that have something like it if your interested to see.

You may want to consider the Humanoid.Died event. It fires when the player dies, so you can connect it to a function with a variable that adds 1 to it.

See: Humanoid | Documentation - Roblox Creator Hub

You can basically make an increment variable
everytime the player dies, you add 1 to the variable

local counter = 0
humanoid.Died:Connect(function()
    counter = counter + 1
end)

Edit: Not to be rude but, this is very easy and I don’t think this post should’ve been created…

8 Likes

I agree with @Wqund. Maybe you were to specific with your search when you tried to find the answer. Instead of typing in “How to make a death counter” in Google or the developer forums, try: “How to detect when a player dies”. After which, you can incorporate whatever events that are suggested into your own script.

1 Like

If you haven’t managed to figure this out in over a year, you shouldn’t be labelling yourself as a scripter.

Humanoid.Died event is something extremely simple, even if you didn’t learn this you could use Changed or GetPropertyChangedSignal.

Leaderboards are also very simple.

1 Like

You couldn’t find out about the Humanoid’s “Died” event for a year?

Well one of the other user already gave you the code so…

1 Like

I can script this is just this one simple script I could not find dosent mean I can’t call myself scripter over one script.

3 Likes

If you couldn’t figure out two of the most simple things ever for over a year - a very obvious event used quite often with 3 (.Changed, :GetPropertyChangedSignal(), plr.CharacterAdded but that’d count when they first spawn too) other ways of doing it - you really shouldn’t label yourself as a scripter.

You could google some very simple things Roblox how to detect when player dies

As for overwriting a value, that is pretty obvious if you know how to code.

There’s probably even similar-ish threads here on DevForum.

1 Like