Hello!
I'm making a story game, which features NPC Chat, and a tram. The script below opens a door, and the most important part is that it also.. How do I say it: Makes the message for the NPC? (The location of the script is: game.StarterGuI.Chat.Frame.script)
Script:
local chat = game.Players.LocalPlayer.PlayerGui.Chat.Frame
local text = chat:WaitForChild("TextLabel")
local name = chat.NpcName
local de = false
local conveyor = workspace.ConveyorStop
local vault = workspace.VaultDoor1
local door1 = vault.OpemDoor1
local door2 = vault.OpenDoor2
local tram = workspace.Tram
function message(speech)
for i = 1, #speech do
text.Text = string.sub(speech, 1, i)
wait()
end
end
conveyor.Touched:Connect(function()
if de == false then
de = true
conveyor.CFrame = conveyor.CFrame.LookVector * 30
wait(3)
chat.Visible = true
name.Text = "Walter"
message("Hello there! My name is Walter, let me open the door for you.")
wait(2)
for i = 0, 1, .01 do
door1.CFrame = door1.CFrame:Lerp(vault.Door2.CFrame, i)
wait()
end
message("So your a new employee, huh? Your name is... Alex- Wait, no last name? Unusual.")
for i = 0, 1, .01 do
door2.CFrame = door2.CFrame:Lerp(vault.Door1.CFrame, i)
wait()
end
wait(5)
message("So- Holy! You're 5 minutes late! You better get going...")
wait(3)
message("Well, it's nice meeting you! Let me start the rail.")
wait(1)
message("Bye!")
wait(3)
conveyor.CFrame = conveyor.CFrame.LookVector * 30
tram:MoveTo(Vector3.new(-233.519, 8.008, -816.172))
end
end)
Any help would be grateful!
