First person death [EASY]


  • Death.

    A thing very common in roblox, in fact there are more deaths than kills. Many of you have noticed that the default death style is: the limbs fall off and you restart; the camera view is always third person, in this tutorial, I'm going to show you how to create a first person death. Now, the state of level for this tutorial is easy, because there isn't much to it.

    • Localscript usage
    • Character/Head/Humanoid application
    • Camera application
    • RunService/RenderStepped application
    local player = game.Players.LocalPlayer
    local character = player.Character
    
    character:WaitForChild("Humanoid")
    
    local hum = character.Humanoid
    local head = character.Head
    
    local camera = workspace.CurrentCamera
    local rs = game:GetService("RunService").RenderStepped
    
    hum.Died:connect(function()
    	rs:connect(function()
    		camera.CFrame = head.CFrame
    	end)
    end)
    

    recommendation: This works really well with rag-doll deaths.
    edit: Localscript can be located in either StarterGui or StarterGear


  • @rexbit

    When I did this, the camera stayed fixed to the heads position after respawn. What I did to fix this was to disconnect the function when the character was added.


  • @Master_JJ This script is probably meant to go in a place that resets when the character respawns, like StarterPack or StarterGui.


  • @Master_JJ I forgot to mention that the localscript must be placed in either StarterGui, StarterGear or the Character.

Log in to reply
 

Looks like your connection to Scripting Helpers was lost, please wait while we try to reconnect.