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

attempt to index nil with 'Item' Help?

Asked by 3 years ago

I have a inventory gui that I am making so you can move to "Sort" your inventory. It will not work, It always errors. Here is the script (Normal script inside text button):

local MovingInventory = script.Parent.Parent.Parent.Parent.Parent.MovingInventory
local SlotMoving = script.Parent.Parent.Parent.Parent.Parent.MovingInventory

script.Parent.MouseButton1Click:Connect(function()
    if MovingInventory.Value == false then
        MovingInventory.Value = true
        SlotMoving.Value = script.Parent.Name
    elseif MovingInventory.Value == true then
        MovingInventory.Value = false
        game.ReplicatedStorage.Values:WaitForChild("Item").Value = script.Parent.Parent:FindFirstChild(SlotMoving.Value).Item.Value
        game.ReplicatedStorage.Values:WaitForChild("Amount").Value = script.Parent.Parent:FindFirstChild(SlotMoving.Value).Amount.Value
        script.Parent.Item.Value = script.Parent.Parent:FindFirstChild(SlotMoving.Value).Item.Value
        script.Parent.Amount.Value = script.Parent.Parent:FindFirstChild(SlotMoving.Value).Amount.Value
        script.Parent.Parent:FindFirstChild(SlotMoving.Value).Item.Value = game.ReplicatedStorage.Values.Item.Value
        script.Parent.Parent:FindFirstChild(SlotMoving.Value).Amount.Value = game.ReplicatedStorage.Values.Amount.Value
    end
end)

Thoughts, thanks!

0
What line does this error occur on? appxritixn 2235 — 3y
0
10, i removed that part as it does work without it, but then It just moved on to line 11, then 12. JailBreaker_13 350 — 3y
0
One of my weirdest errors ever. JailBreaker_13 350 — 3y
0
Your code is extremely sloppy. TribotGamerGX 184 — 3y
0
Thanks.. JailBreaker_13 350 — 3y

Answer this question