Roblox Studio - How to make Cutscenes
HTML-код
- Опубликовано: 10 фев 2025
- -- Services --
local TS = game:GetService("TweenService")
-- Variables --
local Camera = game.Workspace.CurrentCamera
local Cutscenes = game.Workspace.Cutscenes
local BlackFrame = script.Parent
-- Script --
local function RunCutscenes(CameraPos, CSTime, Transition, TransitionTime, BF, BFTT, BFE, BFETT)
if Transition ~= nil then
if BF then
BlackFrame.BackgroundTransparency = 0
TS:Create(BlackFrame, TweenInfo.new(BFTT), {BackgroundTransparency = 1}):Play()
end
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = CameraPos.CFrame
local Animate = TS:Create(Camera, TweenInfo.new(TransitionTime), {CFrame = Transition.CFrame})
Animate:Play()
Animate.Completed:Wait()
wait(CSTime)
if BFE then
BlackFrame.BackgroundTransparency = 1
local BFTween = TS:Create(BlackFrame, TweenInfo.new(BFETT), {BackgroundTransparency = 0})
BFTween:Play()
BFTween.Completed:Wait()
end
Camera.CameraType = Enum.CameraType.Custom
BlackFrame.BackgroundTransparency = 1
else
if BF then
BlackFrame.BackgroundTransparency = 0
TS:Create(BlackFrame, TweenInfo.new(BFTT), {BackgroundTransparency = 1}):Play()
end
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = CameraPos.CFrame
wait(CSTime)
if BFE then
BlackFrame.BackgroundTransparency = 1
local BFTween = TS:Create(BlackFrame, TweenInfo.new(BFETT), {BackgroundTransparency = 0})
BFTween:Play()
BFTween.Completed:Wait()
end
Camera.CameraType = Enum.CameraType.Custom
BlackFrame.BackgroundTransparency = 1
end
end
wait(10)
-- 1 : Camera
-- 2 : Time of the cutscene
-- 3 : Camera to transition to smoothly
-- 4 : Time to transition
-- 5 : BlackScreen at the start
-- 6 : BlackScreen Time
-- 7 : BlackScreen at the end
-- 8 : BlackScreen at the end time
RunCutscenes(Cutscenes.camera1, 10, nil, nil, true, 1, true, 1)
RunCutscenes(Cutscenes.camera2, 5, nil, nil, true, 1)
RunCutscenes(Cutscenes.camera2, 5, Cutscenes.camera3, 5, nil, nil, true, 2)