Robloxで特定のパーツ配下にある子パーツをスクリプトで取得する
Workspaceにパーツを作成し、名前をParentPartに変更する
そのParentPartの配下にパーツを5個作成、名前をChild{番号}とする

ServerScriptServiceの配下にScriptを作成、名前をFindChildSampleにする

スクリプトを以下のように編集して子オブジェクトの名前を出力する
-- 親パーツを取得 local parentPart = workspace.ParentPart -- 子パーツを取得 local chidren = parentPart:GetChildren() -- 子パーツの名前を出力する for _, child in ipairs(chidren) do print(child.Name) end
出力
