How to set model location right next to another model?

I’m trying to do something like this but scripted:

2 Likes

If it’s a model, make sure it has a PrimaryPart, and maybe clone a new model, set that PrimaryPart’s CFrame to the previous model’s PrimaryPart’s CFrame LookVector*8.

i dont know how to use lookvector.

CFrame.new(...).RightVector

workspace.Part2.Position += workspace.Part1.CFrame.RightVector * workspace.Part2.Size.X

You multiply part1’s Vector3 value that indicates the direction of a face by the part2’s size; the result is that the part2 is moved to be located next to the part1.

1 Like
function cloneNext(model, offset)
	if model:IsA("Model") then
		if model.PrimaryPart then
			if not offset then offset = 0 end
			local clone = model:Clone()
			clone:SetPrimaryPartCFrame(CFrame.new(clone:GetPrimaryPartCFrame().Position + (clone:GetPrimaryPartCFrame().RightVector * (clone:GetExtentsSize().X + offset))))
			clone.Parent = workspace
		else warn(model.Name.. " needs to have PrimaryPart set!") end
	else warn(model.Name.. " is not a Model; change it to a Model!") end
end
cloneNext(workspace.Model, 0)

Alright I made a function for you; it should be self-explanatory.

1 Like

Just make a for loop making them with vector3 to the right a certain value. Just mess around with it and should get it.