Cframe not a valid member of humanoidRootPart

I’m trying to access the players primaryPart position but it keeps coming back with an error “Cframe is not a valid member of humanoidRootPart”, my end goal is to make the players camera slightly look down to give a “2Dish” feel and always follow the player (picture), I’ve already tried going on youtube and forums but I still can’t figure out why it won’t work (it’s also in starter characterScript), any help would be appreciated

local RunService = game:GetService("RunService")

local playerModel = script.Parent
local humanoid = playerModel:WaitForChild("Humanoid")
local char = playerModel:WaitForChild("HumanoidRootPart")

local cam = workspace.CurrentCamera

local function basicCamera()

	cam.CameraType = Enum.CameraType.Scriptable
	local playerX = math.rad(char.Cframe.Position.X - 10)
	local playerY = math.rad(char.Cframe.Position.Y + 20)
	local pos = Vector3.new(playerX, playerY, char.Cframe.Position.Z)
	local lookAt = char
	
	if humanoid.MoveDirection.Magnitude > 0 then -- Is the character walking?
		cam.CFrame = CFrame.lookAt(pos,lookAt)
	else
		cam.CFrame = CFrame.lookAt(pos, lookAt)

	end
end

RunService.RenderStepped:Connect(basicCamera)

2 Likes

It’s CFrame not Cframe, you got a little typo

3 Likes

I’ve been going insane for the past 2 hours over a typo :skull: THANK YOU

3 Likes

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