I have implemented a system where players can toggle between a third person camera and a first person camera. Whenever the player dies and they are in the third person mode, I’ve attempted to reset them back to the first person mode, but it doesn’t work; the player stays in third person mode. Here is the code:
Server:
game:GetService("Players").PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
game:GetService("ReplicatedStorage").Died:FireClient(player)
end)
end)
Client:
local camera = game:GetService("Workspace").CurrentCamera
local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
game:GetService("ReplicatedStorage").Died.OnClientEvent:Connect(function()
camera.CameraSubject = char
camera.CFrame = char:WaitForChild("HumanoidRootPart").CFrame
char.Humanoid.WalkSpeed = 16
char.Humanoid.JumpPower = 50
camera.FieldOfView = 70
camera.DiagonalFieldOfView = 126.595
camera.MaxAxisFieldOfView = 101.495
Lighting.FogEnd = 75
player:WaitForChild("Cam").Value = "f" -- first person mode
end)
Unfortunately, when the player respawns, the cam value is still at “t” and the camera is not changed to the first person camera manipulations. Any thoughts?