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

why wont Camera revert to players head?

ok so I was working on a cutscene and the localscript that handles the camera position works mostly fine but whenever the cutscene ends the camera will freeze and not go back to the player

btw the script is named CameraScript because for some reason it won't work any other way'

local cam = game.Workspace.CurrentCamera
cam.CameraType = Enum.CameraType.Scriptable
a = false
b = 0
while a == false do
	if game.Workspace.camveiw1 then
		cam.CFrame = game.Workspace.camveiw1.CFrame
		wait()
		b = b+1
		print(b)
		if b == 250 or not game.Workspace.camveiw1 then
			a = true
		end		
	end
end
cam.CameraType = Enum.CameraType.Custom
char = game.Players.LocalPlayer.Character
if char then
	print("gaming")
	cam.CameraSubject = char.Head
end

it counts to 200, prints "gaming" then it just freezes the camera (and the brick the camera is following flys away)

1 answer

Your script isn't in the correct order. You are making sure the player's camera isn't scriptable and then trying to script it. To fix: just rearrange to this:

char = game.Players.LocalPlayer.Character
if char then
    print("gaming")
    cam.CameraSubject = char.Head
end
cam.CameraType = Enum.CameraType.Custom

I hope this answers your question

1 comment

0

this does not work

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