Alright, so right now, my studio’s game is using the basic Linked Leaderboard that uses the Object values in the humanoid… As many of you most likely know, this is a very inefficient method since only a handful of tools use this method.
We have 40+ tools inside of the game, and I’ve already been through all of them several times trying to add in a basic leaderboard function, but still only half working… I highly doubt roblox would have a extremely inefficient method as this the only way to do this.
So the question is… What is the best/more efficient way to make a WO/KO leaderbord, preferably one that just works from one single script inside of ServerScriptService to work for all tools without editing them.
Mhm, that is pretty much the same thing… It uses a value inside of the Humanoid called “creator” which is placed by the tool. Which is what I am currently trying to get away from. I just need a basic way to get the killer without using a value place by a tool
If you want to make something more custom you have to make a custom gui for it. You should also learn dictionaries. When a player joins a game you want to store all their data into a dictionary. In this case you are doing KOs and WOs. This is done in a server script, and is secure. Anytime somebody dies you can change the data and anytime somebody kills somebody you can change it.
SessionData = {}
game.Players.PlayerAdded:Connect(function(player)
local data = {
KOs = 0,
WOs = 0,
}
SessionData[player.UserId]
end)
As for a client script reading the data you will want to make a folder in replicated storage called “PlayerData” and when a player joins create a folder in that folder called the players userId. Then you can create intValues inside it or whatever you want. Whenever somebody kills somebody, you will change their information in SessionData, then update it in ReplicatedStorage. The data in replicated storage is purely for the client to read.
As for the UI, just do it so that whenever the intValue in the replicatedstorages data is changed you update the UI.
Idk if you understood anything I just said but if not I recommend learning tables and dictionaries. Also using this method makes data stores super easy to do.
Mhm,not quite sure you understood my question though… I am very fine with the leaderboard…
Right now for a WO/KO leaderboard… When a tool kills a person it has to store a value inside of the player called “creator”… That is then used by a leaderstat script to recognized the killer. I am trying to be able to do that without the creator value and just do it all from one script…
Oh okay. You said What is the best/more efficient way to make a WO/KO leaderbord. That is the best method. Anyways to clarify, are you wanting to know how to keep track of KOs and WOs by 1 script?
Mhm, kinda hoping there was some new function that I don’t know about that is like “RecentDamage” that will tell you from what script called “TakeDamage” the humanoid… I know that is a bit to much to hope for, but figured I’d check.
Unfortunately there is no way to do that since guns are up to the developer. Say I make a gun, I can take away the players health in the guns script in my own way and there is no way for another script to know who killed who unless that script communicated to the other one. Does that make sense?
By communication I mean it can put a value somewhere and the other script can be like oh a child has been added that means player1 killed player2. That or remote events, or module communication.
I actually remember a discussion about this once before. It got relatively fired up after ValueObjects were scrutinised and I deleted all of my replies to that thread.
Depending on the way your tools have been coded, you may either need to go in to all of them and reconfigure them to work with a kill tracking board. The main key here is to determine when a player has been killed by another and to log that.
One way of converting this system into something else is by the use of an associative array in a ModuleScript. You can cache humanoids and the names of users who damaged them, while making those notes decay after some time (using delay with a certain interval, set indice to nil). This would of course need any damage code of yours in your game to be configured to register hits and add them into the ModuleScript.
There’s definitely other ways out there, but I haven’t really looked them up or experimented with them. Case in point; if you don’t have a centralised damage system that you can edit, you will have to go into all those tools and perform the daunting task of making them work with your kill tracker.