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.
- 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.
-
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.
- 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```