Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why isn't text appearing in the textLabel?

This script is supposed to make the text "I have to get out of here..." appear once the Frame is set to visible. It doesn't work. The Frame will appear but no text will.

if script.Parent.Frame.Visible == true then
	
	local textLabel = script.Parent.Frame.TextLabel_Roundify_12px.TextLabel

	local function typewrite(object,text)
	for i = 1, #text, 1 do
		object.Text = string.sub(text,1,i)
		wait(0.1)
	end
	end
	
	
	wait(.1)
	print("yes")
	typewrite(textLabel, "I have to get out of here...")
end

I happen to be in a tropical storm so any responses may be delayed.

1 answer

✓ Accepted answer

The script runs as soon as you hit play, meaning that the script will stop because the Frame isn't visible at the time it ran (which is as soon as you play/run the game, scripts run very fast). You can use the Changed event to check if the frame becomes visible.

function Changed()
if script.Parent.Frame.Visible == true then

    local textLabel = script.Parent.Frame.TextLabel_Roundify_12px.TextLabel

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


    wait(.1)
    print("yes")
    typewrite(textLabel, "I have to get out of here...")
end
end

script.Parent.Frame.Changed:Connect(Changed)

Hope this helps. Also, I believe the line with textLabel would cause an error.

1 comment

0

Thank you. The script works as intended now.

This discussion is preserved as it was. New answers, comments, and votes are closed.