I making a cutscene script , and it’s working right but when I reset and use it again the camera will bug and stay the position where I die
local player = game.Players.LocalPlayer
local char = player.CharacterAdded:Wait()
local cam = game.Workspace.CurrentCamera
local RunService = game:GetService("RunService")
local replicateRemote = game.ReplicatedStorage:FindFirstChild("Cutscene"):FindFirstChild("TWDonut")
function Cinematic(folder)
local CinematicsFolder = folder
local FrameTime = 0
local Connection
Connection = RunService.RenderStepped:Connect(function(DT)
local NewDT = DT * 60
FrameTime += NewDT
local NeededFrame = CinematicsFolder.Frames:FindFirstChild(tonumber(math.ceil(FrameTime)))
if NeededFrame then
cam.CameraType = Enum.CameraType.Scriptable
char.Humanoid.AutoRotate = false
cam.CFrame = char.HumanoidRootPart.CFrame * NeededFrame.Value
else
Connection:Disconnect()
char.Humanoid.AutoRotate = true
cam.CameraType = Enum.CameraType.Custom
end
end)
end
replicateRemote.OnClientEvent:Connect(function()
char.Humanoid.Died:Connect(function()
char = player.CharacterAdded:Wait()
cam.CameraSubject = char.Humanoid
cam.CameraType = Enum.CameraType.Custom
end)
Cinematic(script.Donut_Camera)
end)
Reset once and use the cutscene move : https://gyazo.com/049d1efc30669316f43177493f924c45 5