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

Why can't I reset the players camera?

I was reading through the wiki, and I was learning about camera manipulation. I finally figured out how to get the camera to move to where I want... How do I get it back?

I tried doing this..

-- Localscript
wait()
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
game.Workspace.CurrentCamera.CameraType = "Custom"

I undisabled the script when I need it, but then I get this error..

20:22:28.729 - Humanoid is not a valid member of Model 20:22:28.729 - Script 'Players.Player.Backpack.WalkAround', Line 2

1 answer

When working with a localscript for a player you always want to make a for loop to wait for the player's character because it is the last of the player's data to load so once it loads the character is ready to be modified.

Also while looking for something's child you want to use the :FindFirstChild() just so that you avoid errors.

local player = game.Players.LocalPlayer
repeat wait() until player.Character
game.Workspace.CurrentCamera.CameraSubject = player.Character:FindFirstChild('Humanoid')
game.Workspace.CurrentCamera.CameraType = "Custom"

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