How do I know if a GUI is outside of another GUI?

Greetings, I’m trying to make a Tetris styled inventory like Tarkov or Resident Evil, but the problem is that I don’t know how to detect if an item is outside of the inventory like this:
image

Probably the important part of the code:

	ItemBox.DragStopped:Connect(function()
		Dragging = false
		
		if BoxDraggedOn then
			ItemBox.Position = UDim2.new(0, BoxDraggedOn.AbsolutePosition.X, 0, BoxDraggedOn.AbsolutePosition.Y + 36)
			
		else
			ItemBox.Position = StartBox
			
		end
	end)

I think your looking for this:

I’m guessing it would work, but when I try to do it, I get ReplicatedStorage.Modules.GuiCollisionService:120: attempt to index nil with 'x' when I try to do if GUICollision.isInCore(ItemBox, script.Parent.Inventory) then