How to make camera follow me after death

What do you want to achieve?

I am trying to make the camera look from upside down

What is the issue?

After i die, the camera doesn’t follow me anymore

The code is

local Offset = Vector3.new(-7,30,-7)
local FieldOfView = 90
local Player = script.Parent.Parent
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = game.Workspace.CurrentCamera
local RunService = game:GetService("RunService")
local Humanoid = Character:WaitForChild("Humanoid")

Camera.FieldOfView = FieldOfView
local function onRenderStep()

	local PlayerPosition = Character:WaitForChild("HumanoidRootPart").Position
	local CameraPosition = PlayerPosition + Offset
	Camera.CoordinateFrame = CFrame.new(CameraPosition, PlayerPosition)
end

RunService:BindToRenderStep('Camera', Enum.RenderPriority.Camera.Value, onRenderStep)

robloxapp-20210914-1100457.wmv (1005.4 KB)

Please Help!!

I tested your code out, and it worked for me even after resetting. Is there any other code interfering?

1 Like

Hey thanks for reply.

There is another script in my local player

local Player = game:GetService("Players").LocalPlayer

local Character = Player.Character or Player.CharacterAdded:Wait()

local Humanoid = Character:WaitForChild("Humanoid")

Humanoid.JumpPower = 0

Character:WaitForChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Jumping, false)

if Player:WaitForChild('PlayerGui'):FindFirstChild('TouchGui') then
	Player:WaitForChild('PlayerGui').TouchGui.TouchControlFrame.JumpButton:Destroy()
end

I see. That shouldn’t be interfering with your code. What is the name of your CameraScript, and where is it placed?

1 Like

Capture
SkyCameraView is the name

Placing your scripts in StarterGui fixes the problem.

1 Like

Omg Thank you!! How did it happen!!

It’s because if it’s in StarterPlayerScripts, it won’t run again since it doesn’t refresh the script whenever you respawn just like StarterGui or StarterCharacterScripts

1 Like