How can i find the "frictional force" vector of a surface

i’m doing a custom character controller and i’m having an issue with it sliding down slopes/terrain,the best solution i could think of was to add a frictional force to the character, and that works just fine, but i don’t know how to find the frictional force direction based on the floor’s normal vector.

found the solution

local function GetFrictionVector(vec)
	if vec.Magnitude == 0 then error("Vector has no magnitude") end
	local floorAngle = math.acos(vec:Dot(,1,0)))
	if vec ==, 1, 0) or vec ==, -1, 0) then
		return, 0, 0)
		local a =,1,0):Cross(, 0, -vec.X))
		local fVector = (,a) * CFrame.Angles(floorAngle,0,0)).LookVector
		return fVector