Kill Wont go up when you get a kill

Hello, so im trying to make a game my cousin suggested to me, and it has the kill and death script for the leaderstats, when you die, your deaths go up but when you get a kill, it stays at 0.

Heres the script!

game.Players.PlayerAdded:Connect(function(plr)
 

 local stats = Instance.new("Folder")
 stats.Name = "leaderstats"
 stats.Parent = plr
 
 local kills = Instance.new("IntValue")
 kills.Name = "Kills"
 kills.Parent = stats
 
 local deaths = Instance.new("IntValue")
 deaths.Name = "Deaths"
 deaths.Parent = stats
 
 plr.CharacterAdded:connect(function(char)
  
  local humanoid
  
  repeat
   humanoid = char:FindFirstChild("Humanoid")
   wait()
  until humanoid
  
  humanoid.Died:connect(function()
   
   deaths.Value = deaths.Value + 1
   
   local tag = humanoid:FindFirstChild("creator")
   
   if tag then
    
    local killer = tag.Value
    
    if killer then
     
     killer.leaderstats.Kills.Value = killer.leaderstats.Kills.Value + 1

                                end
 
     
                         end
   
                 end)
       
         end)
  
end)

can someone help me fix this issue? thank you! :smiley:

2 Likes

no, the deaths works fine, its the kills that dont work…

Edit: lol

Are you getting any errors from the output tho

uhm, no…im not getting any errors at all.

Oh and it looks like you never changed the tag’s value so the game will consider the value as nil

so, what do i do to fix that??’

edit: ill be back in a little bit i have to eat dinner…

1 Like

Just make it so the tag’s value changes when someone kills you to that killer’s username

ok so, you mean like…add another tag?

No i mean like changing the tag’s value not add another one

im confused but i really shouldnt be… im sorry im just a kid, could u please write it cause im so confused rn…

Ok but just to clarify here is that you need to be at least +13 to post in devforums

Ok but why are you using an alt account to post on devforums what happened to your main?

because i need help, and my main acc isnt old enough… but thats not the point right now.

Anyways im going to sleep so you should find someone else to help you

wow… rude… ok good night…

I would recommend instead of using this inside of the leaderstats script, make a script sort of like this inside of the tool/weapon instead. This can be buggy with self-made tools.

Bro you shouldn’t be on the DevForum if you’re not 13+, it’s against the rules.