GetBoundingBox() function returning impossible number

I’m working on a random part placement system for my Backrooms game and recently got it working with simple models consisting of 1 part each. I decided to test it with one of the completed parts that it was created to work with and the GetBoundingBox() function in it to get the model’s dimensions returns a number far larger than the model. The model hierarchy looks like this:


The circled part is the PrimaryPart of the model. The box has rough dimensions of 3.5, 3.5, 3.5 but the script returns 94.67294311523438, 7.170000076293945, 24.85433006286621. The code where the dimensions are gotten is boxFrame, boxSize = place:GetBoundingBox() and the number with the massive value is boxSize. How do I fix this?

1 Like

There’s not really enough information to go off of. Can you send the code sample? Not just the line.

1 Like
boxFrame, boxSize = place:GetBoundingBox() -- Get the part's bounding box location and size
			local exclude = OverlapParams.new()
			exclude.FilterDescendantsInstances = {v, place:GetChildren()}
			repeat
				testPos = CFrame.new(math.random(minX, maxX), place.PrimaryPart.Size.Y / 2 + v.Size.Y / 2, math.random(minZ, maxZ))
				print(boxSize)
				print(workspace:GetPartBoundsInBox(testPos, boxSize))
				task.wait()				
			until #workspace:GetPartBoundsInBox(testPos, boxSize, exclude) == 0
			place:PivotTo(testPos)

Place is the model being placed in a random position.

1 Like