Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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

3 comments

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.

0

it still gives the same error :/

0

I am sorry i made a typing mistake with your answer - thank you both

This discussion is preserved as it was. New answers, comments, and votes are closed.