How to iterate to first Model?

I’m trying to map out a way to iterate through my System for an automated Reference point; by this I mean rather than doing: “Main = script.Parent” or “Main = script.Parent.Parent.Parent” it’ll automatically assign “Main” as “Flight v1”; nothing that the ships won’t all be called “Flight v1” in the final release.

I was thinking of using a “for i” iteration to move upwards from the inital parent until it finds it’s target?


I don’t understand what you’re trying to do can you explain?

local Main
local Main2
for i, Model in pairs(Models) do
    if Model.Name == "Flight v1" then
        Main = Model
    elseif Model.Name == "Flight v2" then
        Main2 = Model
1 Like