local X repeat wait()until script.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")X=script.Parent local N=X:WaitForChild("\072\117\109\097\110\111\105\100")local K=X:WaitForChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")local V=require(script.Values)local function f(X)local N local K N=X-V.MinimumFallDamageStuds if N>=0 then K=X*V.DamageMultiplication+10 else K=0 end return K end N.StateChanged:Connect(function(X,q)local s local A if q==Enum.HumanoidStateType.Landed then V.DontUpdateYet=true s=(V.LastStandingPos-K.Position).magnitude A=f(s)if A>0 then N.Health=N.Health-A script.DamageSound:Play()end V.DontUpdateYet=false end end)
-- 2xy0x
local Character

repeat
	wait()
until script.Parent:FindFirstChild("Humanoid")

Character = script.Parent

local Humanoid = Character:WaitForChild("Humanoid")
local HRP = Character:WaitForChild("HumanoidRootPart")
local Values = require(script.Values)

local function CalculateDamage(Magnitude)
	-- Calculates the amount of damage the player will take from the fall.
	local afterminus100
	local totaldamage
	afterminus100 = Magnitude - Values.MinimumFallDamageStuds
	if afterminus100 >= 0 then
		totaldamage = Magnitude * Values.DamageMultiplication + 10
	else
		totaldamage = 0
	end

	return totaldamage
end

Humanoid.StateChanged:Connect(function(oldstate, newstate)
	local magnitude
	local total
	if newstate == Enum.HumanoidStateType.Landed then -- Tells when the player landed
		--print('landed')
		Values.DontUpdateYet = true
		magnitude = (Values.LastStandingPos - HRP.Position).magnitude -- measures the y position of where they fell from, and the Y position they have after they touched the ground.

		total = CalculateDamage(magnitude)

		-- Here, the script checks if the total is greater than 0. If it is, then it damages the player and plays the sound.
		if total > 0 then
			Humanoid.Health = Humanoid.Health - total
			script.DamageSound:Play()
		end

		Values.DontUpdateYet = false
	end
end)
