Chat typing..... Backwards?

Im fairly new to coding right now, and I’m working on a dialog bubble. However just when I thought I did everything right, the chat started going in reverse!

Video:

As funny as this is, I kind of want to learn how to make it go the proper way.
I want it to go from the first letter all the way to the last*
Here’s my code:

function Chat (String)
	local NumOfLetters = string.len(String)
	print(NumOfLetters)
	for i = 1,NumOfLetters do
		local NEWSTRING= string.sub(String,i,NumOfLetters)
		player.PlayerGui.ChatGUI.Frame.TextLabel.Text = NEWSTRING
		wait(0.1)
		
	end
end

game.ReplicatedStorage.Event.OnClientEvent:Connect(function(Key,String)
	if Key == "Chat" then
		Chat(String)
	end
end)

Thanks for reading C:

1 Like

shouldn’t it be

string.sub(String, 1, i)  --Either 1 or 0 - I can't remember but use the beginning of the string!

This is because string.sub’s second argument is where the substring starts, and the third arg is where it ends. You’ve kinda reversed it, it should be beginning of string to i

2 Likes

Aye thanks man, guess i read it wrong on how to use it on the Roblox lua page

2 Likes