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

How do I make i,v loop to findfirstchild()?

so currently what im tryina to is im trying to make it so that i,v loops around ths one folder and then it looks for a string value called 'Armor' but since the string value is a child of v the item inside the folders I cant seem to make it work can anyone help me out?

4 comments

0

Are you needing something like :GetDescendants()?

0

"i, v loop" is not the correct term. It is "generic for loop".

0

using i, v for the index and value is merely convention.

0

incapaxian is right.

2 answers

I will go ahead and assume you're looking for something like:

local folder --whatever folder or object you're trying to search. Set this yourself.
local objectName = "Armor" --The name you're looking for.
local object
for i,v in pairs(folder:GetDescendants()) do
	if v.Name == objectName then
		object = v
		break
	end
end

if u put a "true" behind the thing u wanna find it will recurse until u find it, or it had searched all of its descendants(i think) like:

folder:FindFirstChild("stringValue", true)

"stringValue" being a child of a child of "folder"

2 comments

0

oof

0

The first guys is better, thb.

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