Kills Value not adding in Kills Leaderstats

my kill value isn’t rising if i kill NPC
can someone help me what i have to do to raise kills value?


here is the script:

local hum = script.Parent.Humanoid

hum.Died:Connect(function()
local tag = hum:FindFirstChild(“creator”)
if tag then
local player = tag.Value
local kills = player.leaderstats.Kills
kills.Value = kills.Value + 1
end
end)

What type of value is “creator” , any error in the script ? Also try debugging it by adding some prints Inside if conditions , like :

local hum = script.Parent.Humanoid

hum.Died:Connect(function()
  local tag = hum:FindFirstChild(“creator”)
  if tag then
   print("Tag is not nil")
   local player = tag.Value
   local kills = player.leaderstats.Kills
   kills.Value = kills.Value + 1
 end
end)
1 Like

okay ill try it but it should be in serverscriptservice right?

Yes it should be in server script , since Local Scripts doesn’t run in workspace and value should be changed via Server and not client.

still doing nothing :confused:

Did it print , do you have your output open?

i have it open yes lemme tell you vhat it says brb

11:46:47.250 Gun Skill Testing (Adding more guns soon!!) @ 03 feb 2021 11:46 auto-recovery file was created - Studio - C:/Users/Uzivatel/Documents/ROBLOX/AutoSaves
11:46:47.960 Humanoid is not a valid member of ServerScriptService “ServerScriptService” - Server - KillCredit:1
11:46:47.961 Stack Begin - Studio
11:46:47.961 Script ‘ServerScriptService.KillCredit’, Line 1 - Studio - KillCredit:1
11:46:47.961 Stack End - Studio
11:46:48.486 :arrow_forward: Failed to load sound rbxasset://sounds/swoosh.wav: Unable to download sound data (x14) - Studio

Where is the script located at ?
The line : local hum = script.Parent.Humanoid is erroring , make sure its inside the Character , if it is inside the Character try using WaitForChild.

ok ill try it ill tell you if it worked after

Where am i supposed to put WaitForChild? sorry im not best at scripting

Where is your script located , Inside the Character?
Also this is how you use WaitForChild
local hum = script.Parent:WaitForChild("Humanoid")

oh ok thanks ill try it ()()()()()()()

says this 11:52:08.224 :arrow_forward: Failed to load sound rbxasset://sounds/swoosh.wav: Unable to download sound data (x6) - Studio
11:52:10.904 Banner_Dev applied edits to script KillCredit - Studio
11:52:11.417 :arrow_forward: Failed to load sound rbxasset://sounds/swoosh.wav: Unable to download sound data (x6) - Studio
11:52:13.918 Infinite yield possible on ‘ServerScriptService:WaitForChild(“Humanoid”)’ - Studio
11:52:13.918 Stack Begin - Studio
11:52:13.919 Script ‘ServerScriptService.KillCredit’, Line 1 - Studio - KillCredit:1
11:52:13.919 Stack End - Studio

Please answer my questions else It won’t be possible for me to help you, from the errors I found that your script is Inside ServerScriptService , move it into the Dummy’s Model.

1 Like

Screenshot_5

From your error it says that you are doing
script:WaitForChild("Humanoid")
Just do script.Parent.Humanoid Since you placed it inside the character

1 Like


Did you add it to all the Dummies ? If no add it to all the Dummies or use a loop.

Do this :

local hum = script.Parent.Humanoid

hum.Died:Connect(function()
  print("Died")
  local tag = hum:FindFirstChild(“creator”)
  if tag then
   print("Tag is not nil")
   local player = tag.Value
   local kills = player.leaderstats.Kills
   kills.Value = kills.Value + 1
 end
end)
1 Like

Can you try to kill a dummy, see what prints out?

1 Like