Made a flag that's supposed to always look one way, but it gives up

So I’m trying out making boats for my game, and I have everything working so far. So I went to implement wind and a flag at the top of the ship that points in the direction of the wind.
AAAAAAAAA
The flag itself looks like this, with the Anchor being welded to the rootpart of the ship and the Core has a motor6d connecting it to the Anchor. They both share the same starting CFrame.

local Motor6D = Core:FindFirstChildWhichIsA("Motor6D")
if Motor6D then
	local _,y1,_ = CFrame.lookAt(Vector3.zero, WindDirection):ToEulerAnglesXYZ()
	local _,y2,_ = v.Anchor.CFrame:ToEulerAnglesXYZ()
	Motor6D.C0 = CFrame.Angles(0,y1-y2,0)
end

I then do this to orientate the flag into pointing at the wind at all times, and it works… Mostly.


When the ship get’s a point in it’s rotation, the flag just… Gives up?
I posted here on the forums cause I don’t know what else to try nor do I know why the flag gives up at that certain angle, any help is greatly appreciated.

bump

thirtycharactershavetobefilled