so i making a sword game and i want to add a kill leader board i already have a coins one but i do not know how to add a kills one that links to a sword this is a image of my current leader board coding
Just make another value called Kills.
For example:
local Kills = Instance.new("IntValue")
Kills.Name = "Kills"
Kills.Value = 0
Kills.Parent = leaderstats
but then will it link to every one i kill some one it goes on the leaderboard
So you are attempting to create a global leaderboard where everyone’s values are stored?
yes i want like a leaderboad that says for every one there kills
Simple, create an ordered data store. Save everyone’s kill values and update the leaderboard from time to time using a loop. This will show everyone’s kill values even if they aren’t in the game.
how do i do that sorry i dont realy understand a lot of coding
I’m sure there are plenty of tutorials on how to accomplish this, just follow the steps they provide.
i tryed a tutorial but when i used the script it didnt come on the leader stats thats why i came to dev forum to ask for help
Then go to another tutorial or you can learn a lot from a free model. You may not ask scripts.
ok thank you a lot i will watch it
wait no i dont want a golbal leaderbord i mean
i want like a normal leaderbord thats in game and show the ammount of kill for each person in the server not for every one
--In a script on the server somewhere...
--Connect a function that will run when a player joins,
game.Players.PlayerAdded:Connect(function(player) --player is defined
--Create a folder to hold the leaderstats
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
--Create a value object to hold the cash
local cash= Instance.new("IntValue")
cash.Name = "Cash"
cash.Parent = leaderstats
--Create a value object to hold the kills
local kills = Instance.new("IntValue")
kills.Name = "Kills"
kills.Parent = leaderstats
--End off event
end)
Will add both cash & kills to your leaderstats. (Assuming you don’t mean a global leaderboard)
If you have any questions, don’t hesitate to ask!
thank you a lot i will try the script now
nice thank you so much it works but do you know when i kill some one how will i like it to the leaderstats