How do i make this count as a + 1 in leaderstats

hello, i am trying to make it so when a player is killed like in this code:
the player who killed the other player gets a + in the leaderstats
how can i do this?
i need to locate the leaderstats and do a +1

			humanoid.Died:connect(function()
				script.Parent.Parent.Attack1.Enabled = false
				script.Parent.Parent.Attack2.Enabled = false
				script.Parent.Parent.Attack3.Enabled = false
				script.Parent.Parent.Attack4.Enabled = false
				local finish = script.Parent.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Parent.Anims.Finish1)
				finish:Play()
wait(3)
				script.Parent.Parent.Attack1.Enabled = true
			end)

In the damage function of your weapon check if the current humanoid health - damage is less than or equal to 0 if it is add a kill yo their leaderstats by doing leaderstats.Kills.Value += 1 which is the same as doing leaderstats.Kills.Value = leaderstats.Kills.Value + 1

1 Like

i already know how to do the + stats but… the only thing i need to know is how to locate the leaderstats so i can actually do the + is its like Game.Players.LocalPlayer or smth?
i just dont get it wich is stupid cuz i can do many other things

you can get the character from the weapon’s script and at the damaging function you can check if the target’s health is 0 then you can + 1 in leaderstats
u can get the player from character by using game.Players:GetPlayerFromCharacter() and locate leaderstats from there

1 Like

Ok nice let me try that thanks for helping :smiley:

so imagine the leaderstats is in the player and then “leaderstats.Kills” how do i locate this with that

nobody responding :confused: thats weird?

sorry lol I haven’t check devforum since then
anyways, you can locate that by just WaitForChild or FindFirstChild

local leaderstats = player:FindFirstChild('leaderstats')
leaderstats.Kills.Value += 1 
--blah blah blah
2 Likes

ty :DDDDDDDDD (30 letters)))!!!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.