Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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
0
Thx! TrueFalses -15 — 4y
Ad

Answer this question