Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a NPC dialog just like in CAMPING? (Roblox) [Not advanced..]

So I am finding out how to make a NPC dialog from the camping series. Can someone show me how maybe to do it with instructions? I am a expert editor so by you explaining things I will be able to learn, I see what you did and not make the same mistake I did by attempting to do something I am confused about xD. Thanks, this should be fairly easy so please help if you have some spare time. Thanks!

The NPC will not be talking by a overhead surfacegui but a gui that is shown locally with the name of the NPC, and its dialog. In this case, I only need the dialog part done. Also the text should be written like typewriter please.

1 answer

✓ Accepted answer

Easier way would be to use string.sub(t, i, j), it returns a sub string starting at i and ending at j from the whole string provided.

Example:

local myString = "Hello"
print(string.sub(myString, 0, 3)) -- Alternate Method = myString:sub(0, 3)

--[[
  Output:
  Hel 
]] --

So we start at the 0th character (the start) and we finish at the 3rd, which gives the answer "Hel" (H = 1, E = 2, L = 3)

So with this knowledge, we can use a loop to make a typewriter function,

local myString = "Hello"
local text = "YourTextGoesHere"

for i = 1, string.len(text) do -- string.len() gives the length of the text
    LOCATIONOFTEXTLABEL.Text = string.sub(text, 1, i)
    wait(0.05)
end

1 comment

0

Thx!

This discussion is preserved as it was. New answers, comments, and votes are closed.