Stack two models/parts directly on top of each other

I have two separate parts/models which need to be stacked so there is 0 space between them

pictures of each block:
First block
image
Second block
image

The second block needs to be moved so it is perfectly on top of the first block. Both bases have the exact same dimension so there should be no problem but I don’t know where to start since if I can’t use CFrame for a model
Note: This must be done by script since it will be part of a map selector system.

You can use this script, you will have to name the base of first model as Base and one of the wall of second model as wall

local Model1, Model2 = --your first model, second model

Model2:MoveTo(Model1.Position + Vector3.new(0, Model1.Base.Size.Y/2 + Model2.Wall.Size.Y/2, 0))
1 Like

For clarity, I am moving a model to a part, not a model to a model

okay, try this instead

local Part, Model = --your part and model

Model:MoveTo(Part.Position + Vector3.new(0, Part.Size.Y/2 + Model.Wall.Size.Y/2, 0))
1 Like

Here was my code:

local Part, Model = workspace.tower.BasePart, workspace.Maps.Level1Ex.Walls

	Model:MoveTo(Part.Position + Vector3.new(0, Part.Size.Y/2 + Model.Size.Y/2, 0))

It did not move anywhere and printed the error " Size is not a valid member of Model “Workspace.Maps.Level1Ex.Walls”

You cannot access the size of a model, you will need to access the size of a wall inside the model
replace Model.Size with Model.Wall.Size and it should work fine, make sure you have renamed a wall inside the model as Wall

1 Like

Okay that works now!
image
Thank you! (it is now stacked on top of the black block underneath)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.