Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to find all trails in a group?

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)

3 comments

0

you can use a for loop for this

0

What would I loop?

0

Well I am not sure really how to start at all..

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.