I’ve been working on a source type game (specically gmod) and when you die in gmod, you immediatly go to third person which is what I’m trying to do here, but for some reason no matter what I try, it won’t go back to first person after respawn.
Heres the script (it is also a deathscreen script):
local deathscreen = script.Parent.Frame
local player = game.Players.LocalPlayer
local character = player.Character
character:WaitForChild("Humanoid").Died:Connect(function()
player.CameraMode = Enum.CameraMode.Classic
player.CameraMinZoomDistance = 30
player.CameraMaxZoomDistance = 30
deathscreen.Visible = true
task.wait(8)
player.CameraMinZoomDistance = 0.5
player.CameraMode = Enum.CameraMode.LockFirstPerson
deathscreen.Visible = false
end)
A LocalScript runs every single time your character respawns. This means that once your character has respawned, the old one is no longer in use. Using Humanoid.Died in a LocalScript isn’t really ever useful.
Since LocalScripts run per respawn, there’s no need for the Died event. You should be able to set LockFirstPerson after the player has properly loaded in.