Would this be consistent?

Everyone who makes a fall damage script seems to make it really complicated and do all kinds of stuff
But this thing I just made seems to work just fine?

--damages you when you fall (duh)



script.Parent.Humanoid.FreeFalling:Connect(function()
	
	--when the player is freefalling, immediatelly save their height
	local height = script.Parent.HumanoidRootPart.Position.Y
	
	--wait until they have stopped falling
	while wait() do
		local state = script.Parent.Humanoid:GetState()
		if state ~= Enum.HumanoidStateType.Freefall then
			break
		end
	end
	local newPos = script.Parent.HumanoidRootPart.Position.Y
	
	local damage = height - newPos
	
	if damage >= 25 then
		script.Parent.Humanoid:TakeDamage(damage)
	end
	
	
	
end)

Would this be consistent? Does it have issues? Or is this just totally fine?

It seems fine. The only problem, I believe, is that it only takes the starting position into account; nothing in between.

An image to help you visualize this:
image

y represents height in the image.

I wouldn’t recommend using a while wait() there, instead go for an event approach.

local humanoidStateChangedConn

humanoidStateChangedConn  = humanoid.StateChanged:Connect(function(oldState, newState)
    --Do your checks here,
    humanoidStateChangedConn:Disconnect()
end)

Also, if you ever do a wait() approach (which I highly do not recommend) make sure you are doing checks if items exist, because you never know what could happen in between.

How should I go about changing this then? Constantly check what the highest Y value reached is during the free fall, and then when they land, use that value as the height?

Theoretically, “damage” could relate to acceleration, so maybe have a system to check velocity before hitting the ground then calculate some damage number from that?

That sounds about right. How it would look with added code:

--damages you when you fall (duh)



script.Parent.Humanoid.FreeFalling:Connect(function()
	
	--when the player is freefalling, immediatelly save their height
	local height = script.Parent.HumanoidRootPart.Position.Y
	
	--wait until they have stopped falling
	while wait() do
		height = math.max(height, script.Parent.HumanoidRootPart.Position.Y)

		local state = script.Parent.Humanoid:GetState()
		if state ~= Enum.HumanoidStateType.Freefall then
			break
		end
	end
	local newPos = script.Parent.HumanoidRootPart.Position.Y
	
	local damage = height - newPos
	
	if damage >= 25 then
		script.Parent.Humanoid:TakeDamage(damage)
	end
	
	
	
end)

Calculating fall damage in this sort of manner is not only overcomplicated, but it’s also inefficient because you’re relying on polling.

@yes35go has the right idea with utilizing the current velocity of the player once they touch the ground in order to calculate the correct fall damage that should be applied.

Also, for anyone whose curious about this, StateChanged is called before hitting the ground I believe, so the velocity will be the falling velocity, which makes doing this calculation pretty simple