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

Error: attempt to index local 'ItemNumber' (a number value)?

Asked by 5 years ago
Edited 5 years ago

Hello, the error i am getting is in the title

ItemNumber is a value i created in the localscript by doing:

local ItemNumber = 1

where the error occurs:

ItemNumber.Changed:connect(function(NewValue)

end)

i don't know why this is happening it works fine with another value in another script can it be because it is a value created in the localscript ?

Thanks for any help

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

You need an int value then if you want rename it and reference it to your script. Here

local ItemNumber = game.Workspace.IntValue.Value

ItemNumber.Changed:connect(function(NewValue)

end)

But if that didn’t work try this one

local ItemNumber = game.Workspace.IntValue

ItemNumber.Changed:connect(function(NewValue)
       If ItemNumber.Value == (What Ever Number You Want Here) then

        end
end)

Please don’t forget to make this the answer if it was correct!

Thanks -GizmoProductions

0
Not entirely true, you don't need it to be an actual object in-game, but if you decide to use an actual object, then you should be good. Make sure to use Connect instead of connect! It's deprecated. User#20989 0 — 5y
0
it still gives the same error :/ TigerClaws454 48 — 5y
0
I am sorry i made a typing mistake with your answer - thank you both TigerClaws454 48 — 5y
Ad

Answer this question