I'm trying to make a mill with a fan that spins on the side (See screenshots below). I've always been horrible at CFrames, they're a bit too complex for me. They're my downfall, and I can never find solutions. The wiki definitely doesn't make it any easier.
Here's the code that makes the fans spin on the mill.
while true do
wait()
for i = 1,360 do
script.Parent.Fan1.CFrame = CFrame.new(script.Parent.FanMiddle.Position) * CFrame.Angles(0,0,math.rad(i)) * CFrame.new(0,0,0)
script.Parent.Fan2.CFrame = CFrame.new(script.Parent.FanMiddle.Position) * CFrame.Angles(0,0,math.rad(i) + math.rad(90)) * CFrame.new(0,0,0)
wait()
end
end
So at first I thought everything was working fine: http://prntscr.com/hun1pi
But then when I rotated the mill: http://prntscr.com/hun1zj
The fans don't spin at the correct angle when I rotate the entire mill. How do I fix this?

2 comments
So I welded the fans to the rotor. I don't know how to make the rotor spin from the weld though or whatever.
Well you could just use Orientation if it's one part. The premise of weld is it'll just follow the part you welded it to. So just mess with the main rotor and you'll see what I mean.