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

attempt to index nil with 'Desc'? [closed]

Asked by 4 years ago
Edited 4 years ago

The LocalScript:

v.MouseEnter:Connect(function()
    if v.ItemName.Text ~= "" then
        local item = v.ItemName.Text:split(" ")
        Entered = true
        Info.Visible = true
        v.HoverImage = "rbxassetid://5626419484"
        for i, v in pairs(itemModule) do
            print(i, v)
        end
        Info.Desc.Text = "Desc: " .. itemModule[item[1]]["Desc"]
    end
end)

The ModuleScript:

local module = {
    ["Apple"] = {
        Name = "Apple",
        Amount = 1,
        Desc = "A fruit that will replenish your health.",
        Type = "Consumable",
        Weight = 0,
        Selling = 10,
        Picture = 5652301921,
        Dropable = true,
    };

    ["Magic Potion"] = {
        Name = "Magic Potion",
        Amount = 1,
        Desc = "A potion that will replenish your magic.",
        Type = "Consumable",
        Weight = 0,
        Selling = 100,
        Picture = 5651758927,
        Dropable = true,
    };

    ["Lesser Healing Potion"] = {
        Name = "Lesser Healing Potion",
        Amount = 1,
        Desc = "Heals your health by a little.",
        Type = "Consumable",
        Weight = 0,
        Selling = 50,
        Picture = 5651758690,
        Dropable = true,
    };
}

return module

The Error:

17:45:16.087 - Players.iHoppier.PlayerGui.MainGui.LocalScript:209: attempt to index nil with 'Desc'
17:45:16.088 - Stack Begin
17:45:16.088 - Script 'Players.iHoppier.PlayerGui.MainGui.LocalScript', Line 209
17:45:16.089 - Stack End

Closed as Non-Descriptive by JesseSong

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?