Making something turn relative to a character with an angle

I am making a sword fighting game, the main mechanic is rotating the sword,
here is an example

my problem is that when i tried applying it to the player i realized that it only works as intended in one direction

How does this work ?
it takes the position of the guielement in the middle of the screen, uses math.atan2 to find an angle, (this part works fine)

i then send it to the server and apply a cframe to the sword to make it rotate correspondingly
to be more precise i use sin and cosin to find the x and y of the point im using to change the cframe of the sword (this is the part that only works in one direction)

here is the code simple

	local position = script.Parent.axis.Position
	local lookingvectorx = math.sin(angle)*15
	local lookingvectory = math.cos(angle)*15
    local lookingvector = Vector3.new(lookingvectorx,lookingvectory,0)
	script.Parent.axis.CFrame = CFrame.new(position,position+lookingvector)

to reiterate im stumped on the maths behind making this relative to another position

on a sidenote this doesnt look as horrible when using a more blocky character
Screenshot (1015)

You should probably rotate the looking vector by the character’s CFrame.

Don’t base the current CFrame off the previous CFrame, you’ll get weird precision issues over time.

Also, I don’t think you need to create a lookvector like this, you can just rotate by the angle directly:

local DISTANCE_IN_FRONT = 2
script.Parent.axis.CFrame = HumanoidRootPart.CFrame
  * CFrame.new(0, 0, -DISTANCE_IN_FRONT)
  * CFrame.Angles(0, 0, angle)

It does work but it has this funny result

Just wanted to add that i have fixed it by rotating the axis