How to detect if players are not in a certain part

Hello, I want to make a system that detects if there is no player at a certain part. I would like om tutorials, or some examples. Thank you.

Rejoin3 or raycasts would work.

1 Like

I don’t know how to make the part detect if there are no players.
Do I do

if not humanoid then

?

1 Like

I think Raycasting is more of detecting if players hit the part.

You could do something like:

local part = script.Parent

local function onPartTouched(otherPart)
print(part.Name .. " has touched " .. otherPart.Name)
end

part.Touched:Connect(onPartTouched)

to check if the part has been checked and then reverse this onPartTouched will never run if a part has not touched it1

1 Like

I’m wondering how to detect if players are not in the part.

You can use Region3 as @dmksa123 mentioned

You can use Workspace:FindPartsInRegion3 to detect for a player in your area

EDIT: If this worked for you please set it as the solution

1 Like