Basically I want the script to select all models within a folder however I’m not sure how to.
Heres my script.
if game:GetService("ReplicatedStorage").Vehicles:FindFirstChildOfClass("Folder"):FindFirstChildOfClass("Model") then
clonegui.Parent = gui.SpawnProperties.VehiclesFrame.VehicleCloneFrame
clonegui.Text = game:GetService("ReplicatedStorage").Vehicles:FindFirstChildOfClass("Folder"):FindFirstChildOfClass("Model").Name
end
end)
end)
if game:GetService("ReplicatedStorage").Vehicles:FindFirstChildOfClass("Folder"):FindFirstChildOfClass("Model") then
local path = game:GetService("ReplicatedStorage").Vehicles
for i,v in pairs(path:GetChildren()) do
if v:IsA("Folder") then v:FindFirstChildOfClass("Model")
clonegui.Parent = gui.SpawnProperties.VehiclesFrame.VehicleCloneFrame
clonegui.Text = v
end
end
end
~~`
change path to your folder you want to loop on
nvm I didn’t check the whole script
then here
if game:GetService("ReplicatedStorage").Vehicles:FindFirstChildOfClass("Folder"):FindFirstChildOfClass("Model") then
local Path = game:GetService("ReplicatedStorage").Vehicles
for i,v in pairs(Path:GetChildren()) do
if v:IsA("Folder") then
clonegui.Parent = gui.SpawnProperties.VehiclesFrame.VehicleCloneFrame
clonegui.Text = v.Name
end
end
end
ok works fine now when i removed 70% of the script
local Path = game:GetService("ReplicatedStorage").Vehicles
for i,v in pairs(Path:GetChildren()) do
if v:IsA("Folder") then
local clonegui = script.Parent.GuiThingy:Clone()
clonegui.Text = v.Name
clonegui.Parent = gui.SpawnProperties.VehiclesFrame.VehicleCloneFrame
end
end
if game:GetService("ReplicatedStorage").Vehicles:FindFirstChildOfClass("Folder"):FindFirstChildOfClass("Model") then
local Path = game:GetService("ReplicatedStorage").Vehicles
for i,v in pairs(Path:GetChildren()) do
if v:IsA("Folder") then
local Clone = clonegui:Clone()
Clone.Parent = gui.SpawnProperties.VehiclesFrame.VehicleCloneFrame
Clone.Text = v.Name
end
end
end
That still wont work it’s only finding the vehicles folder what it’s intended to do is find a folder within the path then find a model within the folder.
Okay to put it simply I want the script to find a folder which is within the path then to find all of the childs in that folder which are of the model class then clone a gui for every model found.
if game:GetService("ReplicatedStorage").Vehicles:FindFirstChildOfClass("Folder"):FindFirstChildOfClass("Model") then
local Path = game:GetService("ReplicatedStorage").Vehicles
for i,v in pairs(Path:GetChildren()) do
if v:IsA("Folder") then
for i, v in pairs(v:GetChildren()) do
if v:IsA("Model") then
local Clone = clonegui:Clone()
Clone.Parent = v
Clone.Text = v.Name
end
end
end
end
end