How to Tween a part's size off the bottom of the part

I want to be able to tween the size of the part from the bottom up, not in both directions simultaneously.

Code:

tool.Equipped:Connect(function(mouse)
	mouse.Button1Down:Connect(function()


		local saberBase = Instance.new("Part")
		saberBase.Parent = hilt
		local weld = Instance.new("WeldConstraint")
		weld.Parent = hilt
		weld.Part0 = hilt
		weld.Part1 = saberBase
		saberBase.Shape = Enum.PartType.Cylinder
		saberBase.Position = hilt.CFrame:PointToWorldSpace(Vector3.new(2, 0, 0))
		saberBase.Orientation = hilt.Orientation
		saberBase.Size = Vector3.new(0.1, 0.1, 0.1)
		saberBase.Transparency = 0
		saberBase.CanCollide = false
		
		local goal = {}
		
		goal.Size = Vector3.new(5, 0.1, 0.1)
		
		local tweenInfo = TweenInfo.new(
			0.5,
			Enum.EasingStyle.Sine,
			Enum.EasingDirection.In,
			0,
			false,
			0
		)
		
		local tween = TS:Create(saberBase, tweenInfo, goal)
		
		tween:Play()
		
	end)
end)
1 Like

You can do it as follows, referring to the post below:

local ts = game:GetService("TweenService")
local part = script.Parent

local increase = 10

local goal = {
	Size = part.Size + Vector3.new(0, increase, 0),
	Position = part.Position + Vector3.new(0, increase / 2, 0)
}
local tween = ts:Create(part, TweenInfo.new(1), goal)

tween:Play()
3 Likes

While not tween the size while also tween the position upwards? It’ll give off the illusion of it growing upwards. Ofcourse you’ll have to time them correctly but I’m sure you can figure that out.

1 Like
local sz = Vector3.new(5,5,5)
local twProperties={Size=sz;CFrame=part.CFrame*CFrame.new(0,-sz.Y/2,0)}

?

1 Like

What does the “?” mean???

This has other issues and that’s why I have my position set to PointToWorldSpace instead of a regular Vector3. I tried to change it up, but 1) I’m not knowledgeable in positioning/transforming in script and 2) I tend to get headaches when going down rabbit holes for this type of stuff.

You are overthinking
If you need it to move down then move it on -Y of size.Y*0.5 you scaled it
By using CFrames

1 Like

I want it to do this:

[----------0----------]
[--------------------0--------------------]

Not this

          [----------0----------]
[--------------------0--------------------]

look what i said above
If you change scale you also must change its cframe

1 Like

What is “sz”, is that the goal size or starting size

Code:

		local saberBase = Instance.new("Part")
		saberBase.Parent = hilt
		local weld = Instance.new("WeldConstraint")
		weld.Parent = hilt
		weld.Part0 = hilt
		weld.Part1 = saberBase
		saberBase.Shape = Enum.PartType.Cylinder
		saberBase.Position = hilt.CFrame:PointToWorldSpace(Vector3.new(2, 0, 0))
		saberBase.Orientation = hilt.Orientation
		saberBase.Size = Vector3.new(0.1, 0.1, 0.1)
		saberBase.Transparency = 0
		saberBase.CanCollide = false
		
		local goal = {}
		
		local sz = Vector3.new(0.1,0.1,0.1)
		local twProperties={Size=sz;CFrame=part.CFrame*CFrame.new(0,-sz.Y/2,0)}

do *0.5 instead of /2
Its better for perfomance
Also wait…Isnt you are using weld?
In this case you must tween its C1 (and use Weld instead of WeldConstraint)

1 Like

Holy crap… The weld is the reason I’ve been having the weird offset issues

1 Like

I don’t understand, the C1 is even weirder. Am I doing this wrong?

Code:

local hilt = script.Parent.Handle
local RS = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local tool = script.Parent
local TS = game:GetService("TweenService")


tool.Equipped:Connect(function(mouse)
	mouse.Button1Down:Connect(function()

		local radius = 0.1

		local saberBase = Instance.new("Part")
		saberBase.Parent = hilt
		local weld = Instance.new("Weld")
		weld.Parent = hilt
		weld.Part0 = hilt
		weld.Part1 = saberBase
		saberBase.Shape = Enum.PartType.Cylinder
		saberBase.Position = hilt.CFrame:PointToWorldSpace(Vector3.new(2, 0, 0))
		saberBase.Orientation = hilt.Orientation
		saberBase.Size = Vector3.new(0.1, 0.1, 0.1)
		saberBase.Transparency = 0
		saberBase.CanCollide = false
		
		local goal = {}
		
		goal.C1 = CFrame.new(hilt.CFrame.X*0.5, hilt.CFrame.Y, hilt.CFrame.Z)
		
		local tweenInfo = TweenInfo.new(
			0.5,
			Enum.EasingStyle.Sine,
			Enum.EasingDirection.In,
			0,
			false,
			0
		)
		
		local tween = TS:Create(weld, tweenInfo, goal)
		
		tween:Play()
		
	end)
end)

You have to weld 2 parts toghether using weld
Configure their offset using C0
And then JUST TWEEN C1 like
local tween = TS:Create(weld,TweenInfo.new(),{C1=CFrame.new()})

1 Like

This only does position though, I need size.

THEN CHANGE SIZE OF A PART WHILE TWEENING C1 BRO WHAT!?
This is such a stuipid questions and spoonfeeding