GetPartsInPart not detecting player when ragdolled

I’m trying to make a hitbox work to detect a player’s character using workspace:GetPartsInPart() but sometimes when the player is ragdolled, it doesn’t detect anything.

I’ve tried making the overlap params brute force all slow true.

Since I use Enum.RaycastFilterType.Include, I include all the humanoid root parts in the overlapparams’ Filter Descendants Instances.

I’ve tried not using inclusion but instead get all the parts in the hitbox and see if it is an enemy (finding humanoid under the parent of the detected part) and it still doesn’t detect any parts from the other player.

I’ve tried turning off ragdoll after the slam ability but I need the ragdoll, so that’s not an option for me.

I’ve checked the player’s position and it never leaves the area of the hitbox.

Here is a video of the problem:

The red box is the hitbox of the choke ability.

Here is my code:


local overlapParams = OverlapParams.new()
overlapParams.FilterType = Enum.RaycastFilterType.Include
overlapParams.BruteForceAllSlow = true

local roots = LightSaberMod.GetRoots() -- gets all humanoid root parts 

for i, rootpart in pairs(roots) do
	if rootpart.Parent.Name == character.Name then
		table.remove(roots,i)
		break
	end
end

overlapParams.FilterDescendantsInstances = roots


local PartsInPart = workspace:GetPartsInPart(HitboxPart,overlapParams)

-- PartsInPart is empty when the player I am trying to detect is ragdolled
for _, part in pairs(PartsInPart) do
	print(part)
end

Can anyone help me?

Make a hitbox around the player (make it fit the exact size of the player) and make it so even when the player is ragdolled the hitbox stays upright. Make the GetPartsInPart get the parts inside the player hitbox (or the saber and check for the player hitbox)

1 Like

Nevermind, the code was fine, I just accidentally put the offsetted hitbox a few studs off the ground so sometimes when the ragdoll is lying flat, it doesn’t touch the hitbox.

Thanks for the help though.