Getting straight to the point, I’m making a cutscene system in my game, but there’s something happening when I try to play them, like, they even work, but when it ends, my camera stays static and I simply CAN’T SOLVE THIS
Video:
Here’s the local module script that runs the cutscene:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = game:GetService("Players").LocalPlayer
local events = ReplicatedStorage.Events.Remote
local status = ReplicatedStorage.Status
local cutscenes = workspace.Essentials.Cutscenes
local cutscene
local anim
local load_anim: AnimationTrack
local camera = workspace.CurrentCamera
local cam_part = script.CameraPart
return function(cutscene_info: {["cutscene_name"]: string, ["destroy_character"]: boolean, ["respawn_point"]: CFrame, ["fade"]: boolean})
cutscene = cutscenes:FindFirstChild(cutscene_info.cutscene_name)
if cutscene then
anim = cutscene:FindFirstChildWhichIsA("Animation")
if anim then
if cutscene_info.destroy_character then
events.DestroyCharacter:FireServer()
end
camera.CameraType = Enum.CameraType.Scriptable
cam_part.Value = cutscene.Camera
load_anim = cutscene.AnimationController.Animator:LoadAnimation(anim)
load_anim:Play()
events.ChangeAttribute:FireServer(status, "player_state", "cutscene")
load_anim.Ended:Wait()
if cutscene_info.destroy_character then
events.LoadCharacter:FireServer()
player.CharacterAdded:Wait()
if cutscene_info.respawn_point then
player.Character:SetPrimaryPartCFrame(cutscene_info.respawn_point)
end
end
camera.CameraType = Enum.CameraType.Custom
events.ChangeAttribute:FireServer(status, "player_state", "in_game")
else
warn("Animation not found in " .. cutscene_info.cutscene_name)
end
else
warn("Cutscene not found: " .. cutscene_info.cutscene_name)
end
end
Inside this script i put an ObjectValue called “CameraPart” and other LocalScript, here’s this script code:
local status = game:GetService("ReplicatedStorage"):WaitForChild("Status")
local RunService = game:GetService("RunService")
local camera = workspace.CurrentCamera
local cam_part
RunService.RenderStepped:Connect(function()
if status:GetAttribute("player_state") == "cutscene" and camera.CameraType == Enum.CameraType.Scriptable and script.Parent.CameraPart.Value ~= nil then
camera.CFrame = script.Parent.CameraPart.Value.CFrame
end
end)
THANK YOU TO EVERYONE WHO HELPS!