CutsceneService
Link:
Roblox asset store: https://create.roblox.com/store/asset/107702102941172/CutsceneService
If your a new beginner or a super expert at coding, this module can help you ether way. if your struggling or ant help, here is a example code
local CutsceneService = require(script.Parent.CutsceneService)
task.wait(5) -- Makes sure the player has loaded in
local cutscene = CutsceneService:create("myCutscene", function(CutsceneConfig, name) -- name of the cutscene and function (the function table which you make the cameras and so on. the name of the cutscene)
local camera = CutsceneConfig:addCamera(CFrame.new(10, 10, 10), "Tween", 70, 2, Enum.EasingStyle.Sine) -- EndCframe/destination, cameraType/Transition, FOV/field of view, length
camera:play() -- this function plays the camera changes
camera.Completed:Wait() -- waits until the camera is done transiting
local npc = CutsceneConfig:createNpc(workspace.Rig)
npc:playAnimation(16709557386)
task.wait(2)
-- to finish it we are gonna use this function
CutsceneConfig:finalize()
end)
cutscene:execute() -- makes the cutscene fire
To start of of, you need to require the module:
local CutsceneService = require(script.Parent.CutsceneService)
Then, to create the cutscene we need to use the create function:
CutsceneService:create("myFunction", function(CutsceneConfig, name)
end)
This takes in 2 arguments: the name, and the and a function.
The function takes also in 2 arguments: the cutscene config, and the name you choose (just in case)
Now, to execute the cutscene we made we can do this:
CutsceneService:create("myFunction", function(CutsceneConfig, name)
end):execute()
Or this:
local cutscene = CutsceneService:create("myFunction", function(CutsceneConfig, name)
end)
cutscene:execute()
The cutscene config has 3 functions:
- addCamera
CutsceneConfig:addCamera(CFrame.new(10, 10, 10), βFadeβ, 70, 2, Enum.EasingStyle.Sine) β The destination, the cameraType, the FOV (Field of view), The length (Is not used in the instant cameraType), easingStyle and easingDirection (optional for both the Fade, and the Tween)
- createNpc
CutsceneConfig:createNpc(workspace.Rig) β Takes the npc you want to add
- finalize
CutsceneConfig:finalize β Finishes it
addCamera has two things you can index it. The first one is
camera:play() -- Plays the camera animation which you set when creating a camera (CameraType)
The second one is
camera.Completed:Wait() -- Yields until camera animation is completed
The createNpc has one function:
npc:playAnimation(animationId) -- Takes in an animation ID
And the last function in the CutsceneConfig is the finialize
The finalize finishes up the cutscene
The last function it has is
CutsceneService:eliminate(name) -- The name of the cutscene