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

error: attempt to index field '?' (a nil value)

Asked by 6 years ago
Edited 6 years ago

the error is in the title. the error occurs on the line 'print('the hmi is: '..hmi.Value..'the children: '..children[hmi.Value - 1].name)' (line 8)

if you need an explanation or something ill edit it

hmi.Changed:connect(function()
    print('The hmi is now ' .. hmi.Value)
    local lasthmi = hmi.Value - 1
    if hmi.Value > 1 then
        local children = scrollingframe:GetChildren()
        local newitem = scrollingframe.Item1:Clone()
        newitem.Name = 'Item'..hmi.Value 
        print('the hmi is: '..hmi.Value..'the children: '..children[hmi.Value - 1].name)
    end
end)

--EDIT: info about the hmi value: 'HMI is a numbervalue which sees how many children the players backpack has, i need this value -1 because every time it goes up a new frame in a gui is created and i need the last frames position to update it for the next (make it plus (0,0,0.002,0)) ------- hopefully that makes some sense'

0
That error means that you are trying to index a nil value. I am not really good at scripting but I think that the [hmi.Value - 1] has no value in it. HeyItzDanniee 252 — 6y
0
means hmi is nil, or if hmi is an objectvalue means its value is nil. More info on hmi please? ADUPS 5 — 6y
0
im sorry it was my own foult i found it out myself i made a dumb mistake TigerClaws454 48 — 6y
0
it still doesn't work nevermind TigerClaws454 48 — 6y
View all comments (3 more)
0
HMI is a numbervalue which sees how many children the players backpack has, i need this value -1 because every time it goes up a new frame in a gui is created and i need the last frames position to update it for the next (make it plus (0,0,0.002,0)) ------- hopefully that makes some sense TigerClaws454 48 — 6y
0
.name's "N" is lowercase, change it to .Name, remember that lua is case sensative fanofpixels 718 — 5y
0
that is the only discrepancy i could find, since any numbervalue's value is never nil fanofpixels 718 — 5y

Answer this question