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

Bad Argument Errors [?] Click For Detail.

Hello.

I got this error in a few lines;

local String = CB.Text.Value 
local Length = string.len(String)

This is only Part of my script.

CB is a text label. Text is a string value.

This is what the error said;

string expected got nil. near 'len'

If you know a way to fix it then please help with examples.

1 answer

✓ Accepted answer

ROBLOX checks for properties before children of instances.

Change the name of Text to something more descriptive.

You're using .Value on the string of the text currently.

P.S: Just use #string to get the length

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