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

How to fix my script for GUI "typing" effect? [Answered]

I want the letters to form 1 by 1 to make seem as if it's being typed. I stumbled upon an error with my script showing numbers in-between each. I feel like I should know how to fix it but I'm stuck. Here's my script (Not Local) :

SP = script.Parent



while true do
	SP.Text = "H"..wait(0.1).. "e"..wait(0.1).."l"..wait(0.1).."l"..wait(0.1).."o"
	wait(2)
end

Thank you(This script is not finished, I'll be having more words show that's why it's so small). Oh, it is set as ScreenGui>Frame>TextLabel>script

1 comment

0

I know it's possible, For example Khols admin script using shouts, their words are typed on to the screen.

1 answer

✓ Accepted answer

Your problem here is that you are concatenating the return of wait, which happens to be a number.

Your script also isn't very scaleable, since you're trying to write all the numbers by hand. Here's a more easily extendable form, using some string manipulation:

local sp = script.Parent

function guiType(word)
	if string.len(word) <= 1 then
		sp.Text = word
		return
	end

	for i = 1, string.len(word) do
		sp.Text = string.sub(word, 1, i)
		wait(.1)
	end
end

local words = {"Hello.", "How are you?"}
while true do
	guiType(words[1])
	wait(2)
	guiType(words[2])
	wait(2)
end

1 comment

0

Thank you.

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