How do i get humanoid's movedirection, relative to camera?

basically im making a little flying mechanic thingy and i cant get the direction that the player’s gonna be going to. ive tried doing this:

local wheretomove = cameracf:VectorToObjectSpace(plr.Character:FindFirstChildOfClass("Humanoid").MoveDirection)
plr.Character:FindFirstChild("HumanoidRootPart").Position = plr.Character:FindFirstChild("HumanoidRootPart").Position + wheretomove

but it made it go in the different direction.
also tried doing something with the rotations but it didnt help whatsoever.
can anyone please tell me how to do this? i looked at some other forum post (this is the post) but it didnt really help me much.

You could use a Raycast from camera location and rotation.

-- Smthn like this (This is not tested)
local look = camera.CFrame.LookVector

local rayOrigin = camera.CFrame.Position
local rayDistance = 100

local raycastResult = workspace:Raycast(rayOrigin, rayDistance * lookVector)

You can also add ray parameters to ignore player hits.

hmm. i could resort to this but i kinda want it to work like youre actually controlling it, so, using the humanoid.movedirection property. plus, how would rays even help me, really? i want the player to fly and not just teleport to a ray, if thats what youre suggesting.

What exactly are you trying to make? Why do you need the humanoids move direction?

because the humanoids movedirection gets the direction by looking at the wasd keys, right?? so if its relative to the camera you can move in any direction. i can give an example of the uhh i think its called hdadmin? well i want it to function like that one fly command, if you remember hdadmin.

Couldnt you just access the default roblox move vector?

local ControlModule = require(player:WaitForChild("PlayerScripts").PlayerModule:WaitForChild("ControlModule"))
local MoveVector = ControlModule:GetMoveVector()

it doesnt return the y coordinate though.

Because there is no keybinds to control your Y value… You can impliment those with Q and E if you want.
The vector you are given is an input of Vector.new(ForwardBackward, 0, RightLeft) based on the input of the player. You can take that and apply the vector to the cameras rotational Cframe and just move the player in the direction of it.

oh well if i dont find anything else i guess ill use that, thanks.