Part Pivot Point not working properly when resizing with script tweens

Hi everyone,

I’m having an issue with resizing a part in my ROBLOX game using TweenService. I want to resize the part from the bottom up, but when I resize it, its anchor point doesn’t seem to work properly, and the part starts resizing from the top down instead.

  1. What do you want to achieve?

I want to resize a part from the bottom up, so that it appears to grow out of the ground.

  1. What is the issue? Include screenshots / videos if possible!
    The anchor point of the part doesn’t seem to be working properly when I resize it. The part starts resizing from the top down instead of the bottom up.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I tried using :PivotTo() with its old pivot before/after resizing it, but it didn’t seem to make a difference.

Here is the code that I’m using to resize the part:

function sizeAnimation(mainParent, tweenTime, sizeMulti, reverse)
	local tweens = {}

	if mainParent:IsA("BasePart")then 

		local tweenInfo = TweenInfo.new(tweenTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
		local tweenProperties = {Size = not reverse and mainParent.Size * sizeMulti or Vector3.new(0, 0, 0)} 
		local tween = TweenService:Create(mainParent, tweenInfo, tweenProperties)
		if not reverse then
			mainParent.Size = Vector3.new(0, 0, 0)
		end
		table.insert(tweens, tween)
	end

	for i, child in ipairs(mainParent:GetDescendants()) do
		if child:IsA("BasePart") then


			local tweenInfo = TweenInfo.new(tweenTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
			local tweenProperties = {Size = not reverse and child.Size * sizeMulti or Vector3.new(0, 0, 0)} 
			local tween = TweenService:Create(child, tweenInfo, tweenProperties)

			if not reverse then
				child.Size = Vector3.new(0, 0, 0)
			end

			table.insert(tweens, tween)
		end
	end

	for i, v in tweens do
		v:Play()

	end

end```

Find out the ending Vector3 of those parts on their Y axis (or on any other axis for that matter depending on if it has any diagonal movement), find out how far they would move if you were to simply have them be that large in the first place. Once you have done that you can tween the parts positions as well in order for it to look like it is “staying in place”.

1 Like