Help with custom 2.5D camera script!

Making a planet game, for my custom camera script (it’s like the Minecraft dungeons camera system), and using Egomoose’s gravity system which make the character be able to walk on the planet/sphere, I want my camera to track the player’s humanoidrootpart or head or torso’s orientation for the camera orientation, but since I’m so terrible with CFrames, I don’t know how.

What i want:

Noticeable Problem:
https://gyazo.com/7a297c5150ef99ab476a86d89c0ae74a

local Players = game:GetService('Players')
local RunService = game:GetService('RunService')

local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()

local currentZoom = 30
local currentX = 63.84100000000000108
local currentY = 42.5


workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera.FieldOfView = 20

RunService:BindToRenderStep('Camera', Enum.RenderPriority.Camera.Value, function()
	local subject = workspace.CurrentCamera.CameraSubject
	if subject then
		if subject:IsA('Humanoid') then
			subject = subject.Parent:FindFirstChild('HumanoidRootPart') or subject.RootPart
			workspace.CurrentCamera.CFrame = CFrame.new(subject.Position + Vector3.new(currentX, currentY, currentZoom), subject.Position)
		else
			workspace.CurrentCamera.CFrame = subject.CFrame
		end
	end
end)

Not sure if this helps at all, but this is some code that I used at one point when messing around with a top-down 2.5D camera type thing.

local RunService = game:GetService("RunService")

local camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer

local cameraOffset = Vector3.new(90, 90, 0)
camera.CameraType = Enum.CameraType.Scriptable

local function onRenderStep()
	if player.Character then
		local playerPosition = player.Character.HumanoidRootPart.Position
		local cameraPosition = playerPosition + cameraOffset
		
		camera.CoordinateFrame = CFrame.new(cameraPosition, playerPosition)
		
	end
end

RunService:BindToRenderStep("Camera", Enum.RenderPriority.Camera.Value, onRenderStep)

Like I said, no clue if this is of any help, just posting it here because I used this code for a similar thing lol.

Nope, it doesn’t help because it still has the same problem and not the camera script I wanted.

Hey guys I still need help here.

Hey, I need some help here since I still can’t fix this script

Can someone here try to fix my script since I can’t?

Please, i really need help here

If I’m not mistaken, you can utilize CFrame.UpVector to get its relative ‘up’.

For instance.

local upVector = player.Character.HumanoidRootPart.CFrame.UpVector
local cameraPosition = upVector * cameraOffset -- Scalar 
local playerPosition = player.Character.HumanoidRootPart.Position
	
camera.CoordinateFrame = CFrame.new(cameraPosition, playerPosition)

Hopefully, this helps! Haven’t tested it but it should do the trick!

It’s not working for me, no errors too.