How to check if there's a part at vector3?

Read the title

For example :
I have a part at position 0, 5, 0 with size 10, 10, 10. Is there a way to check if there a part at 1, 1, 1? It must return the part at position 0, 5, 0.

You can use GetPartBoundsInBox. You can pass the Vector3 position (giving it as a CFrame), choosing a small size for the box and optional OverlapParams. It will return an array of parts that touched the bounds you specified. It will be empty if no parts are touching it.
If you don’t understand let me know and I’ll give you an example.

2 Likes
local function CheckIfPartInPlace(Position, Size)
    return workspace:GetPartBoundsInBox(CFrame.new(Position), Size)
end

if #CheckIfPartInPlace(Vector3.new(0, 5, 0), Vector3.new(10, 10, 10)) > 0 then
    print("Part in space")
end

https://developer.roblox.com/en-us/api-reference/function/WorldRoot/GetPartBoundsInBox

2 Likes

Thank! I been searching and there are none. But you helped me. Thank to you too @AstraI_YT

1 Like