Help making a click to continue text script

I have a script where it puts text on a gui in a typewriter style, however it may be too quick for some users, and I wanna know how I can make it so you need to click/tap the screen to continue the text.

I’ve been experimenting, but with no success.

Script:

local TextBox = script.Parent.BigFrame.Text

wait(1)

local function write(object,text,length)
	for i = 1, #text,1 do
		object.Text = string.sub(text,1,i)
		wait(length)
	end
end

write(TextBox,"Hey!")
wait(1)
write(TextBox,"This is a test!")
5 Likes

You can just wait until the mouse button is pressed down using the Mouse | Roblox Creator Documentation api.

local Mouse = game.Players.LocalPlayer:GetMouse()

Mouse.Button1Down:Wait() -- Waits until the first mouse button is pressed
4 Likes

This works PERFECTLY! Thank you!

1 Like