I have no idea how to add functioning KO's and Wipeouts to the leaderboards I have make a script to allow it to show, I don't know how to make it function though.
game.Players.PlayerAdded:connect(function(p) local stats = Instance.new("IntValue", game.Workspace) stats.Name = "leaderstats" stats.Parent = p local money = Instance.new("IntValue", game.Workspace) money.Name = "Kills" money.Value = [A NUMBER] money.Parent = stats end)
Thank you -ZST
Really the funny thing about leaderboard stats for a player is that there is no direct file that can display a stat (no generic files of that player). Although the Leaderboard system is a service, it is hidden and cannot be accessed. So if you are trying to create stats for the leaderboard, you must insert an object inside of the player.
A leaderboard/leaderstat is organized in a specific way. In each row for each player, there are two main things that appear. 1) the player that your specifying, and 2) the stat your specifying. It must include the following:
-A model or file that is named "leaderstats" that will stand for a leaderstat/leaderboard
-2) A Value (usually IntValue) to specify any stats that you want to include for each player
Now that we've discussed a little about the structure of the Leaderboard, let's see how we can actually create stats. Like I said, you cannot directly access the Leaderboard service, so we need to create our own (sort of). Let's follow these steps:
1) First, we need to create a file that specifies there's a LeaderStat within that player (using either a model or a file)
2) Then we will create a new Vale that will stand for any stats you want to include
EXAMPLE:
player --I've left this blank for now, but this is supposed to stand for the player that your specifying LeaderStat = Instance.new("Model", player) --this creates a new model/leaderstat and puts it within the player LeaderStat.Name = "leaderstats" --you MUST use this specific name Stat = Instance.new("IntValue", LeaderStat) --this creates a new Vlaue/stat that will be included inside that player's leaderstat section
Now you probably want to organize all of this into your function. There are two ways of creating leaderstats:
1) With a local script
or
2) with a server - side script
For now, I suggest you focus on server - side scripts, but I'll include both ways/methods anyways!
Server - side:
game.Players.PlayerAdded:connect(function(player) LeaderStat = Instance.new("Model", player) --this creates a new model/leaderstat and puts it within the player LeaderStat.Name = "leaderstats" --you MUST use this specific name Stat = Instance.new("IntValue", LeaderStat) --this creates a new Vlaue/stat that will be included inside that player's leaderstat section
And the Local one:
player = game.Players.LocalPlayer LeaderStat = Instance.new("Model", player) --this creates a new model/leaderstat and puts it within the player LeaderStat.Name = "leaderstats" --you MUST use this specific name Stat = Instance.new("IntValue", LeaderStat) --this creates a new Vlaue/stat that will be included inside that player's leaderstat section
If you have any questions, comments, suggstions feel free to post a comment. Otherwise a have a list of links below to everything I explained in this answer:
Roblox Wiki: http://wiki.roblox.com/index.php/Scripting
Leaderboard's: http://wiki.roblox.com/index.php?title=Leaderboard
Model: http://wiki.roblox.com/index.php?title=API:Class/Model
IntValue: http://wiki.roblox.com/index.php?title=API:Class/IntValue
I did answer a question of a similar nature a while ago.
Leaderboard scripts connect to the Humanoid Died event everytime the CharacterAdded event is fired. Weapons permitting, the script gets an ObjectValue object from the dying player's character model. That Object value is named "creator" and for the value it holds the player object that hit the dying player. With that, the script will award the KO to the killing player through the ObjectValue, and a WO to the dead player (often times regardless if they were killed by a player).