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

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

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.

1 comment

0

use len() instead of # for the text. This will not fix your error, just a suggestion

1 answer

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?

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