How would I make a region that detects players in it?

  1. What do you want to achieve? I want to make a region that can detect a humanoid/player inside it.

  2. What is the issue? I am really confused on how to do it, as I am currently following a tutorial on Region3 which uses deprecated methods, and I dont want that. Is there an easy way to make it happen?

  3. What solutions have you tried so far? Tutorials on YouTube dont seem to work, and I looked around in the Devforum as well. Please forgive me if I have done something wrong, I am relatively new to scripting. :slight_smile:

5 Likes

try using the :GetPartsInPart function, i don’t know if its deprecated or not though as i haven’t used it

2 Likes

I suggest looking through workspace:GetPartBoundsInBox()

3 Likes

alright, but how would i do that?

1 Like

I wish not to spoonfeed but here’s an example:

local parts = workspace:GetPartBoundsInBox(
    CFrame.new(0, 10, 0), -- the position of the region
    Vector3.new(10, 10, 10), -- size of the region
    nil -- optional 3rd parameter that is similar to RaycastParams (OverlapParams)
) :: {Instance}

for _, part: Instance in ipairs(parts) do
   -- relevant code
end
1 Like

ohh okay thank you! I have understood now :slight_smile:

1 Like

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