How do I create this function?

Hey! How can I create a function that when the player is dead he goes back to third person mode?

1 Like

(local script)

local player = game.Players.LocalPlayer
player.CharacterAdded:Wait()
player.Character.Humanoid.Died:Connect(function()
player.CameraMode = Enum.CameraMode.LockFirstPerson
end)
2 Likes

but where do i put the local script?

starterplayerscripts charactersssss

nvm doesn’t work lol. I put it in starterplayerscripts and it doesn’t work

What is the script error? characters

there is no error but it just doesn’t work

are you sure it’s a local script inside starterplayerscripts?

old post

try adding

repeat wait() until player.Character
repeat wait() until player.Character:FindFirstChild("Humanoid")

instead of characteradded:Wait()

Edit: came back to this, never do this. The method in the solution should be used instead.