It's basically someone talking when I click a bell. Picture of my code:https://ibb.co/QfZLJWn I have a click detector as the child of the brick I want to press, and this Script as the child of the TextLabel that will pop up. Anything I'm doing wrong? If you have any questions DM me at rebloom#9167. Thanks.
From what I see, you don't assign the ClickDetector.MouseClick event to a function. The common way is to simply do
ClickDetector.MouseButton.MouseClick:Connect(function(playerWhoClicked) TextLabel = script.Parent local Text function soundEffect() local sound = Instance.new("Sound") sound.Parent = ClickDetector.Parent sound.Name = "Text Sound" sound.Volume = 1 sound:Play() game.Debris:AddItem(sound, sound.TimeLength) --Deletes the sound after it stops playing end) function setText(word) Text = word end for i = 1, #Text do TextLabel.Text = string.sub(Text, 1, i) soundEffect() TextLabel.Color3 = Color3.fromRGB(0, 0, 0) if script.Parent.Parent.Parent.Enabled then local frame = script.Parent.Parent frame.Visible = true wait(0.04) end end wait(3) setText("Good Evening") wait(3) setText("What can I do for ye?") print("Done") end)
If you're waiting for the event to happen, you'd write
ClickDetector.MouseClick:Wait() --code here