# How would i detect if a item/part is on a plot?

Im working on a plot/placement system, And to stop exploiters from placing items anywhere i wanna detect if the item is on the plot.

You can see if the item’s position is within the plot range

Yea how exactly would i do that

See if this helps:

You can either check its Childrens by using YourModel:GetChildren() or you can just use the wood’s solution.

Well it doesnt matter where the parent of the item is, Im talking about the position.

Can you explain correctly what your trying to achieve? You might want to save the Positions?

So in a placement system you place a item the item is placed in the position which is determined from the client (in my situation) which means they can set the position anywhere i am trying to only allow them to set the position on their plot.

You can use spatial queries to determine if a part’s entire hitbox is within the plot’s allowed zone

Is there a part like rectangle that is the zone? If so then you can just tell whether the point you provide is in the rectangle.

Assuming no rotation to the parts this should work for balls and blocks.

``````function isInPart(part,posVec)
if part.Shape == Enum.PartType.Block then
local xDist = math.abs(posVec.X-part.Position.X)
local yDist = math.abs(posVec.Y-part.Position.Y)
local zDist = math.abs(posVec.Z-part.Position.Z)
if xDist <= part.Size.X/2 and yDist <= part.Size.Y/2 and zDist <= part.Size.Z/2 then
return true
else
return false
end
elseif part.Shape == Enum.PartType.Ball then
if (part.Position-posVec).Magnitude <= (part.Size.X/2) then
return true
else
return false
end
end
--elseif part.Shape == Enum.PartType.Cylinder then -- Commented because this only works if the cylinder is up right
--local horizontalDist = Vector2.new(part.Position.X-posVec.X,part.Position.Z-posVec.Z).Magnitude
--local yDist = math.abs(posVec.Y-part.Position.Y)
--if yDist <= part.Size.Y/2 and horizontalDist <= part.Size.X then
--return true
--else
--return false
--end
--end
end
``````