GetBoundingBox not working?

So I was trying to create a hitbox around a custom npc (for whatever reason) in a project, but GetBoundingBox is not working the way I’m expecting it.

Issue: The part created with the values GetBoundingBox returns is innaccurate to the model’s actual size. I doubt this is a bug because usually when something doesn’t work for me I’m just bad at using it.

The NPC:


Said character’s hitbox looks normal in studio (is a model)

My code:

local hitbox = Instance.new("Part", person)
			hitbox.Transparency = 1
			local cf : CFrame, size : Vector3 = person:GetBoundingBox()
			hitbox.CFrame = cf
			hitbox.Size = size
			hitbox.Anchored = true
			hitbox.CanCollide = false
			print(cf.Position)
			print(size)
			
			
			
			-- Weld --
			local newWeld = Instance.new("WeldConstraint", person)
			newWeld.Part0 = person.Torso
			newWeld.Part1 = hitbox

In this scenario, “person” is the model in question: shown in picture 1, and said model’s torso is the character’s main body, as shown in picture 1.

End result after running code:

The hitbox created with the code far overlaps the actual character. I’m trying to figure out how I can fix this. Any help would be appreciated. Thanks for reading.

1 Like

sorry for bad indentation, it’s hard for me to use devforum’s code displayer thing

Are you sure there isn’t another part left in the model from cloning/moving it?
It does look like the bounding box is expanded to try and capture something way outside.

I’m sorry, could you repeat that? I can’t understand.

Look through all of the children of “person” to make sure there isn’t a part in there that doesn’t belong.