Help with placing objects with a script

Hi,

I was wondering how you would go about getting the end location of a model. I need this coordinate to place another part at the end of this model.

Also, how would you do the exact opposite? How would you place a model at the end location of a part?

Any information is helpful!

Thank You

1 Like

I don’t fully understand your question. I think this is what you mean. Solution: In Roblox Studio go to View and press Properties tab, then click on the part you wanted and go to the properties tab you opened and find Position. You need to then experiment which of those 3 number’s is the coordinate for putting an object next to it. Then insert a part and put the correct position in there using the 1st model’s position.

You achieve this by doing model:GetModelSize() and divide whatever axis you want to duplicate it from by 2, and then do model.PrimaryPart.Position = devidedNumber. I believe this works if you weld constraint everything in the model to a middle man part / hit box in the model

Edit: to get an axis, you do position[axis] --x, y, or z but with a dot and without brackets unless the axis is a variable, then you’ll want to put it in there as a string

@RefusalMan, @DeveloperCoolBoi
I am trying to create a script that can place a model after another model. This is a random model that will be chosen from a folder. It needs to be placed directly after the previous modelstrong text

local count = 1
local items = script:GetChildren()
local last = nil

local Model = items

-- setting random primary part for the model
for i=1, #Model do 
	if Model[i]:IsA("Model")  then

		ModleContain = Model[i]:GetDescendants()
		if #ModleContain >0 then
			for _,v in pairs(ModleContain) do
				if v:IsA("BasePart") then
					Model[i].PrimaryPart = v
				end 
			end

		end
	end
end

-- placing models
while count < 11 do

	if count == 1 then

		local thing = items[math.random(1, #items)]
		thing.Parent = workspace
		thing:SetPrimaryPartCFrame(CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0))
		count = count + 1
		last = thing

	else
		
		local thing = items[math.random(1, #items)]
		thing.Parent = workspace


		--what do I do here


		count = count + 1
		last = thing
		
		
		
	end
end