Im making inventory system, BUT when i pick up it runs this code:
function API:AddToInventory(item,imageID:number,player:Player)
local ItemsInInventory = {
}
print(item)
print(true)
local PlayerGui:PlayerGui = player:WaitForChild("PlayerGui")
local InventoryGui = PlayerGui.Main.Inventory -- ñ W
print(InventoryGui)
local Template = InventoryGui.Template
local ItemName = if item:IsA("Part") or item:IsA("MeshPart") then item.Name else warn("The item specified is not a part/meshpart")
ReplicatedStorage.Remotes.AddToInventory:FireClient(player,item,imageID)
print(PlayerGui,InventoryGui,ItemName)
table.insert(ItemsInInventory,item.Name)
end
Module script btw
(Module script runs)
Local Script:
ReplicatedStorage.Remotes.AddToInventory.OnClientEvent:Connect(function(item,imageId)
local ItemName = if item:IsA("Part") or item:IsA("MeshPart") then item.Name else warn("The item specified is not a part/meshpart")
local Template = script.Parent.Inventory.Template:Clone()
Template.Parent = script.Parent.Inventory.ScrollingFrame
Template.name.Text = ItemName
end)
Please help!