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

Typewriter effect only does one line of changing then doesnt work?

Happy October! I was doing something for a upcoming simulator Ima make. But, I cant get the Boss Battle Typewritter effect to work? Here is the code.

function typeWrite(object, text)
	for i = 1,#text,1 do
		object.Text = string.sub(text,1,i)
		wait(0.05)
	end
end
wait(6)
typeWrite(script.Parent.Textt,"Hello, I'm known as the Bacon Boss.")
wait(3)
typeWrite(script.Parent.Name,"Bacon Boss")
wait(2)
typeWrite(script.Parent.Textt,"Congrats on finding me, but you'll never win.")
wait(2)
typeWrite(script.Parent.Name,"The Game Creators")
wait(1)
typeWrite(script.Parent.Textt,"Just saying, if you win, you get to keep Not's Noob Skin.. So I'd try if I were you.")
wait(2)
typeWrite(script.Parent.Textt,"Blxefirx & Nottsbuses give you the best of luck")
wait(6)
script.Parent:TweenPosition(UDim2.new(0.5, -115,1.141, -100), "Out", "Bounce", 8, true)

I get a output error of:

Players.Blxefirx.PlayerGui.BossBattleText.Frame.LocalScript:3: attempt to index string with 'Text'

I don't know what the problem is,

Sincerely, Blxefirx

1 answer

✓ Accepted answer

The error means you are trying to index a string with Text. For example: Player.Name.Text

Correct me if I'm wrong, I'm assuming you have an object under script.Parent called Name. Name is a property which every object has. So the script thinks you are referring to the Name of the object. Instead re-name it or do :FindFirstChild("Name")

function typeWrite(object, text)
    for i = 1,#text,1 do
        object.Text = string.sub(text,1,i)
        wait(0.05)
    end
end
wait(6)
typeWrite(script.Parent.Textt,"Hello, I'm known as the Bacon Boss.")
wait(3)
typeWrite(script.Parent:FindFirstChild("Name"),"Bacon Boss")
wait(2)
typeWrite(script.Parent.Textt,"Congrats on finding me, but you'll never win.")
wait(2)
typeWrite(script.Parent:FindFirstChild("Name"),"The Game Creators")
wait(1)
typeWrite(script.Parent.Textt,"Just saying, if you win, you get to keep Not's Noob Skin.. So I'd try if I were you.")
wait(2)
typeWrite(script.Parent.Textt,"Blxefirx & Nottsbuses give you the best of luck")
wait(6)
script.Parent:TweenPosition(UDim2.new(0.5, -115,1.141, -100), "Out", "Bounce", 8, true)

4 comments

1

Oh!! That makes sense.

1

Thank you very much!

0

You're welcome!

1

Yeah, it works perfectly, now just gotta make sure the UDim2 hides the whole GUI ;P, once again thanks!

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