If player is in radius?

I’m making a script for an enemy NPC and I want to know how to detect if a player is in radius.
Thank you in advance!

You can do this using Magnitude: Vector3 | Roblox Creator Documentation.

Some people also make a invisible hitbox over the NPC, and any player that touches it gets targetted by the npc, kinda a weird way but you can do that if you want to.

4 Likes

There’s an alternate method which is approximately the same but it measures from a different part:
https://developer.roblox.com/en-us/api-reference/function/Player/DistanceFromCharacter