How to search a player's backpack?
This is the code:
01 | script.Parent.Slot.MouseButton 1 Down:connect( function () |
02 | playerName = script.Parent.Slot.Text |
04 | local backpack = game.Players:FindFirstChild(playerName).Backpack |
06 | local toolFrame = script.Parent.Parent.ToolFrame.Tool |
07 | for i,tool in pairs (backpack:GetChildren()) do |
10 | local tool = toolFrame:Clone() |
11 | tool.Parent = script.Parent.Parent.ToolFrame |
13 | tool.Position = UDim 2. new( 0 , 0 , 0 , 55 *num.Value) |
The function works until the for loop. But I'm not getting any error. What am I doing wrong? Help is greatly appreciated!