New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

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

Asked by
TtuNkK 17
8 days ago

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

Log in to vote
0
Answered by 8 days ago

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.

0
Do I just change the scalefactor to that? TtuNkK 17 — 8d
0
Didn't work rip TtuNkK 17 — 8d
Ad

Answer this question