Why isnt my item description script not running my second for loop?
local ItemRooms = {}
function LoadItems()
local ItemFile = game.ReplicatedStorage.Items
for _, v in pairs(workspace:GetDescendants()) do
if v:IsA("Model") and v.Name == "ItemRoom" then
local Item = ItemFile:GetChildren()
local chosenItem = Item[math.random(1, #Item)]:Clone()
chosenItem.Parent = v
chosenItem:MoveTo(v.Pedastol.Position + Vector3.new(0, 1.5, 0))
local Pedastol = v.Pedastol
table.insert(ItemRooms, v)
end
end
end
LoadItems()
--//ItemDesc.
for _, v in pairs(ItemRooms) do
local Peadastol = v.Pedastol
Peadastol.Touched:Connect(function(p)
if p:FindFirstChild("Humanoid") then
for _, x in pairs(v:GetDescendants()) do -- doesnt run this loop
print(x) -- doesnt print
if x:IsA("Model") and game.ReplicatedStorage.Items:FindFirstChild(x.Name) then
local GUI = script.DescGUI:Clone()
local Desc = x:FindFirstChild("Description")
local Player = game.Players:FindFirstChild(p.Parent.Name)
GUI.Holder.Description.Text = Desc.Value
GUI.Holder.Item.Text = x.Name
GUI.Parent = Player.PlayerGui
wait(5)
GUI:Destroy()
end
end
end
end)
end