Help with my ragdoll on falling

  1. Admin Fly triggers ragdoll when flying down fast

When using admin commands (like Adonis, I believe), if I fly downwards at high speed**, my ragdoll gets triggered, even though I’m not technically falling I’m just flying. I understand why it happens (the system checks for fall speed), but I don’t know how to detect if I’m flying using an admin command to prevent triggering the ragdoll in this case.


  1. Falling into the void breaks respawn

The second issue is more critical.
If I fall into the void, my character gets ragdolled, but then I can’t respawn.
I checked my main server ragdoll script, but the issue actually seems to come from the LocalScript, which handles the fall detection. It keeps running even after falling into the void, and seems to block the normal death/respawn process.

I kind of understand what’s going on, but I haven’t found a good way to fix it. If anyone has experience dealing with ragdolls and fall detection (especially mixed with admin tools or the void), I’d really appreciate any help also here i’ts my local code that handles the ragdoll falling:

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local hrp = character:WaitForChild("HumanoidRootPart")
local remote = script.Parent:WaitForChild("FallingImpact")
local inAirRemote = script.Parent:WaitForChild("InAir")

local thresholdSpeed = -65
local maxFallSpeed = 0

local falling = false


RunService.Heartbeat:Connect(function()
	if humanoid.Health <= 0 then return end

	local velocityY = hrp.Velocity.Y

	local excludeParts = {}
	for _, part in ipairs(character:GetDescendants()) do
		if part:IsA("BasePart") then
			table.insert(excludeParts, part)
		end
	end


	if velocityY < thresholdSpeed then
		local rayOrigin = hrp.Position
		local rayDirection = Vector3.new(0, -10, 0)
		local rayParams = RaycastParams.new()
		rayParams.FilterDescendantsInstances = {excludeParts, character}
		rayParams.FilterType = Enum.RaycastFilterType.Exclude

		local rayResult = workspace:Raycast(rayOrigin, rayDirection, rayParams)


		if not rayResult then
			maxFallSpeed = math.max(maxFallSpeed, math.abs(velocityY))

			print("[InAir] Activando ragdoll en aire. Velocidad máxima: ", maxFallSpeed)
			inAirRemote:FireServer(maxFallSpeed)

			falling = true
			return
		end


	elseif falling and velocityY > -10 then
		
		local rayOrigin = hrp.Position
		local rayDirection = Vector3.new(0, -3, 0) 
		local rayParams = RaycastParams.new()
		rayParams.FilterDescendantsInstances = {character}
		rayParams.FilterType = Enum.RaycastFilterType.Exclude

		local rayResult = workspace:Raycast(rayOrigin, rayDirection, rayParams)

		if rayResult then
			if maxFallSpeed >= 65 then
				remote:FireServer(maxFallSpeed)
			end
		end

		falling = false
		maxFallSpeed = 0
	end

end)