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)
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
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