local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local TweenService = game:GetService("TweenService") local Lighting = game:GetService("Lighting") local player = Players.LocalPlayer local camera = workspace.CurrentCamera local FOV = 120 local LOOK_SPEED = 0.010 local SMOOTHING = 0.25 -- Jitter / Screen Shake Configuration local JITTER_INTENSITY = 0.02 local JITTER_SPEED = 25 local yaw = 0 local pitch = 0 local smoothYaw = 0 local smoothPitch = 0 local lastYaw = 0 local lastPitch = 0 local bob = 0 local rotatingTouch = nil local renderConnection local lastMoveState = false local isDead = false local deathCamCFrame = nil -- Post-Processing Setup local blurEffect = Lighting:FindFirstChild("CameraBlur") or Instance.new("BlurEffect") blurEffect.Name = "CameraBlur" blurEffect.Size = 0 blurEffect.Parent = Lighting local bloomEffect = Lighting:FindFirstChild("CameraBloom") or Instance.new("BloomEffect") bloomEffect.Name = "CameraBloom" bloomEffect.Intensity = 1.2 bloomEffect.Size = 24 bloomEffect.Threshold = 0.8 bloomEffect.Parent = Lighting local colorCorrection = Lighting:FindFirstChild("CameraColor") or Instance.new("ColorCorrectionEffect") colorCorrection.Name = "CameraColor" colorCorrection.Saturation = 0 colorCorrection.Parent = Lighting local function createRealisticGameOverUI() local pGui = player:WaitForChild("PlayerGui") local oldUI = pGui:FindFirstChild("GameOverGui") if oldUI then oldUI:Destroy() end local screenGui = Instance.new("ScreenGui") screenGui.Name = "GameOverGui" screenGui.ResetOnSpawn = false -- Dark Vignette/Overlay background local background = Instance.new("Frame") background.Size = UDim2.new(1, 0, 1, 0) background.BackgroundColor3 = Color3.new(0, 0, 0) background.BackgroundTransparency = 1 background.Parent = screenGui -- Heavy Vignette texture if you have one, otherwise a solid dark fade suffices local uigradient = Instance.new("UIGradient") uigradient.Color = ColorSequence.new(Color3.new(0,0,0)) uigradient.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0), NumberSequenceKeypoint.new(1, 1) }) local textLabel = Instance.new("TextLabel") textLabel.Size = UDim2.new(1, 0, 1, 0) textLabel.BackgroundTransparency = 1 textLabel.Text = "GAME OVER" textLabel.TextColor3 = Color3.new(0.5, 0, 0) -- Muted crimson red textLabel.Font = Enum.Font.SpecialElite or Enum.Font.SourceSansBold textLabel.TextSize = 72 textLabel.TextTransparency = 1 textLabel.Parent = screenGui screenGui.Parent = pGui return screenGui, background, textLabel end local function setupCharacter(character) task.wait(2) isDead = false deathCamCFrame = nil colorCorrection.Saturation = 0 -- Reset to normal colors if inputBeganConnection then inputBeganConnection:Disconnect() end if inputChangedConnection then inputChangedConnection:Disconnect() end if inputEndedConnection then inputEndedConnection:Disconnect() end if diedConnection then diedConnection:Disconnect() end local humanoid = character:WaitForChild("Humanoid") local root = character:WaitForChild("HumanoidRootPart") local head = character:WaitForChild("Head") local repairing = false task.delay(2, function() if character.Parent and not isDead then player.CameraMode = Enum.CameraMode.LockFirstPerson camera.CameraType = Enum.CameraType.Scriptable camera.FieldOfView = FOV end end) camera:GetPropertyChangedSignal("CameraType"):Connect(function() if repairing or isDead then return end if camera.CameraType ~= Enum.CameraType.Scriptable then repairing = true task.delay(2, function() if character.Parent and not isDead then player.CameraMode = Enum.CameraMode.LockFirstPerson camera.CameraType = Enum.CameraType.Scriptable camera.FieldOfView = FOV end repairing = false end) end end) player.CameraMode = Enum.CameraMode.LockFirstPerson camera.CameraType = Enum.CameraType.Scriptable camera.FieldOfView = FOV humanoid.AutoRotate = false -- Realistic Game Over Sequence diedConnection = humanoid.Died:Connect(function() isDead = true -- Freeze the camera's rotation context in world space right where they fell local lastCamCFrame = camera.CFrame -- Drop the height to simulate hitting the deck, tilt it sideways slightly deathCamCFrame = CFrame.new(lastCamCFrame.Position - Vector3.new(0, 3.5, 0)) * CFrame.Angles(0, 0, math.rad(45)) local ui, bg, label = createRealisticGameOverUI() -- Dramatic Post-Processing and UI Fade In TweenService:Create(colorCorrection, TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Saturation = -1}):Play() -- Desaturate entirely TweenService:Create(blurEffect, TweenInfo.new(3), {Size = 20}):Play() -- Heavy blur eye strain TweenService:Create(bg, TweenInfo.new(2), {BackgroundTransparency = 0.2}):Play() -- Fade to near pitch black TweenService:Create(label, TweenInfo.new(3, Enum.EasingStyle.Sine, Enum.EasingDirection.In), {TextTransparency = 0}):Play() local respawnConn respawnConn = player.CharacterAdded:Connect(function() -- Smoothly clean up and restore vision settings upon respawn TweenService:Create(colorCorrection, TweenInfo.new(1), {Saturation = 0}):Play() TweenService:Create(blurEffect, TweenInfo.new(1), {Size = 0}):Play() TweenService:Create(bg, TweenInfo.new(0.5), {BackgroundTransparency = 1}):Play() TweenService:Create(label, TweenInfo.new(0.5), {TextTransparency = 1}):Play() task.delay(0.5, function() ui:Destroy() end) respawnConn:Disconnect() end) end) -- Input System inputBeganConnection = UserInputService.InputBegan:Connect(function(input, processed) if isDead then return end if input.UserInputType == Enum.UserInputType.Touch and not processed then if input.Position.X > camera.ViewportSize.X * 0.5 then rotatingTouch = input end end end) inputChangedConnection = UserInputService.InputChanged:Connect(function(input) if isDead then return end local delta = Vector2.new(input.Delta.X, input.Delta.Y) if input.UserInputType == Enum.UserInputType.MouseMovement then yaw -= delta.X * LOOK_SPEED pitch -= delta.Y * LOOK_SPEED elseif input.UserInputType == Enum.UserInputType.Touch then if input == rotatingTouch then yaw -= delta.X * LOOK_SPEED pitch -= delta.Y * LOOK_SPEED end end pitch = math.clamp(pitch, -1.4, 1.4) end) inputEndedConnection = UserInputService.InputEnded:Connect(function(input) if input == rotatingTouch then rotatingTouch = nil end end) -- Visibility Updates local function updateVisibility() for _, obj in ipairs(character:GetDescendants()) do local isInTool = obj:FindFirstAncestorOfClass("Tool") ~= nil if obj:IsA("BasePart") then local n = obj.Name local visible = n == "Left Arm" or n == "Right Arm" or n == "Left Leg" or n == "Right Leg" or n == "LeftHand" or n == "RightHand" or n == "LeftLowerArm" or n == "RightLowerArm" or n == "LeftUpperArm" or n == "RightUpperArm" or n == "LeftFoot" or n == "RightFoot" or n == "LeftLowerLeg" or n == "RightLowerLeg" or n == "LeftUpperLeg" or n == "RightUpperLeg" or n == "Torso" or n == "UpperTorso" or n == "LowerTorso" obj.LocalTransparencyModifier = (isInTool or visible) and 0 or 1 end if obj:IsA("ParticleEmitter") or obj:IsA("Beam") or obj:IsA("Trail") then local parentPart = obj.Parent if parentPart and parentPart:IsA("BasePart") then local keepEffect = isInTool or parentPart.Name == "Left Arm" or parentPart.Name == "Right Arm" or parentPart.Name == "LeftHand" or parentPart.Name == "RightHand" or parentPart.Name == "LeftLowerArm" or parentPart.Name == "RightLowerArm" or parentPart.Name == "LeftUpperArm" or parentPart.Name == "RightUpperArm" or parentPart.Name == "Left Leg" or parentPart.Name == "Right Leg" or parentPart.Name == "LeftFoot" or parentPart.Name == "RightFoot" or parentPart.Name == "LeftLowerLeg" or parentPart.Name == "RightLowerLeg" or parentPart.Name == "LeftUpperLeg" or parentPart.Name == "RightUpperLeg" or parentPart.Name == "Torso" or parentPart.Name == "UpperTorso" or parentPart.Name == "LowerTorso" obj.Enabled = keepEffect end end end for _, acc in ipairs(character:GetChildren()) do if acc:IsA("Accessory") then local accType = acc.AccessoryType local shouldHide = accType == Enum.AccessoryType.Hair or accType == Enum.AccessoryType.Hat or accType == Enum.AccessoryType.Face or accType == Enum.AccessoryType.Neck for _, obj in ipairs(acc:GetDescendants()) do if obj:IsA("BasePart") then obj.LocalTransparencyModifier = shouldHide and 1 or 0 end end end end head.LocalTransparencyModifier = 1 if head:FindFirstChild("FaceFrontAttachment") then for _, face in ipairs(head:GetChildren()) do if face:IsA("Decal") then face.Transparency = 1 end end end end if renderConnection then renderConnection:Disconnect() end renderConnection = RunService.RenderStepped:Connect(function(dt) if not character.Parent then return end updateVisibility() -- Handle the camera if dead if isDead and deathCamCFrame then camera.CFrame = camera.CFrame:Lerp(deathCamCFrame, dt * 4) camera.FieldOfView = FOV return end local isMoving = humanoid.MoveDirection.Magnitude > 0.05 if isMoving ~= lastMoveState then lastMoveState = isMoving if isMoving then UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter else UserInputService.MouseBehavior = Enum.MouseBehavior.Default end end if isMoving then local _, cameraYaw, _ = camera.CFrame:ToOrientation() root.CFrame = CFrame.new(root.Position) * CFrame.Angles(0, cameraYaw, 0) bob += dt * 12 else bob = 0 end local bobOffset = math.sin(bob) * 0.08 smoothYaw = smoothYaw + (yaw - smoothYaw) * SMOOTHING smoothPitch = smoothPitch + (pitch - smoothPitch) * SMOOTHING -- Calculate Motion Blur local yawDelta = math.abs(smoothYaw - lastYaw) local pitchDelta = math.abs(smoothPitch - lastPitch) local totalDelta = (yawDelta + pitchDelta) / dt blurEffect.Size = math.clamp(totalDelta * 0.5, 0, 24) lastYaw = smoothYaw lastPitch = smoothPitch -- Calculate Camera Jitter local currentTime = os.clock() * JITTER_SPEED local jitterX = math.noise(currentTime, 0, 0) * JITTER_INTENSITY local jitterY = math.noise(0, currentTime, 0) * JITTER_INTENSITY local jitterZ = math.noise(0, 0, currentTime) * JITTER_INTENSITY local jitterCFrame = CFrame.new(jitterX, jitterY, jitterZ) local camPos = head.CFrame.Position + Vector3.new(0, bobOffset, 0) local camRot = CFrame.Angles(0, smoothYaw, 0) * CFrame.Angles(smoothPitch, 0, 0) camera.CFrame = CFrame.new(camPos) * camRot * jitterCFrame camera.FieldOfView = FOV end) end if player.Character then setupCharacter(player.Character) end player.CharacterAdded:Connect(setupCharacter)