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)

1 comment
Commenters: Please press "View Source" because some of the code got cut off in the block for some reason