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

what should i write in line 2 as at is saying expected number got nil?

function setText(word)

for i = 1, text do

	textLabel.Text = string.sub(text,1,i)

	SoundEffect()

	textLabel.TextColor3 = Color3.fromRGB(188, 0, 0)

	wait(0.5)

end

end

1 comment

0

What should i write in line 3 as at is saying expected number got nil?

1 answer

The problem is that your parameters in setText() is "word" not "text". You need to change it to "text"

Also in line 2 ( for i = 1, text do ), "text" is a string, not amount of digits in it ( #text )

function setText(text)
	for i = 1, #text do -- "#text" not "text"
		textLabel.Text = string.sub(text,1,i)

		SoundEffect()

		textLabel.TextColor3 = Color3.fromRGB(188, 0, 0)

		wait(0.5)
	end
end

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