How can I make my Text start typing when It's visible

Hello everyone!

I’m using roblox’s TypeWrite module but I want It to start typing when the text Is visible

I tried using if and propertychanged but It didn’t work, I have no Idea how to make It work

Normal script: (works)

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local TypeWriter = require(ReplicatedStorage:WaitForChild("TypeWriter"))



TypeWriter.typeWrite(script.Parent, "test")

Script that I tried to make It work: (breaks the script)

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local TypeWriter = require(ReplicatedStorage:WaitForChild("TypeWriter"))


if script.Parent.Visible == true then
   TypeWriter.typeWrite(script.Parent, "test")	
end

I’m pretty bad at typeWrite, any Ideas? (btw I used the devhub for this)

I tried to replicate this on my own, and this worked just fine for me.

Sorry for late response btw

This didnt work for me and idk why

You mean GetPropertyChangedSignal?
Also the problem might be that the TextLabel (or whatever gui element you’re using) is becoming visible before the script runs.

Nope, and yes i meant GetPropertyChangedSignal, btw sorry for late response, I mean when the text becomes visible theres no text and It works for other ones except this one.

Can you send your modulescript’s code? Maybe you mistyped something. Else I’m not sure what can be the problem.

here

Here you go, the following works well. I removed translation, because it takes some time.

Unfold this to get the module without translation function (faster).
local TypeWriter = {}

local defaultConfigurations = {
	delayTime = .08,
	extraDelayOnSpace = false
}

function TypeWriter.configure(configurations)
	for key, value in pairs(defaultConfigurations) do
		local newValue = configurations[key]
		if newValue ~= nil then
			defaultConfigurations[key] = newValue
		else
			warn(key .. " is not a valid configuration for TypeWriter module")
		end
	end
end

function TypeWriter.typeWrite(guiObject, text)
	guiObject.AutoLocalize = false
	guiObject.Text = ""
	local displayText = text
	for first, last in utf8.graphemes(displayText) do
		local grapheme = string.sub(displayText, first, last)
		guiObject.Text = guiObject.Text .. grapheme
		if defaultConfigurations.extraDelayOnSpace and grapheme == " " then
			wait(defaultConfigurations.delayTime)
		end
		wait(defaultConfigurations.delayTime)
	end
end

return TypeWriter

And here is a .rbxm file with the GUI. Download it and drag it with a mouse into an open workspace.
There are two scripts inside: TextWriter, which listens for property changes and later calls the function

local TypeWriter = require(game:GetService("ReplicatedStorage"):WaitForChild("TypeWriter"))

local TEXT = "This type writer is working like a charm!\n Warm regards, EssenceExplorer"

script.Parent:GetPropertyChangedSignal("Visible"):Connect(function()
	if (script.Parent.Visible) then
		TypeWriter.typeWrite(script.Parent, TEXT)
	end
end)

and PropertyChanger, which make your GUI visible.

local player = game:GetService("Players").LocalPlayer

-- Wait for character to load.
if (not player.Character) then player.CharacterAdded:Wait() end

-- After character loads, wait aditional 3 seconds.
wait(3)
script.Parent.Visible = true

File (belongs in StarterGui): Typewriter_property_change_Roblox.rbxm (3.4 KB)

1 Like

Oh thank you sir I will check It out!

1 Like