Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

A little camera issue help please?

Okay so I'm working with a game and currently when the user joins in the game by pressing the join game button it sets there camera mode to firstpersonlock and when they die it sets it to Classic so there mouse can be released and thereforth they can click the button again. However after the first time the player dies it wont work anymore help?

Script (To set camera mode back):

local player = script.Parent.Parent

repeat wait() until player.Character ~= nil

game.Players.LocalPlayer.Character.Humanoid.Died:connect(function()
	cam.CameraType = "Watch"
	script.Parent.Parent.CameraMode = Enum.CameraMode.Classic
end)

1 answer

✓ Accepted answer

Try this. The problem is that when the character dies, they get a new humanoid, so then you'll need their humanoid again to attach to the died event.

Make sure to put this into a LocalScript

local player = game.Players.LocalPlayer
local cam = game.Workspace.CurrentCamera

player.CharacterAdded:connect(function(chr)
	cam.CameraType = "Whatever It Should Be When They're Alive"
	cam.CameraMode = Enum.CameraMode.LockFirstPerson
	chr:WaitForChild("Humanoid").Died:wait()
	cam.CameraType = "Watch"
	script.Parent.Parent.CameraMode = Enum.CameraMode.Classic
end)

1 comment

0

Little late to the punch but danke it works fine. I figured it out myself when I was working on the project but thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.