Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How can I fix my Inventory script in order to make the items to go into it?

Asked by
Ryfry221 -12
7 years ago

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)
0
Okay I got it to go into the inventory but how do I make it usable? Right now it just shows the decal Ryfry221 -12 — 7y
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? wesleyd1124 14 — 7y

Answer this question