local Players = game:GetService("Players") local Workspace = game:GetService("Workspace") local RunService = game:GetService("RunService") local player = Players.LocalPlayer -- GUI setup local gui = Instance.new("ScreenGui") gui.Name = "DeathCamGui" gui.ResetOnSpawn = false gui.IgnoreGuiInset = true gui.Enabled = false gui.Parent = player:WaitForChild("PlayerGui") local black = Instance.new("Frame") black.Size = UDim2.new(1, 0, 1, 0) black.BackgroundColor3 = Color3.new(0, 0, 0) black.BackgroundTransparency = 0 black.ZIndex = 0 black.Parent = gui local viewport = Instance.new("ViewportFrame") viewport.Size = UDim2.new(0.3, 0, 0.3, 0) -- Smaller square size viewport.Position = UDim2.new(0.5, 0, 0.5, 0) viewport.AnchorPoint = Vector2.new(0.5, 0.5) viewport.BackgroundTransparency = 1 viewport.ImageTransparency = 1 viewport.ZIndex = 1 viewport.Parent = gui local cam = Instance.new("Camera") cam.Name = "DeathCam" cam.Parent = viewport viewport.CurrentCamera = cam -- Clear GUI and viewport local function clear() gui.Enabled = false for _, obj in ipairs(viewport:GetChildren()) do if not obj:IsA("Camera") then obj:Destroy() end end viewport.ImageTransparency = 1 end -- Clone everything in the workspace local function cloneWorkspaceContents() local container = Instance.new("Model") container.Name = "ClonedScene" -- Iterate through all workspace contents and clone them for _, inst in ipairs(Workspace:GetChildren()) do local success, clone = pcall(function() return inst:Clone() end) if success and clone then -- Anchor parts and set CanCollide to false for _, part in ipairs(clone:GetDescendants()) do if part:IsA("BasePart") then part.Anchored = true part.CanCollide = false end end clone.Parent = container end end return container end -- Show the viewport death scene local function showDeathCam(char) local root = char:FindFirstChild("HumanoidRootPart") if not root then return end gui.Enabled = true local clonedScene = cloneWorkspaceContents() clonedScene.Parent = viewport -- Set camera to match the player's actual camera local playerCamera = game.Workspace.CurrentCamera cam.CFrame = playerCamera.CFrame -- Set the ViewportFrame camera to match the player's camera -- Adjust the camera's position and FOV to show a cropped view local offset = Vector3.new(0, 2, 5) -- Offset slightly to center on character cam.CFrame = cam.CFrame * CFrame.new(offset) -- Apply a tighter field of view to focus on the character and surroundings cam.FieldOfView = 50 -- Adjust this value to crop more/less around the character -- Fade in the viewport image more slowly for i = 1, 30 do -- Slower fade (can adjust the value for longer or shorter fade) viewport.ImageTransparency = 1 - (i * 0.033) -- Fade over 1 second RunService.RenderStepped:Wait() end task.wait(2) -- hold the image for 2 seconds clear() end -- Connect to death local function onCharacter(char) local hum = char:WaitForChild("Humanoid", 5) if not hum then return end hum.Died:Connect(function() showDeathCam(char) end) end -- Init if player.Character then onCharacter(player.Character) end player.CharacterAdded:Connect(function(char) clear() onCharacter(char) end)