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

Inventory [closed]

Asked by 10 years ago

The scipt is suppose to take 1 inventory space if it finds something in the inventory, I have a wooden sword in the inventory but for some reason it does nothing, output shows not errors.

function added(plr)
    repeat wait() until plr.Character;
    local inventory = plr.Backpack;
    x = script.Parent.Frame;
    y = "http://www.roblox.com/asset/?id=";
    used = {
        x.Slot1.IsInUse;
        x.Slot2.IsInUse;
        x.Slot3.IsInUse;
        x.Slot4.IsInUse;
        x.Slot5.IsInUse;
        x.Slot6.IsInUse;
        x.Slot7.IsInUse;
        x.Slot8.IsInUse;
        x.Slot9.IsInUse;
        x.Slot10.IsInUse;
        x.Slot11.IsInUse;
        x.Slot12.IsInUse;
        x.Slot13.IsInUse;
        x.Slot14.IsInUse;
        x.Slot15.IsInUse;
        x.Slot16.IsInUse;
        x.Slot17.IsInUse;
        x.Slot18.IsInUse;
        x.Slot19.IsInUse;
        x.Slot20.IsInUse;
        x.Slot21.IsInUse;
        x.Slot22.IsInUse;
        x.Slot23.IsInUse;
        x.Slot24.IsInUse;
        x.Slot25.IsInUse;
    }
    images = {
        y..129874048;
        y..129874624;
        y..129874448;
        y..137774700;
        y..137804756;
    }
    function InventorySpaces()
        for i, v in pairs(used) do
            for k, j in pairs(inventory:GetChildren()) do
                if v.Value == false and v.Parent.Image == "" then
                    v.Value = true;
                    if j.Name == "Wooden Sword" then
                        v.Parent.Image = images[1];
                    elseif j.Name == "Iron Sword" then
                        v.Parent.Image = images[2];
                    elseif j.Name == "Long Iron Sword" then
                        v.Parent.Image = images[3];
                    elseif j.Name == "Great Sword" then
                        v.Parent.Image = images[4];
                    elseif j.Name == "Long Great Sword" then
                        v.Parent.Image = images[5];
                    end;
                    print("Slot is now in use;");
                    break;
                else
                    print("Slot is already in use");
                end;
            end;
            break;
        end;
    end;
    plr:WaitForChild("Backpack").ChildAdded:connect(InventorySpaces);
end;

game.Players.PlayerAdded:connect(added);
0
What exactly are you trying to do? Articulating 1335 — 10y
0
Is IsInUse a value, to be more specific, a BooleanValue? If so you must do x.Slot7.IsInUse.Value; TheMyrco 375 — 10y

Closed as Not Constructive by evaera

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?