Hello, I keep getting an error saying attempt to index nil with ‘Pic’. Im not sure what is wrong.
normal script:
local function GetInventory(player)
local inv = {}
for i, v in pairs(game.ServerStorage:WaitForChild("Inventory"):WaitForChild(player.Name):WaitForChild("Data"):WaitForChild("Items"):GetChildren()) do
if v:IsA("StringValue") then
local vprop = {i,v.Name,v.Amount.Value}
table.insert(inv,vprop)
end
end
return inv
end
game.ReplicatedStorage:WaitForChild("GetInv").OnServerInvoke = function(player)
local inventoryInfo = {
inv = GetInventory(player),
}
return inventoryInfo
end
local script:
local InvDebouce = false
sendinv.OnClientEvent:Connect(function()
if InvDebouce == false then
InvDebouce = true
local Inventory = Invent:InvokeServer()
for pos,val in next,Inventory.inv do
local content = slotFolder:FindFirstChild("Slot"..tostring(pos))
if Inventory.inv[pos][3] == 1 then
content.ItemName.Text = Inventory.inv[pos][2]
else
content.ItemName.Text = Inventory.inv[pos][2].." x"..Inventory.inv[pos][3]
end
content.ItemAmount.Text = "x"..Inventory.inv[pos][3]
content.Img.ImageTransparency = 0
content.Img.Image = "rbxassetid://"..itemModule[Inventory.inv[pos][2]]["Pic"]
end
InvDebouce = false
end
end)
I have a module script which has items in it and pic is a variable of the item and contains the ID for the image.