player.CharacterAdded:Connect(function(character)
local humanoid = character:FindFirstChild("Humanoid")
humanoid.Died:Connect(function(died)
deaths.Value += 1
local tag = humanoid:FindFirstChild("creator")
local killer = tag.Value
if tag and killer then
killer.leaderstats:FindFirstChild("Kills").Value += 1
end
end)
end)
end)

the error is from this part
local killer = tag.Value
this only happens when i kill them with my combat system but if i use a sword from the toolbox it works just fine?
Check if there is some specific value in that toolbox model, maybe?
yeah i thought that could be it but i looked and there was nothing with “creator” or some kind of hint towards this
To get rid of the error:
player.CharacterAdded:Connect(function(character)
local humanoid = character:FindFirstChild("Humanoid")
humanoid.Died:Connect(function(died)
deaths.Value += 1
local tag = humanoid:FindFirstChild("creator")
if not tag then return end
local killer = tag.Value
if tag then
killer.leaderstats:FindFirstChild("Kills").Value += 1
end
end)
end)
end)
Now, in your combat system, are you adding that creator tag?
1 Like
omg bruh why didnt i even think to do that
1 Like