I'm making a horror game and there are several invisible parts that when you touch them, they make a dialogue trigger. The first part works fine, but after that the next doesn't work when you touch it. Any help?
local TextLabel = script.Parent
local Text
function SoundEffect()
local Sound = Instance.new('Sound',workspace)
Sound.Name = 'TextSound'
Sound.SoundId = "http://www.roblox.com/asset/?id=3333976425"
Sound.PlaybackSpeed = 1
Sound.Volume = 1
Sound:Play()
coroutine.resume(coroutine.create(function()
wait(1)
Sound:Destroy()
end))
end
function setText(word)
Text = word
for i = 1, #Text do
TextLabel.Text = string.sub(Text, 1, i)
SoundEffect()
TextLabel.TextColor3 = Color3.fromRGB(255,255,255)
wait(0.1)
end
end
setText('...Wh...Shelter?')
wait(5)
setText('I`ll try getting there...')
wait(5)
workspace.haha.Part1:Destroy()
workspace.haha.Part2:Destroy()
workspace.haha.Part3:Destroy()
workspace.haha.Part4:Destroy()
setText("Let's go. Seems to be up ahead, if I keep going straight I'll reach it.")
game.Workspace.MainDoorAnnouncement.Touched:Connect(function()
setText("Darn, It's locked!")
workspace.MainDoorAnnouncement:Destroy()
game.ReplicatedStorage.Knife.Parent = workspace
game.ReplicatedStorage.MainDoorAnnouncement2.Parent = workspace
wait(2.5)
setText("I should probably look for some clues, maybe the tree?")
end)
game.Workspace.MainDoorAnnouncement2.Touched:Connect(function()
setText("What the...A knife? I feel like I'm being watched. I should check that door again just to be sure...")
workspace.Door.Parent = game.ReplicatedStorage
workspace.MainDoorAnnouncement2:Destroy()
game.ReplicatedStorage.Door2.Parent = game.Workspace
game.ReplicatedStorage.MainDoorAnnouncement3.Parent = workspace
end)
