The camera angle :
it stops working and goes into the normal roblox camera when you die and respawn
code:
local zoom = 140
local FieldOfView = 7
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = game.Workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Custom
local RunService = game:GetService("RunService")
RunService.RenderStepped:Connect(function()
Camera.FieldOfView = FieldOfView
if Character then
if Character:FindFirstChild("Head") then
game:GetService("SoundService"):SetListener(Enum.ListenerType.ObjectCFrame, Character.Head)
Camera.CFrame =
CFrame.new(Vector3.new(Character.Head.Position.X + zoom, Character.Head.Position.Y + zoom, Character.Head.Position.Z + zoom), Character.Head.Position)
end
end
end) ```
Try defining Character inside of the RenderStepped connection
local zoom = 140
local FieldOfView = 7
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Camera = game.Workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Custom
local RunService = game:GetService("RunService")
RunService.RenderStepped:Connect(function()
local Character = Player.Character or Player.CharacterAdded:Wait()
Camera.FieldOfView = FieldOfView
if Character then
if Character:FindFirstChild("Head") then
game:GetService("SoundService"):SetListener(Enum.ListenerType.ObjectCFrame, Character.Head)
Camera.CFrame =
CFrame.new(Vector3.new(Character.Head.Position.X + zoom, Character.Head.Position.Y + zoom, Character.Head.Position.Z + zoom), Character.Head.Position)
end
end
end) ```
1 Like
Your Character
variable will only exist for the first Character (or the Character at the point when the LocalScript executed). Consider wrapping this in a CharacterAdded connection or moving the LocalScript into StarterPlayer.StarterCharacterScripts
.
1 Like