How do I get multiple parts to move with the top of another part which is resizing?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I’m trying to get multiple welded parts to stay on top of the plate even when it’s resized

  2. What is the issue? Include screenshots / videos if possible!
    I’m making an lab experiment like game and when the plates are resized the parts welded to it would not stay with the top of the plate and just stay where it already was.


  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried to change the position of the plate but the welded parts still moved with it so it wouldn’t work plus parts on the bottom of it would go into the plate and I couldn’t find any forums talking about this on the Developer hub.

2 Likes

Well I think u can use

position of moving thingy let call it pos1
size of the moving thingy is siz1
size of the plate is siz2
position of the plate is pos2
pos1 = pos2 + vector3.new(0,siz2.y/2 + siz1/2,0)

Thats the formula u can use

I am not mean that for u to script it alone

Changing pos part ontop of another.rbxl (45.5 KB) this is the script

oo sorry i thought u needed help

1 Like

It’s all good I did need help but I ended up solving it myself I used this code

script.Parent.Changed:Connect(function(changedProperty)
	if changedProperty == "Size" then
		script.Parent.Top.WeldConstraint.Enabled = false
		print(script.Parent.CFrame.UpVector)
		script.Parent.Top.Position = script.Parent.Position + script.Parent.CFrame.UpVector * script.Parent.Size.Y/2
		script.Parent.Top.Rotation = script.Parent.Rotation
		script.Parent.Top.WeldConstraint.Enabled = true
	end
end)

Sorry I didn’t post the solution nobody responded in a bit so I thought nobody was ever going to respond

1 Like