I am working on creating an inventory system for my game but the item wont go into it! What did I do wrong? I have the tool named Cannedfood in my workspace!

local inv = script.Parent.Inventory
local invParts = inv:GetChildren()

local plr = game.Players.LocalPlayer

workspace.Cannedfood.Touched:connect(function(hit)
	local hum = hit.Parent:FindFirstChild("Humanoid")
	if hum then
		for i, v in pairs(invParts) do
			wait (0.5)
			if v.SlotValue.Value == "" then
				v.SlotValue.Value = "Cannedfood"
				v.ammt.Value = 1
				v.SlotLabel.Text = v.ammt.Value
				v.SlotImage.Image = "http://www.roblox.com/asset/?id=10470600"
				break
			elseif v.SlotValue.Value == "Cannedfood" then
				v.ammt.Value = v.ammt.Value + 1
				v.SlotLabel.Text = v.ammt.Value		
				break		
				
			end
		end
	end
end)

2 comments

0

Okay I got it to go into the inventory but how do I make it usable? Right now it just shows the decal

1

Why don't you just create a tool version of the can and insert it into the inventory instead of doing all of that?