I want the script to give the player the FirstPerson camera mode but when the player resets are dies it does not happen Here is the code (It is in a local script in the players gui)
Player = game.Players.LocalPlayer
Clicked = false
local player = game.Players.LocalPlayer
Cam = workspace.CurrentCamera -- Currently not in use
Player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
if Clicked then
character:WaitForChild("Humanoid")
print("The player has died")
Player.CameraMode = Enum.CameraMode.LockFirstPerson
print(Clicked)
end
end)
end)
game.workspace.Lobby.Log.PlayButton.SurfaceGui.ImageButton.MouseButton1Click:connect(function()
Clicked = true
Player.CameraMode = Enum.CameraMode.LockFirstPerson
end)

1 comment
Humanoid statuses are notoriously unreliable, and in my experience, only fire half the time. Sadly, that's the best shot you have. Just a couple of corrections I'd like to make: LockFirstPerson hasn't been working online recently and should be replaced with "Player.CameraMaxZoomDistance = 0". There's also an extra ) on the end at line 23.