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

How to tween children of a part?

Asked by 3 years ago

I am trying to make a part and its children to expand in size when the remote event is fired. When I tweened the parent it wouldnt tween the children so I tried to use a looped search to get the children of the part but it only tweens 1 part. Do I need to individually tween each part?

Code:

local remote = game.ReplicatedStorage.HeavyPunch
local DB = false

remote.OnServerEvent:Connect(function(Plr)

    local PlrDB = {}

    local Char = Plr.Character
    local Hum = Char:WaitForChild("Humanoid")
    local HumRoot = Char.HumanoidRootPart

    local partloc = game.ServerStorage.Classes.UnArmed.HeavyPart
    local Punch = partloc:Clone()

    Punch.Parent = workspace

    Punch.CFrame = HumRoot.CFrame + HumRoot.CFrame.LookVector*1
    Punch.HeavySound:Play()

    for i, v in pairs(Punch:GetChildren()) do

        local TS = game:GetService("TweenService")
        local Info = TweenInfo.new(
            0.5,
            Enum.EasingStyle.Quad,
            Enum.EasingDirection.Out,
            0,
            false,
            0
        )

        local Goals = {
            Size = Punch.Size*5
        }

    local TweenMain = TS:Create(Punch, Info, Goals)

    TweenMain:Play()

        end

end)

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

On line 36, replace Punch with v because v are all the different children of Punch which is what your trying to tween.

local TweenMain = TS:Create(v, Info, Goals)
0
Yeah I already tried this. As I said in the question it only tweens 1 child of the parent not all of them. monsterdanger16 13 — 3y
0
v should have Tween each of the parts. Im not sure what is wrong if this doesn't work JustinWe12 723 — 3y
Ad

Answer this question