Help please
script.Parent.ClickDetector.MouseClick:connect(function(Player)
Player.PlayerGui.InventoryGui.Frame.Inventory.Inventory.Item1.ItemNumber.Value = script.Parent.ItemId.Value
Player.PlayerGui.InventoryGui.Frame.Inventory.Inventory.Item1.Image = script.Parent.PicId.Value
end)
instead of always doing Item1 I need a way for it to detect which one is next out of 25... So like if the first 3 are taken i need it to automatically detect that and then fill in number 4. How can I do that?
here is the script now but it wont work... Please go to this link and look at the forum.
https://forum.roblox.com/Forum/ShowPost.aspx?PostID=210394171
script.Parent.ClickDetector.MouseClick:connect(function(Player)
local Inventory = Player.PlayerGui.InventoryGui.Frame.Inventory.Inventory
local counter = 1
for i,v in next,Inventory:GetChildren() do
if i > counter then
counter = i
if v.BeingUsed.Value == false then
v.ItemNumber.Value = script.Parent.ItemId.Value
v.Image = script.Parent.PicId.Value
break
end
end
end
end)

1 comment
thx