SSJMateusz
(SSJMateusz)
February 22, 2024, 11:45am
#1
I am currently trying to make this NPC talk system, where the letters appear 1 by 1, for this I am using
string.sub.
But I have run into an issue with it, right now I am printing “Hello world” letter by letter in the output but when it comes to space, it cant print it because it is nil, how would I go around this?
Thanks in advance
Are you talking about a literal space character? A space is still a space, not nil. Could you show your code?
SSJMateusz
(SSJMateusz)
February 22, 2024, 12:28pm
#3
Oops, i’ve looked back at my code and i made a mistake with my loops, its working now so ill just mark your comment as solution
the problem was i did 2 for i loops and used the wrong i variable if that makes sense
1 Like
dswqsa895
(Dsw official)
February 22, 2024, 12:28pm
#4
string.sub()
it is a function that can create a smaller string of the inputted string that starts at I and ends at J.
for a typewriter effect, this is an example:
for i = 1, string.len(text here), 1 do
textObject.Text = string.sub(text, 1, i)
task.wait()
end
this is not an efficient approach, as it does not support RichText or auto translations.
You can learn more about this in the Official Lua Website
system
(system)
Closed
March 7, 2024, 12:29pm
#5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.