for i , item in next , game.ReplicatedStorage.Shared:FindFirstChild("Tools"):GetChildren() do
if item:IsA("Tool") then
local price = item:FindFirstChild("Cost")
local img = item:FindFirstChild("ImgId")
local order = item:FindFirstChild("order")
if price and img and order then
if order.Value == i then
print(item.Name)
local temp = script.Parent.tools_gui.tools_frame.ScrollingFrame.temp:Clone()
temp.Parent = script.Parent.tools_gui.tools_frame.ScrollingFrame
temp.Name = item.Name
local priceval = Instance.new("StringValue")
priceval.Value = price.Value
priceval.Parent = temp
temp.Visible = true
else
continue
end
end
end
end
local RS = game:GetService("ReplicatedStorage")
local Shared = RS:WaitForChild("Shared")
local ToolFolder = Shared:WaitForChild("Tools")
local Tools = ToolFolder:GetChildren()
local parent = script.Parent
local toolsGui = parent:WaitForChild("tools_gui")
local toolsFrame = toolsGui:WaitForChild("tools_frame")
local scrollingFrame = toolsFrame:WaitForChild("ScrollingFrame")
local temp = scrollingFrame:WaitForChild("temp")
for i, item in ipairs(Tools) do
if item:IsA("Tool") then
local price = item:FindFirstChild("Cost")
local img = item:FindFirstChild("ImgId")
local order = item:FindFirstChild("order")
if price and img and order then
if order.Value == i then --ill leave this here but order value should match index since the ipairs iterator is being used
print(item.Name)
local temp = temp:Clone()
temp.Parent = scrollingFrame
temp.Name = item.Name
local priceval = Instance.new("StringValue")
priceval.Value = price.Value
priceval.Parent = temp
temp.Visible = true
else
continue --you can possible remove this else continue bit
end
end
end
end
Alternate version (more likely to work as intended).
local RS = game:GetService("ReplicatedStorage")
local Shared = RS:WaitForChild("Shared")
local ToolFolder = Shared:WaitForChild("Tools")
local Tools = ToolFolder:GetChildren()
local parent = script.Parent
local toolsGui = parent:WaitForChild("tools_gui")
local toolsFrame = toolsGui:WaitForChild("tools_frame")
local scrollingFrame = toolsFrame:WaitForChild("ScrollingFrame")
local temp = scrollingFrame:WaitForChild("temp")
for i, item in ipairs(Tools) do
if item:IsA("Tool") then
local price = item:FindFirstChild("Cost")
local img = item:FindFirstChild("ImgId")
local order = item:FindFirstChild("order")
if price and img and order then
print(item.Name)
local temp = temp:Clone()
temp.Parent = scrollingFrame
temp.Name = item.Name
local priceval = Instance.new("StringValue")
priceval.Value = price.Value
priceval.Parent = temp
temp.Visible = true
end
end
end