I was creating a typewriter effect for the GUI when I encountered this problem:
"Players.dangkhoavtnt123.PlayerGui.MonsterKidBubble.MainFrame.Continue.LocalScript:24: attempt to index string with 'Text'"
My Script:
-- Dialogs
local line1 = "* Have you ever thought about\n a world where everything is\n exactly the same..."
local line2 = "* Except you don't exist?"
local line3 = "* Everything functions\n perfectly without you..."
local line4_1 = "* Ha, "
local line4_2 = "ha..."
local line4_3 = "* The thought terrifies me."
-- Instances
local dialog2 = script.Parent.Parent.MonsterKidDialog
local button = script.Parent
local gui = script.Parent.Parent.Parent
local dialogNumber = script.Parent.Value.Value
-- Main script
button.MouseButton1Click:Connect(function()
dialog2 = ""
print("dialog passed")
if dialogNumber == 1 then
for i = 1, #line1 do
dialog2.Text = string.sub(line1, 1, i)
wait(0.04)
end
elseif dialogNumber == 2 then
end
dialogNumber = dialogNumber + 1
end)
Please help me.

1 comment
thank you for the answer!