This is the code:
script.Parent.Slot.MouseButton1Down:connect(function() playerName = script.Parent.Slot.Text print(playerName) local backpack = game.Players:FindFirstChild(playerName).Backpack print(backpack) local toolFrame = script.Parent.Parent.ToolFrame.Tool for i,tool in pairs(backpack:GetChildren()) do print("ok") if tool then local tool = toolFrame:Clone() tool.Parent = script.Parent.Parent.ToolFrame tool.Name = "Tool"--..slotnum tool.Position = UDim2.new(0,0,0,55*num.Value) tool.Text = tool.Name tool.Visible = true end end end)
The function works until the for loop. But I'm not getting any error. What am I doing wrong? Help is greatly appreciated!
Maybe the "toolFrame" cannot be found OR the backpack array is empty, make sure you debug the code.