Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Leaderboards

How do I start on making one? Do I tag a killer and add a number for every time the killer has killed? How do I show this on a leaderboard?

1 comment

0

thank you i was doing it all wrong i tried for 2 days to make this and it was annoying as heck thank you this really helped me even if it was from 6 years ago

2 answers

✓ Accepted answer

Leaderboards are just some IntValue items inside all Players.

game (DataModel)
	Players (Player Service)
		Player1
			leaderstats (IntValue)
				KOs (IntValue)
				WOs (IntValue)
		Player2
			leaderstats (IntValue)
				KOs (IntValue)
				WOs (IntValue)
		Player3
			leaderstats (IntValue)
				KOs (IntValue)
				WOs (IntValue)

To make one, at the least you need to bind to the PlayerAdded event, which will put the leaderstats object into the player along with the types you want to add, such as KOs, WOs.

Then, you need to bind to whatever events you need to in order to keep track of your leaderstats items, such as binding to humanoids to track when they die, etc etc.

Here's a simple script that will create the initial leaderstats objects, along with a table you can manipulate to set what items you wanna keep track of

local stats = {"KOs", "WOs", "Money"}
 
game.Players.PlayerAdded:connect(function(player)
    local leaderstats = Instance.new("Model", player)
    leaderstats.Name = "leaderstats"
    for _, stat in pairs(stats) do
        Instance.new("IntValue", leaderstats).Name = stat 
    end
end)

1 comment

0

Wow this just blew my mind I thought leader boards are using a service O.O

This discussion is preserved as it was. New answers, comments, and votes are closed.