Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I scale something in one axis in a tween?

I'm trying to tween my arm. I want to scale it by its y-axis, but this is inside of a table, so I can't set the variable as Size.Y.

local arm = {character.RightHand, character.RightLowerArm, character.RightUpperArm}
local scalefactor = 3

for i,v in pairs(arm) do
	local pos = v.Position
	local offset = pos - dialationCentre
	offset = offset * scalefactor
		
	local Goals =
	{
	Position = dialationCentre + offset;
	Size.Y = v.Size.Y * scalefactor
	}
	local gomuTween = Tween:Create(v, info, Goals)
	gomuTween:Play()
end

I'm doing some dialation thing, so that way the arm scales correctly. The scalefactor is how much the part of the arm will scale in the y axis, but it will scale in all axis if I have it to only Size = Size.v * scalefactor. How can I make it where it only scales in the y axis, but still have the variable as "Size"?

1 answer

You can multiply it by scaling vector. Using a single part as an example...

local arm = character.RightUpperArm
-- This will scale the X axis by 1, Y by 3, and Z by 1
-- This means that X and Z will stay the same while Y increases by a factor of 3
local scale = Vector3.new(1,3,1)

local goal = {Size = arm.Size * scale}
local tween = Tween:Create(arm, info, goal)
tween:Play()

This will obviously cause offset issues with colliding parts, but those can be fixed with a bit of tinkering.

Also a small warning, I discovered an engine bug a while ago that happens when you tween the size of welded parts. It prevents the client to client movement replication so it looks like clients are walking in place.

2 comments

0

Do I just change the scalefactor to that?

0

Didn't work rip

This discussion is preserved as it was. New answers, comments, and votes are closed.