Gradually appearing text

Learn how to make 1 simple function to make text appear gradually

by GlobalCat

Author Avatar

How to make appearing text like in Camping?

So, hello guys, my name is Andrew and today i will teach you about one easy thing, that nearly 90% of early beginners don't know - How to make slow/fast appearing text.


First things first - we create a simple function called for example: TweenText() with 2 parameters. The first parameter is the object where we put our text, and the second is the text itself

local function TweenText(TextLabel,Text)

end

Next we will add local variable to count how much letters in this text with for i loop

local function TweenText(TextLabel,Text) 
   local Letters = #Text
   for i = 1,Letters,1 do
      wait(0.05)
   end
end

After we have done 90% of the work, we have only 1 line of code left to write, which is exactly what we are going to do. Most likely you don't know this type of formatting -

string.sub()

, but it only responds to one function - loading text from letter to letter, which we will give it. ("string")


For example,

string.sub("Hey guys, anomaly here!", 1, 5)

it will output us = "Hey g" (from first to fifth letter)


So guys, that's all. With this information we can just finish up our function:

local function TweenText(TextLabel,Text)
    local Letters = #Text
    for i = 1,Letters,1 do
        wait(0.05)
        TextLabel.Text = string.sub(Text,1,i)
    end
end

That's all, now you can gradually develop the text in 7 lines of code, instead of 100+

Good luck to everyone, good mood, good codes, and health. Bye everyone!

UPD:

You asking about where to put script?

If you want to** text appear on client(gui's)** then put it in gui itself,or starter player/character(if you know how to use it there)

if you want to make a board where text will be visible for ALL then put it in the server script service.

View in-game to comment, award, and more!