CCCPaste

MainScript NEW

-- Phantom
-- If you named your things the same as in the video then you don't have to rename things.

local StarterGui = game:GetService("StarterGui")
local Players = game:GetService("Players")
-- No need to touch above

-- You inserted these in ReplicatedStorage
local FrameVisible = game.ReplicatedStorage:FindFirstChild("FrameVisible") -- BoolValue
local PlayerImage = game.ReplicatedStorage:FindFirstChild("PlayerImage") -- RemoteEvent
local PlayerName = game.ReplicatedStorage:FindFirstChild("PlayerName") -- StringValue
local NPCImage = game.ReplicatedStorage:FindFirstChild("NPCImage")
local Text = game.ReplicatedStorage:FindFirstChild("Text") -- StringValue

local NPC = game.Workspace:FindFirstChild("NPC")

local Teleports = game.Workspace:FindFirstChild("Teleports")
local Sounds = game.Workspace:FindFirstChild("Sounds")
local Checkpoints = game.Workspace:FindFirstChild("Checkpoints")

-- Blank variables, do not touch
local RandomPlayer
local Message

function TypeSound()
    local Sound = Instance.new("Sound")
    Sound.Parent = game.Workspace
    Sound.Name = "TypeSound"
    Sound.SoundId = "http://www.roblox.com/asset/?id=3333976425" -- You can change the typing sound if you like
    Sound.PlaybackSpeed = 1
    Sound.Volume = 0.5
    Sound:Play()
    coroutine.resume(coroutine.create(function()
        wait(1)
        Sound:Destroy()
    end))
end

function SetText(word)
    Message = word
    for i = 1, #Message do
        Text.Value = string.sub(Message, 1, i)
        TypeSound()
        wait(0.05) -- Time between each letter, 0.05 seconds is recommended. The smaller the faster.
    end
end

function SetNPCText(word)
    Message = word
    for i = 1, #Message do
		Text.Value = string.sub(Message, 1, i)
		NPCImage:FireAllClients(NPCImage)
		PlayerName.Value = "Jeff" -- Put whatever you like here
        TypeSound()
        wait(0.05) -- Time between each letter, 0.05 seconds is recommended. The smaller the faster.
    end
end

function SetRandomPlayerText(word)
    Message = word
    RandomPlayer = nil
    wait()
    RandomPlayer = Players:GetChildren()[math.random(1, #Players:GetChildren())]
    PlayerName.Value = RandomPlayer.Name -- Sets the PlayerName to a random player's name
    PlayerImage:FireAllClients(RandomPlayer) -- Sets the image to a random player's head
    for i = 1, #Message do
        Text.Value = string.sub(Message, 1, i)
        TypeSound() -- Plays the typing sound
        wait(0.05)
    end
end

wait(10)
FrameVisible.Value = true
SetNPCText("Hello and welcome to the Camping Site!")
wait(5)
SetText("You will be staying here for a few nights!")
wait(5)
SetRandomPlayerText("Yay!")
wait(5)
SetNPCText("Go take a look inside that house over there.")
wait(2)
NPC.Humanoid:moveTo(Checkpoints.Checkpoint1.Position)
NPC.Humanoid.MoveToFinished:Wait()
for i, v in pairs(Players:GetChildren()) do
	v.Character.Torso.CFrame = Teleports.HouseTeleport.CFrame
end
wait(3)
SetRandomPlayerText("Looks cozy!")
wait(5)
SetNPCText("Ok everyone, time to go outside.")
wait(5)
NPC.Humanoid:moveTo(Checkpoints.Checkpoint2.Position)
NPC.Humanoid.MoveToFinished:Wait()
wait(0.2)
NPC.Humanoid:moveTo(Checkpoints.Checkpoint3.Position)
NPC.Humanoid.MoveToFinished:Wait()
for i, v in pairs(Players:GetChildren()) do
	v.Character.Torso.CFrame = Teleports.PathTeleport.CFrame
end