How do you have a key to change to different lines of text?
Asked by
5 years ago Edited 5 years ago
I'm currently making an intro where you need to press 'E' to progress through the lines of text. The script also has some lines of code to make it have a typewriter effect. How do I add extras lines of code to change the text by pressing 'E'?
Current code (LocalScript):
01 | local UserInputService = game:GetService( "UserInputService" ); |
02 | local Players = game:GetService( "Players" ); |
03 | local client = Players.LocalPlayer; |
04 | local text = string.format( "Hello, %s." , client.Name); |
07 | UserInputService.InputBegan:Connect( function (input, gpe) |
08 | if (gpe or not rawequal (input.KeyCode.Name, 'E' )) then |
13 | script.Parent.IntroText.Text = text:sub( 1 , i); |
Edit: The code above was changed but all I need to do now is know how to add more lines of text so that whenever someone presses 'E', it changes to the next line of text in chronological order.