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

Can anyone figure out this? (Inventory script problem)

Asked by
Paldi 109
10 years ago

can anyone help for a little script i made for my inventory GUI im trying to make? this is a button to unequip a weapon/armor (the part to remove the weapon/armor isnt made yet but it shouldn't be a problem), the problem is that i want it to be in the first empty slot of the inventory but it goes in all of them :/

function OnClicked()
    local player = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent
    local item = script.Parent.Parent.Parent.ItemName.Value
    if item ~= "None" then
    local d = player.PlayerGui.UI.Inventory:getChildren()
    for i=1, #d do 
        if d[i].ItemName.Value == "None" then
        d[i].ItemName.Value = item
        end
    end
    player.PlayerGui.Items:findFirstChild(item):remove()
    script.Parent.Parent.Visible = false
    script.Parent.Parent.Parent.Visible = false
    script.Parent.Parent.Parent.ItemName.Value = "None"
    end
end

script.Parent.MouseButton1Click:connect(OnClicked)
0
set it out like a script NinjoOnline 1146 — 10y

Answer this question