script.Parent.ClickDetector.MouseClick:connect(function(Player)
	local Inventory = Player.PlayerGui.InventoryGui.Frame.Inventory.Inventory
	for i,v in next,Inventory do 
		if not v.Taken.Value == false then 
		v.ItemNumber.Value = script.Parent.ItemId.Value
	v.Image = script.Parent.PicId.Value
		end
	end
	
end)

error>>>

17:12:59.375 - Workspace.Book.Script:4: bad argument #1 to '(for generator)' (table expected, got Object)
17:12:59.376 - Stack Begin
17:12:59.377 - Script 'Workspace.Book.Script', Line 4
17:12:59.381 - Stack End

2 comments

0

for i, v in pairs loops require a table. While you are just requiring 1 thing. Just say local Inventory = Player.PlayerGui.InventoryGui.Frame.Inventory.Inventory:GetChildren()

0

@JhonTUnderwood It worked but it did it to all of them. I want it to do it to the first one that it finds thats false not all of them