So I'm trying to make a gravity game where the camera is always attached to the players head, even if upside-down. I've tried this code just for the movement of the camera (will add angles later) but it does not attach to the head as required.
local campart = workspace.CameraPart
local player = game.Players.LocalPlayer
local torso = player.Character.Head
local offsetCFrame = Vector3.new(7, 0, 0)
latch.CFrame = torso.CFrame:ToWorldSpace(offsetCFrame)
The code needs to just 'weld' the camera to the player's head with an offset of about 7 studs. If anyone can help I would be very grateful. And if you don't understand something, comment about it and I will clarify.

3 comments
maybe change line 6 to
latch.CFrame = torso.CFrame + offsetCFrameno, that didn't work, the output mentions on line 3 'attempt to index nil with 'Character''
you need to wait for the character to be loaded, just add
repeat wait() until game.Players.LocalPlayer.Character