Roblox · Пигги
Игрок касается невидимой детали — экран темнеет, управление отключается, и персонаж сам бежит из точки Start по маршруту из трёх точек. За ним бегут твои риги, камера снимает спереди, играет твоя музыка, внизу идут субтитры. На финише управление возвращается.
Синим — что нужно создать.
Workspace └─ Cutscene (Folder) ├─ Trigger (Part) — CanCollide выкл.; коснулся — сцена ├─ Start (Part) — откуда бежит; Front смотрит вперёд └─ Point1, Point2, Point3 (Part) — маршрут; Point3 — финиш ReplicatedStorage └─ CutsceneRigs (Folder) — твои риги-преследователи └─ Rig (Model) — Humanoid и HumanoidRootPart SoundService └─ CutsceneMusic (Sound) — твоя музыка: SoundId StarterPlayer └─ StarterPlayerScripts └─ CutsceneLocal (LocalScript)
Где: StarterPlayer → StarterPlayerScripts · LocalScript
Зачем: Запуск, маршрут, риги, камера, музыка, субтитры.
-- игроки
local Players = game:GetService("Players")
-- здесь папка CutsceneRigs
local RS = game:GetService("ReplicatedStorage")
-- камера каждый кадр
local RunService = game:GetService("RunService")
-- здесь музыка
local SoundService = game:GetService("SoundService")
-- плавность
local TS = game:GetService("TweenService")
-- блокирует клавиши, если нет стандартного управления
local CAS = game:GetService("ContextActionService")
-- этот игрок
local player = Players.LocalPlayer
-- камера
local camera = workspace.CurrentCamera
-- Trigger, Start, Point1, Point2, Point3
local scene = workspace:WaitForChild("Cutscene")
-- деталь-запуск
local trigger = scene:WaitForChild("Trigger")
-- откуда бежит игрок
local start = scene:WaitForChild("Start")
-- твои риги
local rigs = RS:WaitForChild("CutsceneRigs")
-- твоя музыка
local music = SoundService:WaitForChild("CutsceneMusic")
-- true — сцена только один раз за игру
local ONCE = true
-- скорость игрока в сцене
local PLAYER_SPEED = 20
-- скорость ригов: чуть медленнее, не догоняют
local CHASER_SPEED = 19
-- на сколько studs позади стартует первый риг
local CHASER_DISTANCE = 10
-- расстояние между ригами
local CHASER_GAP = 5
-- камера впереди игрока, смотрит назад: видно погоню
local CAMERA_FRONT = 16
-- высота камеры
local CAMERA_HEIGHT = 5
-- сколько секунд ждать на последней точке
local END_PAUSE = 1
-- на каком расстоянии точка считается пройденной
local REACH = 4
-- застрял у точки дольше — идёт к следующей
local TIMEOUT = 15
-- стандартный бег Roblox для ригов
local RUN = {[Enum.HumanoidRigType.R15] = "rbxassetid://507767714", [Enum.HumanoidRigType.R6] = "rbxassetid://180426354"}
-- At — с какой секунды, Time — сколько показывать, Text — текст
local SUBTITLES = {
-- субтитр 1
{At = 1, Time = 3, Text = "Беги!"},
-- субтитр 2
{At = 5, Time = 3, Text = "Они совсем близко!"},
-- субтитр 3
{At = 9, Time = 3, Text = "Не оборачивайся!"},
-- конец таблицы
}
-- сцена идёт, сцена уже была
local busy, played = false, false
-- точки маршрута по порядку: Point1, Point2, Point3…
local function Route()
-- список
local list = {}
-- следующая точка есть
while scene:FindFirstChild("Point" .. (#list + 1)) do
-- в список
table.insert(list, scene["Point" .. (#list + 1)])
-- конец цикла
end
-- отдаём
return list
-- конец функции
end
-- бежать по точкам; вернётся, когда добежит
local function Run(humanoid, root, route)
-- каждая точка
for _, point in ipairs(route) do
-- время начала и последней команды
local began, moved = os.clock(), 0
-- пока жив и не застрял
while root.Parent and humanoid.Health > 0 and os.clock() - began < TIMEOUT do
-- добежал (высоту не считаем)
if ((root.Position - point.Position) * Vector3.new(1, 0, 1)).Magnitude <= REACH then break end
-- MoveTo сам отключается через 8 секунд — повторяем
if os.clock() - moved > 3 then
-- беги к точке
humanoid:MoveTo(point.Position)
-- запоминаем
moved = os.clock()
-- конец проверки
end
-- пауза
task.wait(0.1)
-- конец цикла
end
-- конец перебора
end
-- конец функции
end
-- экран: чёрные полосы, затемнение, субтитры
local function Screen()
-- экран
local gui = Instance.new("ScreenGui")
-- имя
gui.Name = "CutsceneGui"
-- на весь экран
gui.IgnoreGuiInset = true
-- поверх остального интерфейса
gui.DisplayOrder = 100
-- не сбрасывается
gui.ResetOnSpawn = false
-- полоса сверху и снизу
for _, y in ipairs({0, 0.88}) do
-- полоса
local bar = Instance.new("Frame")
-- 12% высоты
bar.Size = UDim2.fromScale(1, 0.12)
-- место
bar.Position = UDim2.fromScale(0, y)
-- чёрная
bar.BackgroundColor3 = Color3.new(0, 0, 0)
-- без рамки
bar.BorderSizePixel = 0
-- на экран
bar.Parent = gui
-- конец перебора
end
-- субтитры
local text = Instance.new("TextLabel")
-- имя
text.Name = "Subtitle"
-- размер
text.Size = UDim2.fromScale(0.8, 0.08)
-- на нижней полосе
text.Position = UDim2.fromScale(0.1, 0.9)
-- без фона
text.BackgroundTransparency = 1
-- пока пусто
text.Text = ""
-- белый
text.TextColor3 = Color3.new(1, 1, 1)
-- по размеру
text.TextScaled = true
-- жирный
text.Font = Enum.Font.GothamBold
-- на экран
text.Parent = gui
-- затемнение
local fade = Instance.new("Frame")
-- имя
fade.Name = "Fade"
-- весь экран
fade.Size = UDim2.fromScale(1, 1)
-- чёрное
fade.BackgroundColor3 = Color3.new(0, 0, 0)
-- пока прозрачное
fade.BackgroundTransparency = 1
-- поверх всего
fade.ZIndex = 5
-- на экран
fade.Parent = gui
-- показываем
gui.Parent = player:WaitForChild("PlayerGui")
-- отдаём
return gui, text, fade
-- конец функции
end
-- плавно затемнить (0) или открыть (1)
local function Fade(frame, value)
-- полсекунды
local tween = TS:Create(frame, TweenInfo.new(0.5), {BackgroundTransparency = value})
-- старт
tween:Play()
-- ждём
tween.Completed:Wait()
-- конец функции
end
-- риг бежит следом
local function Chaser(rig, index, route)
-- Humanoid рига
local humanoid = rig:FindFirstChildOfClass("Humanoid")
-- его центр
local root = rig:FindFirstChild("HumanoidRootPart")
-- это не риг
if not humanoid or not root then return end
-- все детали
for _, part in ipairs(rig:GetDescendants()) do
-- закреплённый риг не побежит
if part:IsA("BasePart") then part.Anchored = false end
-- конец перебора
end
-- скорость
humanoid.WalkSpeed = CHASER_SPEED
-- без имени над головой
humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
-- по очереди слева и справа
local side = index % 2 == 0 and 3 or -3
-- позади Start
rig:PivotTo(start.CFrame * CFrame.new(side, 3, CHASER_DISTANCE + index * CHASER_GAP))
-- проигрывает анимации
local animator = humanoid:FindFirstChildOfClass("Animator") or Instance.new("Animator")
-- в Humanoid
animator.Parent = humanoid
-- анимация
local animation = Instance.new("Animation")
-- бег под тип рига
animation.AnimationId = RUN[humanoid.RigType]
-- загружаем
local track = animator:LoadAnimation(animation)
-- по кругу
track.Looped = true
-- бежит
track:Play()
-- по тем же точкам
Run(humanoid, root, route)
-- добежал
track:Stop()
-- конец функции
end
-- показывать субтитры по времени
local function Subtitles(text)
-- начало
local began = os.clock()
-- каждая строка
for _, line in ipairs(SUBTITLES) do
-- ждём её секунду
task.wait(math.max(line.At - (os.clock() - began), 0))
-- сцена закончилась
if not text.Parent then return end
-- показываем
text.Text = line.Text
-- держим
task.wait(line.Time)
-- сцена закончилась
if not text.Parent then return end
-- убираем
text.Text = ""
-- конец перебора
end
-- конец функции
end
-- вся сцена
local function Play()
-- персонаж
local character = player.Character
-- Humanoid
local humanoid = character and character:FindFirstChildOfClass("Humanoid")
-- центр
local root = character and character:FindFirstChild("HumanoidRootPart")
-- не живой
if not humanoid or not root or humanoid.Health <= 0 then return end
-- сцена идёт
busy, played = true, true
-- стандартное управление; в игре со своим управлением его может не быть
local module = player.PlayerScripts:FindFirstChild("PlayerModule")
-- управление игрока или nil
local controls = module and require(module):GetControls()
-- стандартное есть
if controls then
-- выключаем WASD
controls:Disable()
-- модуля нет
else
-- перехватываем клавиши
CAS:BindActionAtPriority("CutsceneFreeze", function()
-- дальше они не идут
return Enum.ContextActionResult.Sink
-- WASD, пробел, стрелки
end, false, 3000, Enum.KeyCode.W, Enum.KeyCode.A, Enum.KeyCode.S, Enum.KeyCode.D, Enum.KeyCode.Space, Enum.KeyCode.Up, Enum.KeyCode.Down, Enum.KeyCode.Left, Enum.KeyCode.Right)
-- конец проверки
end
-- если сидел — встаёт
humanoid.Sit = false
-- экран
local gui, text, fade = Screen()
-- темнеет
Fade(fade, 0)
-- маршрут
local route = Route()
-- копии ригов — только у этого игрока
local actors = Instance.new("Folder")
-- имя
actors.Name = "CutsceneActors"
-- в мир
actors.Parent = workspace
-- игрок в Start
character:PivotTo(start.CFrame + Vector3.new(0, 3, 0))
-- обычная скорость
local speed = humanoid.WalkSpeed
-- скорость в сцене
humanoid.WalkSpeed = PLAYER_SPEED
-- камерой управляет скрипт
camera.CameraType = Enum.CameraType.Scriptable
-- начальное место камеры
local position = root.Position + root.CFrame.LookVector * CAMERA_FRONT + Vector3.new(0, CAMERA_HEIGHT, 0)
-- каждый кадр
RunService:BindToRenderStep("CutsceneCamera", Enum.RenderPriority.Camera.Value + 1, function(dt)
-- куда камере надо
local target = root.Position + root.CFrame.LookVector * CAMERA_FRONT + Vector3.new(0, CAMERA_HEIGHT, 0)
-- плавно догоняет
position = position:Lerp(target, math.min(dt * 3, 1))
-- смотрит на игрока
camera.CFrame = CFrame.lookAt(position, root.Position)
-- конец функции
end)
-- каждый риг
for index, rig in ipairs(rigs:GetChildren()) do
-- копия: оригинал остаётся
local copy = rig:Clone()
-- в мир
copy.Parent = actors
-- бежит сам, игрока не задерживает
task.spawn(Chaser, copy, index, route)
-- конец перебора
end
-- громкость
music.Volume = music:GetAttribute("Volume") or 0.5
-- музыка
music:Play()
-- субтитры
task.spawn(Subtitles, text)
-- экран открывается
Fade(fade, 1)
-- игрок бежит до последней точки
Run(humanoid, root, route)
-- стоп
humanoid:MoveTo(root.Position)
-- пауза
task.wait(END_PAUSE)
-- музыка затихает
TS:Create(music, TweenInfo.new(0.5), {Volume = 0}):Play()
-- темнеет
Fade(fade, 0)
-- стоп
music:Stop()
-- риги убраны
actors:Destroy()
-- камера свободна
RunService:UnbindFromRenderStep("CutsceneCamera")
-- обычная камера
camera.CameraType = Enum.CameraType.Custom
-- снова за игроком
camera.CameraSubject = humanoid
-- скорость как была
humanoid.WalkSpeed = speed
-- экран открывается
Fade(fade, 1)
-- интерфейс сцены убран
gui:Destroy()
-- управление возвращается
if controls then controls:Enable() else CAS:UnbindAction("CutsceneFreeze") end
-- сцена закончилась
busy = false
-- конец функции
end
-- точки видны только в Studio
start.Transparency = 1
-- скрываем маршрут
for _, point in ipairs(Route()) do point.Transparency = 1 end
-- коснулись Trigger
trigger.Touched:Connect(function(hit)
-- наш персонаж
local character = player.Character
-- сцена идёт, уже была или это не мы
if busy or (ONCE and played) or not character or not hit:IsDescendantOf(character) then return end
-- запускаем
Play()
-- конец функции
end)Запусти Play (или Run) и убедись:
Roblox · Piggy
The player touches an invisible part — the screen goes dark, controls turn off and the character runs by itself from the Start point along a route of three points. Your rigs run after them, the camera films from the front, your music plays and subtitles run at the bottom. At the finish the controls come back.
Blue — what you need to create.
Workspace └─ Cutscene (Folder) ├─ Trigger (Part) — CanCollide off; touch it — the scene starts ├─ Start (Part) — where the run starts; Front faces forward └─ Point1, Point2, Point3 (Part) — the route; Point3 is the finish ReplicatedStorage └─ CutsceneRigs (Folder) — your chasing rigs └─ Rig (Model) — Humanoid and HumanoidRootPart SoundService └─ CutsceneMusic (Sound) — your music: SoundId StarterPlayer └─ StarterPlayerScripts └─ CutsceneLocal (LocalScript)
Where: StarterPlayer → StarterPlayerScripts · LocalScript
Why: Start, route, rigs, camera, music, subtitles.
-- players
local Players = game:GetService("Players")
-- the CutsceneRigs folder is here
local RS = game:GetService("ReplicatedStorage")
-- the camera every frame
local RunService = game:GetService("RunService")
-- the music is here
local SoundService = game:GetService("SoundService")
-- smoothness
local TS = game:GetService("TweenService")
-- blocks keys if there are no standard controls
local CAS = game:GetService("ContextActionService")
-- this player
local player = Players.LocalPlayer
-- the camera
local camera = workspace.CurrentCamera
-- Trigger, Start, Point1, Point2, Point3
local scene = workspace:WaitForChild("Cutscene")
-- the start part
local trigger = scene:WaitForChild("Trigger")
-- where the player starts running
local start = scene:WaitForChild("Start")
-- your rigs
local rigs = RS:WaitForChild("CutsceneRigs")
-- your music
local music = SoundService:WaitForChild("CutsceneMusic")
-- true — the scene plays only once per game
local ONCE = true
-- the player's speed in the scene
local PLAYER_SPEED = 20
-- rig speed: a bit slower, they don't catch up
local CHASER_SPEED = 19
-- how many studs behind the first rig starts
local CHASER_DISTANCE = 10
-- distance between rigs
local CHASER_GAP = 5
-- the camera is ahead of the player looking back: the chase is visible
local CAMERA_FRONT = 16
-- camera height
local CAMERA_HEIGHT = 5
-- how many seconds to wait at the last point
local END_PAUSE = 1
-- at what distance a point counts as reached
local REACH = 4
-- stuck at a point longer — go to the next
local TIMEOUT = 15
-- the standard Roblox run for rigs
local RUN = {[Enum.HumanoidRigType.R15] = "rbxassetid://507767714", [Enum.HumanoidRigType.R6] = "rbxassetid://180426354"}
-- At — from which second, Time — how long to show, Text — the text
local SUBTITLES = {
-- subtitle 1
{At = 1, Time = 3, Text = "Беги!"},
-- subtitle 2
{At = 5, Time = 3, Text = "Они совсем близко!"},
-- subtitle 3
{At = 9, Time = 3, Text = "Не оборачивайся!"},
-- end of table
}
-- the scene is running, the scene has already played
local busy, played = false, false
-- route points in order: Point1, Point2, Point3…
local function Route()
-- the list
local list = {}
-- there is a next point
while scene:FindFirstChild("Point" .. (#list + 1)) do
-- into the list
table.insert(list, scene["Point" .. (#list + 1)])
-- end of loop
end
-- return it
return list
-- end of function
end
-- run through the points; returns when done
local function Run(humanoid, root, route)
-- each point
for _, point in ipairs(route) do
-- the start time and the last command time
local began, moved = os.clock(), 0
-- while alive and not stuck
while root.Parent and humanoid.Health > 0 and os.clock() - began < TIMEOUT do
-- arrived (height ignored)
if ((root.Position - point.Position) * Vector3.new(1, 0, 1)).Magnitude <= REACH then break end
-- MoveTo stops by itself after 8 seconds — repeat it
if os.clock() - moved > 3 then
-- run to the point
humanoid:MoveTo(point.Position)
-- remember
moved = os.clock()
-- end of check
end
-- pause
task.wait(0.1)
-- end of loop
end
-- end of loop
end
-- end of function
end
-- the screen: black bars, fade, subtitles
local function Screen()
-- the screen
local gui = Instance.new("ScreenGui")
-- name
gui.Name = "CutsceneGui"
-- full screen
gui.IgnoreGuiInset = true
-- on top of the rest of the interface
gui.DisplayOrder = 100
-- isn't reset
gui.ResetOnSpawn = false
-- a bar at the top and bottom
for _, y in ipairs({0, 0.88}) do
-- the bar
local bar = Instance.new("Frame")
-- 12% of the height
bar.Size = UDim2.fromScale(1, 0.12)
-- position
bar.Position = UDim2.fromScale(0, y)
-- black
bar.BackgroundColor3 = Color3.new(0, 0, 0)
-- no border
bar.BorderSizePixel = 0
-- onto the screen
bar.Parent = gui
-- end of loop
end
-- subtitles
local text = Instance.new("TextLabel")
-- name
text.Name = "Subtitle"
-- size
text.Size = UDim2.fromScale(0.8, 0.08)
-- on the bottom bar
text.Position = UDim2.fromScale(0.1, 0.9)
-- no background
text.BackgroundTransparency = 1
-- empty for now
text.Text = ""
-- white
text.TextColor3 = Color3.new(1, 1, 1)
-- scaled to fit
text.TextScaled = true
-- bold
text.Font = Enum.Font.GothamBold
-- onto the screen
text.Parent = gui
-- the fade
local fade = Instance.new("Frame")
-- name
fade.Name = "Fade"
-- the whole screen
fade.Size = UDim2.fromScale(1, 1)
-- black
fade.BackgroundColor3 = Color3.new(0, 0, 0)
-- transparent for now
fade.BackgroundTransparency = 1
-- on top of everything
fade.ZIndex = 5
-- onto the screen
fade.Parent = gui
-- show it
gui.Parent = player:WaitForChild("PlayerGui")
-- return it
return gui, text, fade
-- end of function
end
-- smoothly fade out (0) or in (1)
local function Fade(frame, value)
-- half a second
local tween = TS:Create(frame, TweenInfo.new(0.5), {BackgroundTransparency = value})
-- start
tween:Play()
-- wait
tween.Completed:Wait()
-- end of function
end
-- the rig runs behind
local function Chaser(rig, index, route)
-- the rig's Humanoid
local humanoid = rig:FindFirstChildOfClass("Humanoid")
-- its center
local root = rig:FindFirstChild("HumanoidRootPart")
-- it's not a rig
if not humanoid or not root then return end
-- all parts
for _, part in ipairs(rig:GetDescendants()) do
-- an anchored rig won't run
if part:IsA("BasePart") then part.Anchored = false end
-- end of loop
end
-- speed
humanoid.WalkSpeed = CHASER_SPEED
-- no name above the head
humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
-- alternating left and right
local side = index % 2 == 0 and 3 or -3
-- behind Start
rig:PivotTo(start.CFrame * CFrame.new(side, 3, CHASER_DISTANCE + index * CHASER_GAP))
-- plays animations
local animator = humanoid:FindFirstChildOfClass("Animator") or Instance.new("Animator")
-- into the Humanoid
animator.Parent = humanoid
-- the animation
local animation = Instance.new("Animation")
-- a run for the rig type
animation.AnimationId = RUN[humanoid.RigType]
-- load it
local track = animator:LoadAnimation(animation)
-- looped
track.Looped = true
-- runs
track:Play()
-- through the same points
Run(humanoid, root, route)
-- arrived
track:Stop()
-- end of function
end
-- show subtitles on time
local function Subtitles(text)
-- the start
local began = os.clock()
-- each line
for _, line in ipairs(SUBTITLES) do
-- wait for its second
task.wait(math.max(line.At - (os.clock() - began), 0))
-- the scene is over
if not text.Parent then return end
-- show it
text.Text = line.Text
-- hold
task.wait(line.Time)
-- the scene is over
if not text.Parent then return end
-- remove it
text.Text = ""
-- end of loop
end
-- end of function
end
-- the whole scene
local function Play()
-- the character
local character = player.Character
-- Humanoid
local humanoid = character and character:FindFirstChildOfClass("Humanoid")
-- the center
local root = character and character:FindFirstChild("HumanoidRootPart")
-- not alive
if not humanoid or not root or humanoid.Health <= 0 then return end
-- the scene is running
busy, played = true, true
-- the standard controls; a game with its own controls may not have them
local module = player.PlayerScripts:FindFirstChild("PlayerModule")
-- the player's controls or nil
local controls = module and require(module):GetControls()
-- the standard ones exist
if controls then
-- turn WASD off
controls:Disable()
-- no module
else
-- intercept the keys
CAS:BindActionAtPriority("CutsceneFreeze", function()
-- they don't go any further
return Enum.ContextActionResult.Sink
-- WASD, space, arrows
end, false, 3000, Enum.KeyCode.W, Enum.KeyCode.A, Enum.KeyCode.S, Enum.KeyCode.D, Enum.KeyCode.Space, Enum.KeyCode.Up, Enum.KeyCode.Down, Enum.KeyCode.Left, Enum.KeyCode.Right)
-- end of check
end
-- if sitting — stands up
humanoid.Sit = false
-- the screen
local gui, text, fade = Screen()
-- fades to dark
Fade(fade, 0)
-- the route
local route = Route()
-- rig copies — only for this player
local actors = Instance.new("Folder")
-- name
actors.Name = "CutsceneActors"
-- into the world
actors.Parent = workspace
-- the player at Start
character:PivotTo(start.CFrame + Vector3.new(0, 3, 0))
-- normal speed
local speed = humanoid.WalkSpeed
-- speed in the scene
humanoid.WalkSpeed = PLAYER_SPEED
-- the script controls the camera
camera.CameraType = Enum.CameraType.Scriptable
-- the camera's start position
local position = root.Position + root.CFrame.LookVector * CAMERA_FRONT + Vector3.new(0, CAMERA_HEIGHT, 0)
-- every frame
RunService:BindToRenderStep("CutsceneCamera", Enum.RenderPriority.Camera.Value + 1, function(dt)
-- where the camera should be
local target = root.Position + root.CFrame.LookVector * CAMERA_FRONT + Vector3.new(0, CAMERA_HEIGHT, 0)
-- catches up smoothly
position = position:Lerp(target, math.min(dt * 3, 1))
-- looks at the player
camera.CFrame = CFrame.lookAt(position, root.Position)
-- end of function
end)
-- each rig
for index, rig in ipairs(rigs:GetChildren()) do
-- a copy: the original stays
local copy = rig:Clone()
-- into the world
copy.Parent = actors
-- runs by itself without holding the player up
task.spawn(Chaser, copy, index, route)
-- end of loop
end
-- volume
music.Volume = music:GetAttribute("Volume") or 0.5
-- the music
music:Play()
-- subtitles
task.spawn(Subtitles, text)
-- the screen fades in
Fade(fade, 1)
-- the player runs to the last point
Run(humanoid, root, route)
-- stop
humanoid:MoveTo(root.Position)
-- pause
task.wait(END_PAUSE)
-- the music fades out
TS:Create(music, TweenInfo.new(0.5), {Volume = 0}):Play()
-- fades to dark
Fade(fade, 0)
-- stop
music:Stop()
-- the rigs are removed
actors:Destroy()
-- the camera is free
RunService:UnbindFromRenderStep("CutsceneCamera")
-- the normal camera
camera.CameraType = Enum.CameraType.Custom
-- following the player again
camera.CameraSubject = humanoid
-- speed as before
humanoid.WalkSpeed = speed
-- the screen fades in
Fade(fade, 1)
-- the scene interface is removed
gui:Destroy()
-- controls come back
if controls then controls:Enable() else CAS:UnbindAction("CutsceneFreeze") end
-- the scene is over
busy = false
-- end of function
end
-- the points are visible only in Studio
start.Transparency = 1
-- hide the route
for _, point in ipairs(Route()) do point.Transparency = 1 end
-- Trigger was touched
trigger.Touched:Connect(function(hit)
-- our character
local character = player.Character
-- the scene is running, already played or it's not us
if busy or (ONCE and played) or not character or not hit:IsDescendantOf(character) then return end
-- start it
Play()
-- end of function
end)Press Play (or Run) and make sure: