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

How to find all trails in a group?

Asked by 3 years ago

I am trying to get all the trails from my StarterCharacter which has trails in most parts of it's body. Is there a faster way to do this or will I have to go 1 by 1 saying game.Players.LocalPlayer.Character.LeftHand.Trail game.Players.LocalPlayer.Character.RightHand.Trail and so on...

(Sorry if I didn't explain this correctly)

0
you can use a for loop for this JesseSong 3916 — 3y
0
What would I loop? xd_Lxcifer -3 — 3y
0
Well I am not sure really how to start at all.. xd_Lxcifer -3 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Like Jesse said, you can use a for loop.

for index, value in ipairs(game.Players.LocalPlayer.Character:GetChildren()) -- loops thorugh all the children of the character. value are all the different childrens of the character
       if value:FindFirstChildWhichIsA("Trail) then -- checks if value has a trail.
             -- your code here. For example if you want to change the name of all the trails
        -- value.Trail.Name == "Trail"
        end
end
Ad

Answer this question