I have created a function that turns a player first person (locked first person) camera mode after they’ve toggled the third person mode. Everything works fine; the players can toggle between the two modes using a button. Though, if the player dies while using the third person camera, it becomes messed up; the player should go first person, but it is quite zoomed in. I then decided to debug the code by using print statements, and when toggling between the two modes, the print statements all work. But, I’ve attached a Humanoid.Died function to help me return the player to the first person mode after death, and it didn’t work. The debug statement only prints “Humanoid”, and gives an infinite yield warning for char:WaitForChild(“Head”). It doesn’t have any errors either. Here is the code within the function, please help:
Yes. Essentially, what I realized was that when obtaining the CFrame of the “Head”, it would be very inconsistent due to the characte respawning, which leaves the parts to replicate. So, I created a const variable that never changes whenever the player joins, and gets the CFrame of their head. The name of the variable is headPos. Also, I removed the :WaitForChild(“Humanoid”) since I didn’t want to wait for the humanoid to replicate, and instead, I put the CameraSubject to “char”, and it works the same way. Also, I removed the Humanoid.Died function which sent a remove event to the client telling it that the player died and replaced it with a CharacterAdded function. Here is the code: