local Text = "Hello"
for i = 1, #Text do
chat.Text = string.sub(Text, 1, i)
wait(.1)
end
What this does is loop through a for loop which adds by 1 until it reaches the amount of letters in the Text, which is Hello (5 letters). Using string.sub basically subtracts any useless letters in that string that you don’t want in there.
local text = "Hello"
local sound = game.ReplicatedStorage.Sounds
for i = 0, #text, 1 do
chat.Text = string.sub(text, 1, i)
sound.KeySound:Play()
wait(0.1)
end
Yes, but I would recommend doing for i = 1, #text instead of for i = 0, #text, 1 do so you don’t have string.sub being string.sub(text, 1, 0) on startup.
The reason it played 5 times is because you have the sound playing inside of the for loop. Take it outside like this.
local text = "Hello"
local sound = game.ReplicatedStorage.Sounds
sound.KeySound:Play()
for i = 1, #text do
chat.Text = string.sub(text, 1, i)
wait(0.1)
end