After the player presse's a button they will be in first person. But this code does not seem to be working.It is in a local script inside the players PlayerGui

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)


4 comments

0

Add a print statement after line 3 that the humanoid died, and add another print statement after line 4 to make sure Clicked is true.

0

I did that,they both print out

1

What isn't working? Is this all the code there is? We need more info.

0

it is not working because the player does not get the Fps when they die or reset