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?