So, I have a hierarchy of folders, and because I have no clue how to insert pics here, ill just type it out lol.
ReplicatedStorage Folder1 Folder2 Folder3 Model
And I am trying to make a developer gui where I can spawn in items from repstorage. I have a textbox where I type what I want to spawn, then it searches folder1 using :FindFirstChild and looks for what I typed in the textbox. But, because of the folder layers (for organization) it wont work. Does anyone know a fix for this?
Code:
script.Parent.MouseButton1Click:Connect(function() local player = game.Players.LocalPlayer local human = player.Character local torso = human.UpperTorso local newInstance = game.ReplicatedStorage.SandboxInstances:WaitForChild(script.Parent.Parent.TextBox.Text) if newInstance then local clone = newInstance:Clone() clone.Parent = workspace clone.PrimaryPart = clone.Base clone:SetPrimaryPartCFrame(torso.CFrame + torso.CFrame.lookVector * 10) else warn("Instance not found!") end end)
NOTE: I'm just basing this off of what I understood from your post, as this was very unclear.
What might help is the :GetDescendants method, which essentially gets the children and those objects' children and so on, and returns a table of all these instances.