How do you check if something is blocking an area?

sorry for the bad title

I want to teleport a player to another player – but before I do, I want to check that the CFrame that I’m going to send them to doesn’t have like an anchored, cancollide object blocking it. What is the easiest way to accomplish this?

I’d have a part representing the CFrame you want to send them to and the area it should encompass.
This part would be Anchored, NonCanCollide and Transparent

First, to enable :GetTouchingParts (since this object isn’t cancollide), you’ll need to do create a TouchInterest like so:

TeleportPart.Touched:Connect(function() end)

Whenever you want to send someone there, you first loop through TeleportPart:GetTouchingParts() and do your anchored/collide checks

If it’s all clear, send them to TeleportPart.CFrame

3 Likes

You could also try raycasting but im not sure if thats what he wanted

1 Like