First person custom movement foward/backward direction

I want to make custom movement script which does NOT use play:Move() or any other functions of this sort.

My approach is this:

local function main()
	local x_vec,z_vec: Vector3 = cam.CFrame.XVector,cam.CFrame.ZVector

	if keys_using["W"] and not keys_using["S"] then
		char.Position -= Vector3.new(z_vec.X,0,z_vec.Z)
	elseif keys_using["A"] and not keys_using["D"] then
		char.Position -= x_vec
	elseif keys_using["S"] and not keys_using["W"] then
		char.Position += z_vec
	elseif keys_using["D"]  and not keys_using["A"] then
		char.Position += x_vec
	end
end

When moving foward and looking down/up movement slows down substancially. That is the main issue.
I tried searching for solutions, but nor did I find any fixes or any people attempting first-person custom movement.

Note: Everything there will be changed for more complicated stuff and then I will even add jumping mechanincs…

Fixed it.

local function main()
	local z_vec = ((cam.CFrame * CFrame.Angles(1,0,1)).ZVector)
	local x_vec = (cam.CFrame.XVector)

	if keys_using["W"] and not keys_using["S"] then
		root.Position -= Vector3.new(z_vec.X, 0, z_vec.Z)
	end
	if keys_using["A"] and not keys_using["D"] then
		root.Position -= x_vec
	end
	if keys_using["S"] and not keys_using["W"] then
		root.Position += Vector3.new(z_vec.X, 0, z_vec.Z)
	end
	if keys_using["D"] and not keys_using["A"] then
		root.Position += x_vec
	end
end