Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What's the cheapest and quickest way to find if a humanoid is within a zone?

Asked by 5 years ago

I've experimented with many ways to see if a humanoid is within a damage zone of a gas trap script, the best way so far is having physical part, to then change the size from (0,0,0) to (20,20,20) and then back to (0,0,0) and connect the part to a touched event to see if it has touched a part called "HumanoidRootPart", but I found that this does not always hit therefore unreliable.

I heard about FindPartsInRegion3, but the source code behind it looks very expensive.

Should I use this method or is there another way to check if a humanoid is within a region?

0
magnitude DeceptiveCaster 3761 — 5y

1 answer

Log in to vote
1
Answered by
Fifkee 2017 Community Moderator Moderation Voter
5 years ago

Region3 is probably your best bet for this one. A .magnitude loop wouldn't be too good on the server without heavy optimization.

https://developer.roblox.com/api-reference/datatype/Region3

Ad

Answer this question