I'm trying to make dialogue appear as a gui by having the player click on an NPC. Here's the local script:
local ClickDetector = script.Parent.ClickDetector local text1 = "Hello, is there anything you'd like?" local text2 = "I know you probably did this unintentionally..." local text3 = "...but you forgot to give me my paycheck for youth employment!" local text4 = "I see..." local text5 = ". . ." local text6 = "But I can't pay you -" local text7 = "-WHAT?" local text8 = "You see, you didn't do enough work.." local text9 = "..you spent too much time talking with your friends, I'm afraid." local text10 = "Now, don't be late for lunch! ;)" local text10 = "So much for cleaning that teacher's nasty microwave..." local function Speak(player) local Dialogue = player:WaitForChild("PlayerGui"):WaitForChild("Dialogue") local DialogueBox = Dialogue:WaitForChild("DialogueBox") local SpeakerBox = Dialogue:WaitForChild("SpeakerBox") Dialogue.Enabled = true SpeakerBox.Text = "Teacher" for i = 1, #text1 do SpeakerBox.Text = string.sub(text1, 1, i) wait(0.04) end wait(3) SpeakerBox.Text = "You" for i = 1, #text2 do SpeakerBox.Text = string.sub(text1, 1, i) wait(0.04) end end ClickDetector.MouseClick:Connect(Speak)
The script isn't finished, but the basic part of enabling the gui when the brick is clicked isn't working. This script is the child of the brick. Can someone help me figure out what I'm doing wrong? Thanks in advance.
Never mind, the solution was to switch the local script to a regular script.