How to give players kill reward depends on how much damage they have deal

I think title describes what I want to achive but something like if the player deals %10 of the npcs hp or more damage they can get reward.
I made an value that records how much damage player deal but I am having troubles how to retrive this value

local module = {}

function module.PlayerDamagesHumanoid(player, humanoid,damage)
	
	local DamageRecord = humanoid:FindFirstChild(player.Name)
	if DamageRecord==nil then
		DamageRecord = Instance.new("IntValue")
		DamageRecord.Name = player.Name
		DamageRecord.Parent = humanoid
	end
	DamageRecord.Value = DamageRecord.Value + damage
	return humanoid:TakeDamage(damage)
end

local players= game:GetService("Players")

local function sortfunc(a,b) return a.damage< b.damage end


function module.RetriveDamageRecords(humanoid)
	local playersandDamage = {}
	
	for i,v in ipairs(humanoid:GetChildren()) do
			local playerName = v.Name
			local playerDamage = v.Value
			
			local player = players:FindFirstChild(playerName)	
			
			table.insert(playersandDamage,{player = player, damage = playerDamage})
			
		end
		table.sort(playersandDamage, sortfunc)
	return playersandDamage
end
return module

A server script to Humanoid.dead

local Npc = script.Parent
local NPCHumanoid = Npc:WaitForChild("Humanoid")
if NPCHumanoid then -- Checks Humanoid
	NPCHumanoid.Died:Connect(function()
		module.RetrieveDamageRecords(NPCHumanoid) -- it gives the error here
		print("a Humanoid is dead")
		print(module.RetriveDamageRecords())
		
	end)
end

for more details: recording the damage part works fine
and this is the error I got