Help needed: How do you make a cutscene with an animation playing?

Hello, I’m wondering, how do you make a cutscene, that is playing a animation when the player gets to that part? For example, there is a cutscene, with a person doing dances, eating, etc. How could I make something like this?

Thank you for reading and your help.

2 Likes

Once your player has reached to a certain destination or completed a certain objective, you can have the cutscene copy and pasted in. In the cutscene’s script, you can enable all of the animations to play, and you can fire some type of event to the player for it to play a camera tween or something, and you’ll have the server wait the cutscene’s duration to continue the game.

1 Like

Is there a certain script I should use? Or where should i add it into the script?
This is my cutscene script:

repeat wait () until game.Workspace.CurrentCamera ~= nil

local c = game.Workspace.CurrentCamera

local data = LoadLibrary("RbxUtility").DecodeJSON(script.CutsceneData.Value)

local rs = game:GetService("RunService").RenderStepped

function tweenCam(c1,f1,time,fov,roll)

local c0,f0,fv0,r0,frames = c.CoordinateFrame,c.Focus,c.FieldOfView,c:GetRoll(),time/0.015

for i = 1,frames do

c.CameraType = "Scriptable"

c.CoordinateFrame = CFrame.new(c0.p:lerp(c1.p,i/frames),f0.p:lerp(f1.p,i/frames))

c.FieldOfView = (fv0+(fov-fv0)*(i*(1/frames)))

c:SetRoll(r0+(roll-r0)*(i*(1/frames)))

rs:wait()

end

end

print("Running")

c.CameraSubject = nil

c.CameraType = "Scriptable"

c.CoordinateFrame = CFrame.new(unpack(data[1].c1))

c.Focus = CFrame.new(unpack(data[1].f1))

c.FieldOfView = data[1].FOV

c:SetRoll(data[1].Roll)

if script:findFirstChild("SkipCutsceneGuiValue") then

local gui = script.SkipCutsceneGui:clone()

gui.Parent = game.Players.LocalPlayer.PlayerGui

gui.Cutscene.Value = script

gui.Main.Debug.Disabled = false

script.SkipCutsceneGuiValue.Value = gui

end

for i = 2,#data do

tweenCam(CFrame.new(unpack(data[i].c1)),CFrame.new(unpack(data[i].f1)),data[i].step,data[i].FOV,data[i].Roll)

end

c.CameraSubject = game.Players.LocalPlayer.Character.Humanoid

c.CameraType = "Custom"

c.FieldOfView = 70

if script:findFirstChild("SkipCutsceneGuiValue") then

if script.SkipCutsceneGuiValue.Value ~= nil then

script.SkipCutsceneGuiValue.Value:Destroy()

end

end

script:Destroy()
1 Like

Uh…

That’s a good script to animate the camera around. If you want to do animations, you should probably a code like this somewhere:

local CutsceneAnim = Humanoid:LoadAnimation(TheAnimToPlay)
CutsceneAnim:Play()

If the cutscene is only local, then leave in a local script, otherwise if everyone is suppose to see it, I suggest leaving it in a server script.

6 Likes

Thanks! It works now! I appreciate your help!:smile:

1 Like