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

Why is this giving me this error [TEXTBOX/FOCUSLOST] ?

Asked by
wazap 100
8 years ago
local succ = false;
script.Parent.FocusLost:connect(function(enter)
    if game.Players.LocalPlayer.IsRapper.Value then script.Parent.Text = "You cant change names during rap" wait(2) script.Parent.Text = game.Players.LocalPlayer.RapperName.Value return end
    if enter then
        if script.Parent.Text == "" or not script.Parent.Text then return end
        if #script.Parent.Text>35 or #script.Parent.Text < 1 or #script.Parent.Text:match("%W+") == #script.Parent.Text then --ERRORS HERE

The error is "attempt to get length of a nil value"

I'm just wondering how script.Parent.Text is possible to be nil when the line before that literally should filter that away.

0
use len() instead of # for the text. This will not fix your error, just a suggestion unmiss 337 — 8y

1 answer

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
8 years ago

The problem is your :match() call. The match is returning nil, which is where your error is coming from.

What are you trying to do with that line?

Ad

Answer this question