Trying to detect collisions against Body Part, help?

Imagine if a player was falling at a great speed and while falling/upon impact hit himself on his head. (Painful to just think about), Now I want to detect how long their bodypart for, which body part and how severe it is.

The way I wanted to calculate this is if the player hits this body part for more than 0.5 seconds, the game chooses by random if it should be a cut or a bruise. Otherwise, if it was longer, it’s definitely a scrape.

Now my code is supposed to print out the info but instead, nothing comes out in output. The code looks as such:

local character = script.Parent 
local humanoid = character:WaitForChild("Humanoid")
local fatality = {
	["Head"] = "Very Fatal",
	["Torso"] = "Fatal",
	["Left Arm"] = "Moderate",
	["Right Arm"] = "Moderate",
	["Left Leg"] = "Not that alright",
	["Right Leg"] = "Not that alright"
}

humanoid.FreeFalling:Connect(function()
	for i, v in pairs(character:GetDescendants()) do
		if v:IsA("BasePart") then
			v.Touched:Connect(function()
				local startCollision = tick()
				v.TouchEnded:Connect(function()
					local endCollision = tick()
					if startCollision and endCollision ~= nil then
						if endCollision - startCollision <= 0.5 then
							local random = math.random(1, 2)
							if random == 1 then -- Cut
								for BP, Severity in pairs(fatality) do
									if v == BP then
										print("Cut, "..v..", "..Severity)
									end
								end
							elseif random == 2 then -- Bruise
								for BP, Severity in pairs(fatality) do
									if v == BP then
										print("Bruise,"..v..", "..Severity)
									end
								end
							end
						elseif endCollision - startCollision >= 0.5 then -- scrape
							for BP, Severity in pairs(fatality) do
								if v == BP then
									print("Scrape, "..v..", "..Severity)
								end
							end
						end
					end
				end)
			end)
		end
	end
end)

How can I fix this issue???

Read this for more information.

I’ve read it but how do I use that to fix my problem? Should I fire it while the current state is freefall and not when freefalling is fired?

bump, i’m not getting any responses to this

You’re comparing the instance to a string, that’s why it doesn’t work

The line where you compare V to BP, you should be comparing v.Name

Alright, I’ll see what i can do.

You could also make the code a lot more cleaner

Like the freefalling event should only be for if you’re freefalling or how long you’re freefalling, whatever you wanna do.

Touched events that only happen once for the specific body parts inside the table.

I’m on phone right now so it’s quite annoying to write code but if you need some help I’ll happily assist you.