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

attempt to get length of a nil value?

I Have This Code Where It Animates Text And I Requires It To Have A Waiting Time For Each Word To Appear. Anyway. Its Saying There is A Nil Value Somewhere Please Leave Your Suggestions Below.

Quick Disclaimer Im Not Using Roblox Functions Inside Strings Its Just For Game Design. Thats All :D

local text
local preset = "var FinNearestConnect = FindFirstObjectName('SlidingDoor') var2 Door = FindNearstConnect:FinalizedString('Door') Door:GetAuthorize(Owner) if not Auth then \Execute Door:GetFinalAuthorization('Owner') if not auth then return \Excute Require(5967169491,Sys)"

local preset2 = "/Execute Door.Push = Pos.Y - 5 X 90,Auth:Complete('Owner') println('open') anglang=C"
for i = 1, #text do
	script.Parent.TextLabel.Text = string.sub(text,1,i)
	wait(0.05)
end

script.Parent.Parent.Parent.Parent.Keyboard.ClickDetector.MouseClick:Connect(function()
	script.Parent.Image.Visible = false
	script.Parent.TextLabel.Visible = true
	text = "require(13677U123,SYS)"
	wait(2)
	text = "downloading... "
	wait(5)
	text = preset
	wait(2)
	text = "downloading final auth..."
	wait(3)
	text = preset2
	
end)

2 comments

0

You are trying to get a length of variable text which is a nil. Look at line 1

0

Also, you are running your for i loop when the text variable is nil even though in line 10 function you set text to preset and preset2

1 answer

✓ Accepted answer

I see that you did not assign the value on your varriable text. At deafult, the type of value is nil until you reassign it. You just have to make local text to: local text = ""; this makes it a string value so you can get the length of it.

1 comment

0

Thanks For The Help! I Should Of Put A String There. But My Brain Was Like Haha No Anyway Thx For The Help.

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