Help connecting a function

Hello, I am trying to connect a function that typewrites a string based on when a item is visible or not. I am quite a bad scripter so sorry if this is a simple thing lol.

Here is the script:

local function typewrite(textlable,text)
	for i = 1, #text do
		textlable.Text = string.sub(text,1,i)
		
		wait(.05)
	end
end

if game.Workspace.Buttons.Dropper1Button.Transparency == 0 then typewrite(script.Parent.TextLabel, "This is a cool effect!")
if game.Workspace.Buttons.WallsButton.Transparency == 0 then typewrite(script.Parent.TextLabel, "If This Works it'd be even cooler!")
	
	end
end

Also, I got most of this script from YouTube and I’m just trying to change parts of it to match my needs.

You would either use the Changed event or the GetPropertyChangedSignal method.

Changed:

-- Example
workspace.Buttons.Dropper1Button.Changed:Connect(function(propName)
   if propName == "Transparency" and workspace.Buttons.Dropper1Button.Transparency == 0 then -- check if the Transparency property was changed, and if its value is 0
       typewrite(script.Parent.TextLabel, "This is a cool effect!")
   end
end)

GetPropertyChangedSignal:

-- Example
workspace.Buttons.Dropper1Button:GetPropertyChangedSignal("Transparency"):Connect(function()
   if workspace.Buttons.Dropper1Button.Transparency == 0 then -- check if the Transparency property is 0
       typewrite(script.Parent.TextLabel, "This is a cool effect!")
   end
end)
1 Like

Awesome I will go ahead and give that a try right now! Thank you!

It worked very well thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.