Camera Subject isn't focusing on humanoid

I have a cutscene and after, it sets the CameraSubject to game.Players.LocalPlayer:WaitForChild(“Humanoid”) and for some reason the camera stays in the same place and doesn’t follow the character.

When I checked the camerasubject property and hovered over it, it usually shows the path of the camerasubject, like game.Players.Username.Humanoid but all it showed was humanoid.

When I manually changed it to the actual player’s humanoid, it actually followed the player so I’m not sure why my code isn’t working.

I’ve tried many different things including:

Changing the game.Players.LocalPlayer.Character:WaitForChild(“Humanoid”) to
local player = game.Players.LocalPlayer
player.Character:WaitForChild(“Humanoid”)

and I’ve tried

player.Character.Humanoid

(Also on the Camera.CFrame line in the code, player isn’t the problem because I have a variable for it so it still leads to the player, and its a localscript)

I hope you to take a look with my post

1 Like

I’m not sure if it resolves it but it’s confusing as it’s not the same exact problem as the camera follows the players.

1 Like

set the camera to HumanoidRootPart Instead of Humanoid

I just did this to test it and it worked

local Player = game:GetService('Players').LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace:FindFirstChild("Camera")

repeat task.wait(1) warn('Character is not loaded yet') until Character ~= nil



Camera.CameraSubject = Character.PrimaryPart
Camera.CFrame = Character.PrimaryPart.CFrame
Camera.CameraType = Enum.CameraType.Scriptable

task.wait(5)

Camera.CameraType = Enum.CameraType.Custom

isnt what you trying to do is custom character

It sounds like you are experiencing an issue where the camera is not following the character as expected after a cutscene. This can happen if the CameraSubject is not set properly or if there’s a delay in updating the CameraSubject. Let’s troubleshoot this step by step.

  1. Ensure CameraSubject Update: Make sure that you are setting the CameraSubject after the cutscene, and any other camera-related changes, are complete. If you are using a LocalScript to set the CameraSubject, be cautious of the script execution order.
  2. Wait for Character to Load: You mentioned that you are using game.Players.LocalPlayer:WaitForChild("Humanoid"). While this is a valid approach, remember that if the player’s character hasn’t fully loaded yet, the code might execute before the character and its components are available. It’s safer to wait for the entire character to load before accessing its components.
  3. Use Player.Character: It’s recommended to use game.Players.LocalPlayer.Character to access the player’s character directly. If you are experiencing any issues with waiting for the character to load, try this approach:

luaCopy code

local player = game.Players.LocalPlayer
player.CharacterAdded:Connect(function(character)
    local humanoid = character:WaitForChild("Humanoid")
    game:GetService("RunService").RenderStepped:Connect(function()
        -- Update the CameraSubject in every frame
        game.Workspace.CurrentCamera.CameraSubject = humanoid
    end)
end)

This code waits for the player’s character to load and then continuously updates the CameraSubject to follow the character’s humanoid in each frame. This should ensure that the camera consistently follows the character.

  1. Debugging: If the issue persists, consider adding print statements at different points in your script to verify that the code is being executed when and where you expect it to.

By carefully checking the order of execution and making sure that the CameraSubject is set properly to a valid Humanoid object, you should be able to resolve the issue of the camera not following the character after the cutscene.

Tysm! The problem was that I didnt put a wait after the cutscene, ty

np glad i could help you with the problem:D

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.