local function K(K,q)local H=K.CFrame local r=CFrame.fromOrientation(0,(q.Orientation.Y*math.pi)/180,0)*q.Size local G=H:Inverse()*q.CFrame local U=K.Size.X-r.X local v=K.Size.Z-r.Z return G.X>U or G.X<-U or G.Z>v or G.Z<-v end local function q(K,q,H,r)if not H then q.PrimaryPart.Transparency=1 return true end local G=CheckHitbox(K,q,r)if G then q:Destroy()return false end q.PrimaryPart.Transparency=1 return true end
--Checks if the object exceeds the boundries given by the plot----------
local function CheckBoundaries(Plot, Primary)
	local Position = Plot.CFrame
	local Size = CFrame.fromOrientation(0, Primary.Orientation.Y * math.pi / 180, 0) * Primary.Size
	local CurrentPos = Position:Inverse() * Primary.CFrame

	local xBound = (Plot.Size.X - Size.X)
	local zBound = (Plot.Size.Z - Size.Z)

	return CurrentPos.X > xBound or CurrentPos.X < -xBound or CurrentPos.Z > zBound or CurrentPos.Z < -zBound
end

local function HandleCollisions(Character, Item, Collisions, Plot)
	if not Collisions then
		Item.PrimaryPart.Transparency = 1
		return true
	end

	local Collision = CheckHitbox(Character, Item, Plot)
	if Collision then
		Item:Destroy()
		return false
	end

	Item.PrimaryPart.Transparency = 1
	return true
end
