Why does this error keep occuring?

local HBFinder = workspace:GetPartBoundsInBox(Re3.CFrame, Re3.Size, Blacklist)
	Debris:AddItem(Hitbox, 0.3)
	for i, parts in pairs (HBFinder) do
		if parts.Parent:FindFirstChild("Humanoid") and parts.Parent ~= Character then
			local enemyHumanoid = parts.Parent.Humanoid
			local enemyRootPart = parts.Parent.HumanoidRootPart
			
			local SmallDmgVelo = Instance.new("BodyVelocity", enemyRootPart)
			SmallDmgVelo.MaxForce = Vector3.new(6000, 6000, 6000)
			SmallDmgVelo.Name = "SDV"
			SmallDmgVelo.P = 6660
			SmallDmgVelo.Velocity = -enemyRootPart.CFrame.LookVector * 500
			
			

			if Combat_Handler.playersincombat[Character] or DicHandler.find(Player, "Stunned") then
				return
			end
			enemyHumanoid:TakeDamage(BaseDamage)
		

			local duration
			if string.len(sequence) > 4 then
				duration = Length * 2
				Debris:AddItem(SmallDmgVelo, 0.15)
				
			else
				if string.len(sequence) == 4 then
					if enemyRootPart:FindFirstChild("SDV") then
						SmallDmgVelo:Destroy() 
					duration = Length * 3
					local BV = Instance.new("BodyVelocity", enemyRootPart)
					BV.MaxForce = Vector3.new(22500, 22500, 22500)
					BV.P = 33300
					BV.Velocity = -enemyRootPart.CFrame.LookVector * 40
					Debris:AddItem(BV, 0.25)
					wait(Length)
					end
				end
			end
				if not Combat_Handler.playersincombat[parts.Parent] then
					Combat_Handler.playersincombat[parts.Parent] = os.clock()
					Combat_Handler.playerstuntime[parts.Parent] = duration
					DicHandler.add(parts.Parent, "Stunned")

					enemyHumanoid.WalkSpeed = 4
					enemyHumanoid.JumpPower = 0
				else
					Combat_Handler.playersincombat[parts.Parent] = os.clock()
					Combat_Handler.playerstuntime[parts.Parent] = duration

					enemyHumanoid.WalkSpeed = 4
					enemyHumanoid.JumpPower = 0
				
				end
				break
			end
		end
	end
			
			
			

RunService.Heartbeat:Connect(function()
	for _,plr in pairs(AlivePeople:GetChildren()) do
		if Combat_Handler.playersincombat[plr] then
			local currTime = Combat_Handler.playersincombat[plr] --Ownership of the player and setting value.
			local stunTime = Combat_Handler.playerstuntime[plr]
			print(stunTime)
			if os.clock() - currTime <= stunTime then
				Combat_Handler.playersincombat[plr] = nil
				Combat_Handler.playerstuntime[plr] = nil
				
				
				plr.Humanoid.WalkSpeed = 16
				plr.Humanoid.JumpPower = 50
				
				DicHandler.remove(plr, "Stunned")
			end
		end
	end
end)

return Combat_Handler

Currently my error seems to change various different times, then saying things such as the StunTime, but I cannot tell if it’s the final hit, or something else.

Currently it’s trying to compare the stun time via the os.clock/time that will be passing for the person to get taken out of the table.

if os.clock() - currTime <= stunTime then

Is Combat_Handler.playerstuntime[plr] properly defaulted to 0? You could check that stunTime exists prior to the comparison, and if it’s not, set it to 0.

It’s set to the Duration of the Animation * 2. There’s a separate part of the module that handles that if that’s what you need as well.

function Combat_Handler.getAnimation(Humanoid, sequence)
	local Length = 0

	local KeySequence = KeyProvider:GetKeyframeSequenceAsync(Combat_Handler.MeleeAnims[sequence].AnimationId)
	--print("Getting the Sequences and loading em")
	local KeyFrame = KeySequence:GetKeyframes()


	for i=1, #KeyFrame do
		local Time = KeyFrame[i].Time
		if Time > Length  then
			Length = Time

		end
	end
	return Humanoid.Animator:LoadAnimation(Combat_Handler.MeleeAnims[sequence]), Length
end
if string.len(sequence) > 4 then
				duration = Length * 2
				Debris:AddItem(SmallDmgVelo, 0.15)