How to make a simple Kill leaderboard (main problem finished)

Hello. I am making a fighting game so obviously there should be a kill leaderboard in the top right corner. But I don’t even know the first thing about how to make a leaderboard.

What I want is a “Kills”, “Wins”, and “Coins” Leaderboard with the “Wins” determining the placement on the playerlist (determining if you belong in the lowest or highest part in the playerlist).

If you can script the “Kills” Leaderboard to actually make it take kills AND BE ABLE TO SAVE… Thank heaven if you do that :angel: It would be very much appreciated by me. But this is a side problem that may get bigger later :sweat: so dont worry about it

4 Likes

Here is a link on how to make leaderboards: In-Experience Leaderboards | Documentation - Roblox Creator Hub

1 Like

Actually I already looked at that article before I even posted this. I changed all the things to “Kills” and nothing happened

Have you tried YouTube? I usually go there if I am stuck on things.

I didn’t try that yet

30 Characters

What way can players kill other players in your game?

Here’s a script example:

game.Players.PlayerAdded:Connect(function(player)
-- This must be named leaderstats in order to work
	local leaderstats = Instance.new("Folder",player)
	leaderstats.Name = "leaderstats"
	
	local Money = Instance.new("IntValue")
	Money.Name = "Money"
	Money.Parent = leaderstats
-- Replace money with whatever you want it to be
end)
2 Likes

He didn’t ask for these stuff…

Alright, I’ll give you a direct answer.

For you to track Kills here is your method.

For every time a player has their character added/respawned you would want to look for their Humanoid object and listen for the Died event. If you’re using tools that have common scripts like swords then this should be easy to implement.

When a character receives damage from a tool that uses these common scripts a object is created called “creator” which is a ObjectValue where the Value is the player that has given the damage.

So as a quick pseudo/example:

Sorry that I didn’t provide the example directly into the post because the formatting for codeblocks seem to be broken.

Now for the logic of the area where it says the player was killed by another player you would do

Humanoid.creator.Value.leaderstats.Kills.Value = Humanoid.creator.Value.leaderstats.Kills.Value + 1

For the matter of saving, reference the already provided information.

4 Likes

I don’t recommend using the parent argument of Instance.new

Just do

local Money = Instance.new("IntValue")
Money.Parent = leaderstats
3 Likes

I added an extra “X” and set it to “Y” and changed stuff i needed to change and it worked!