So I'm making an interaction system.. And this happened!

So I ran into a dilemma, when I was working on this interaction system I got to the point where I want to display the message from the beginning to the end character.

e.g

message = "Hello, my name is bob"
-- Display on a gui from "Hello" to "bob"

Can someone break it down from the beginning so I know how to script this?

Here’s all you need to know:

If that solves your problem, mark it as solution.

Are you looking for a typewriter effect?

2 Likes

This new property for text objects in beta allows you to achieve the effect you mentioned:

Take note that this will not work in live games yet as it is still in beta, but you may try it out via studio beta channel.

1 Like
local message = "Hello, my name is bob"

local text = ""

for i = 1, #message do -- runs to the length of the string

wait(0.04) -- so its not instant

text = string.sub(message, 1, i) -- string.sub(string s, start, end), i will continuously increase until it reaches the end of the string

print(text) -- print it in the output, or do whatever you want to do with it

end
1 Like
local XPos = 0
local YPos = 0
function typeLetter(Letter)
	local TL = script:WaitForChild("Letter"):Clone()
	TL.Text = Letter
	TL.Position = UDim2.new(XPos, 0, YPos - 0.1, 0)
	TL.Parent = script.Parent:WaitForChild("DescFrame")
	TL:TweenPosition(UDim2.new(XPos,0,YPos,0),"Out", "Quad", .1, true)
	XPos = XPos + .025
	if XPos > .95 then
		YPos = YPos + .4
		XPos = 0
	end
	if Letter == "." or Letter == "!" or Letter == "?" then
		wait(.5)
	end
end

local Message = "Come back when you're done."
local text = ""
for i = 1, #Message do -- runs to the length of the string
	wait(0.04) -- so its not instant
	text = string.sub(Message, i, i)
	typeLetter(text)
end

So this is my first time making a typewriter script. I decided to do it a little bit differently, because I saw a pretty cool reference. The texts kind of overlap eachother a bit. Anyone know a fix to this?

Combat Scripting - Roblox Studio (gyazo.com)

I think it might have to do with the font, or possibly the positioning?

Yeah, the problem isn’t knowing what it is though. I just don’t know what to do, because I’ve never done this before. I searched up textsize, but that didn’t help. It always turns out like this.

image