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

The folder is cloning itself in the torso and not the children?

Asked by 5 years ago

The title explains everything, the folder clones in the torso, and not the children inside the folder. Can anyone help?

local repstorage = game:GetService("ReplicatedStorage")
local eventfolder = repstorage:WaitForChild("RemoteEvents")
local chargeevent = eventfolder:WaitForChild("Charge")
local particlefolder = repstorage:WaitForChild("ChargeParticles")
local normalcharge = particlefolder:GetChildren()
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://2405207143"
local chargeend = eventfolder:WaitForChild("ChargeEnd")
chargeevent.OnServerEvent:Connect(function(player)
    local animation1 = player.Character.Humanoid:LoadAnimation(animation)
    animation1:Play()
    for _, v in pairs(normalcharge) do
        v:Clone().Parent = player.Character:WaitForChild("UpperTorso")
    end
    chargeend.OnServerEvent:Connect(function(player)
        local chargeinplayer = player.Character.UpperTorso:GetChildren()
        animation1:Stop()
        for _, v in pairs(chargeinplayer) do
            if v.Name == "NormalCharge" then
                v:Remove()
            end
        end
    end)
end)
0
this might not fix it but use a variable for the clone and set the parent on a separate line radusavin366 617 — 5y
0
what im trying to do is clone the children inside the folder and only the children in the folder not the folder itself, but what i forgot to add in the title, it clones the folder and the children, and clones the entire folder including the children, which is the particles, and what im trying to do is clone the children not the folder *and* the children supercoolboy8804 114 — 5y
0
Then you need clone each child separately, you can use the GetChildren function to get a table of them. gullet 471 — 5y
0
all you need is a statement like if not v:IsA("Folder") then v:Clone() Vulkarin 581 — 5y
View all comments (3 more)
1
i figured it out, i forgot i had two folders named, charge particles and normal charge, and line 5 was getting the children for charge particles, and the only child of that was normal charge, which is a folder supercoolboy8804 114 — 5y
0
hey, easy fix... why read all those unhelpful comments... use GetDescendants() instead of GetChildren() greatneil80 2647 — 5y
0
when your "easy fix" isn't related to the problem at all Vulkarin 581 — 5y

Answer this question