I’m trying to make a script that changes the text in a TextLabel, then waits for half of the text’s length. I keep getting an error message that says “attempt to perform arithmetic (div) on nil and number.” I’ve tried to convert the .len into a number but for some reason it still says this. The script is a normal script in a TextLabel.
text = script.Parent
lines = {"text", "more text", "hi"}
function escape()
for i = 1, #lines do
text.Text = lines[i]
local length = tonumber(tostring(text.Text).len)
wait(length / 2) --the problem is on this line
end
end
escape()
If anyone could help me figure out why it doesn’t treat the length as a number that would be great!