How do you put a part on top of another part?

How exactly can I fit it because the size and position of the part is different
image
image

local a = game.Workspace.Partt_ local b = game.Workspace.Partt local c = game.Workspace.Part                        a.Position = Vector3.new(c.Position.X,c.Position.Y+???,c.Position.Z)

(I don’t want to put it with a certain amount of numbers, it must have some logic)

If you position it using Vector3, the engine will move the part up as far until it stops colliding, so if you just set it to the same position as your goal part you should have it at the top.

If that doesn’t work then offset it by half the Y size of your goal part position.

part1.Position = part2.Position + Vector3.new(0, part2.Size.Y/2, 0)
1 Like

The only problem with that is the middle of the second part would be right on top of the first part, so half of it would be inside of the other part. Maybe you could also add half of the other part to look something like this:

part1.Position = part2.Position + Vector3.new(0,(part2.Size.Y/2) + (part1.Size.Y/1),0)

image
This parts’ position and Size is not same example:
Part 1 size = 1,1,1
Part 2 size = 2,2,2
Part 3 size = math.random(1,10),math.random(1,10),math.random(1,10)

this code only working with same Size.Y Parts

I found answer:

What was the answer? You can’t just say you found the answer without sharing! lol

Go to the link I sent and the answer is there