the script is too long to post
COMMUNITY QUESTION
What does ServerScriptService.BasicAdmin:1148: attempt to get length of a nil value mean?
1 answer
Any time you see attempt to ... a nil value in your code, you can be sure that there exists some variable that is not defined that should be.
This can happen in a few ways:
- Forgetting to assign a value to a local variable
local assignLater;
-- (later never comes)
print(assignLater.something) --> attempt to index 'assignLater' (a nil value)
- Accessing an object in your game that doesn't exist
print(workspace.doesntExist); --> attempt to index workspace for 'doesntExist' (a nil value)
- Or any time where you are trying to perform some action on data that doesn't exist. Maybe the data was never defined, maybe it was defined at some point but then re-assigned to
nil, etc.
In your case, somewhere in your code you are using the length operator (#) on a variable that isn't defined. This variable is most likely supposed to be an array or a string, since those are the only datatypes you can use this operator on.
You can simulate this error by doing the following:
local some_nil_value = nil;
print(#some_nil_value) --> attempt to get length of a nil value
This discussion is preserved as it was. New answers, comments, and votes are closed.
