GetPartsInPart() not detecting characters that havent moved

Is it something to do with the extra check?
try printing this:

    print(hit.Parent, "  ", hit.Parent:FindFirstChild("Humanoid"), "  ", table:find(debounce), "  ", table.find(hit.Parent))  
    -- Above line may need to be changed to get the actual items, maybe try Humanoid.Name or something similar
	if hit.Parent and hit.Parent:FindFirstChild("Humanoid") and not table.find(debounce, hit.Parent) then

Maybe you can try using getpartsboundsinbox? Just a wild guess.

1 Like

No I’ve tried it without the check and it still doesn’t detect for some reason

But if you troubleshoot with the print I suggested you can see what causes the if check to fail and go from there.

So I’ve played around with it more and I got curious to see what would happen if it didn’t have any checks and surprisingly didn’t print anything. I’m genuinely so confused.

1 Like

local detection = workspace:GetPartsInPart(hitbox, paramas)
Is hitbox a direct child of the workspace?

hitbox is in a folder in the workspace called Debris

The hierarchy is workspace.Debris

you should task.spawn the wait so that you dont slow down the loop. Because its causing the loop to wait for .1 seconds and each frame is done in milliseconds, then the wait wont be finished, and no parts is looped in

The thing is even without the wait it doesn’t print anything out. Its like nothing is touching it.

ok so try printing detection, and you dont really need to check if hit.Parent exists because there will always be a parent. Tell us what you see because i dont really understand whats not hapenning

1 Like

I’ve realized that awhile ago and removed it but it isn’t detecting anything.

You might be using include over exclude for the OverlapParams. Also remove the task.wait(), it’s not good to yield Heartbeat frames like that, just use an os.clock() debounce.

local lastTime = 0
rs.Heartbeat:Connect(function()
     local timeNow = os.clock()
     if timeNow < lastTime then return end; lastTime = timeNow + 0.1

    -- code
end)

Try printing the table detection. Try ipairs or nothing over pairs because the latter is meant for Dictionary not array and while it might work it can lead to inconsistent results.

-- use this over ipairs and pairs
for _, hit in detection do

end

Make sure the hitbox has CanQuery to true, disable CanTouch just to see what happens.
image

1 Like

I’ll try this out! I will tell you how it works out!

I forgotten to mention that the hitbox.Anchored = false and connected by a WeldConstraint

bump im still trying to find out why it isnt working

Like the other guy said is canquery set to true?

1 Like

I’m not too familiar with it, but doesn’t this line only look for hitbox directly in the workspace, not in a subfolder? Shouldn’t you reference the folder like this:
local detection = workspace.Debris:GetPartsInPart(hitbox, paramas)

Oh I found the reason why it wasn’t the detection working. My animation was offsetting the torso and wasn’t replicating on the client so the hitbox was missing the character. It sounds weird but here’s a image of it.

On client:
image

On server:
image

Anyways thanks for everyone who tried helping me out! Have a good day!

2 Likes

Nah you don’t need to do that because one of the parameters are the basepart, and you can only do this through workspace/worldroot directly.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.