Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I scale a body part in only one direction?

Asked by
TtuNkK 37
4 years ago

I want to make it where an arm is being scaled in one direction, I want it to look like he stretched his arm as if he was made of rubber. I'm using a tween to create that stretching animation, but the problem I'm having is that it would scale in both opposite directions of an axis, which isn't what I want. How do I make it where it only scales in one direction? Thanks

Here's my script:

    game.ReplicatedStorage.Events.gumCharge.OnServerEvent:Connect(function(player)
        local Tween = game:GetService("TweenService")
        local char = player.Character or player.CharacterAdded:Wait()
        local rArm = {ruArm = char:WaitForChild("RightUpperArm"), rlArm = char:WaitForChild("RightLowerArm"), rHand = char:WaitForChild("RightHand")}
        local info = TweenInfo.new(
            2,                        --Length(seconds)
            Enum.EasingStyle.Sine,   
            Enum.EasingDirection.Out,
            0,                        --Times Repeated
            false,                    --Reverse
            .5)                       --Delay (seconds)

        local ruSize = {Size = rArm.ruArm.Size + Vector3.new(0, 10, 0), Position = rArm.ruArm.Position + Vector3.new(0, 5, 0)} 
        local rlSize = {Size = rArm.rlArm.Size + Vector3.new(0, 10, 0), Position = rArm.rlArm.Position + Vector3.new(0, 5, 0)}
        local rSize =  {Size = rArm.rHand.Size + Vector3.new(0, 5, 0), Position =  rArm.rHand.Position + Vector3.new(0, 2.5, 0)}

        local ruTween = Tween:Create(rArm.ruArm, info, ruSize)
        local rlTween = Tween:Create(rArm.rlArm, info, rlSize)
        local rTween = Tween:Create(rArm.rHand, info, rSize)

        ruTween:Play()
        rlTween:Play()
        rTween:Play()
    end)

Answer this question