Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make these parts spin along with my mill?

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?

1 answer

✓ Accepted answer

Instead of doing that, you could weld the blades onto the rotor, and then spin the rotor. To weld something it'll look like this:

local weld = Instance.new("ManualWeld")
	weld.Parent = a
	weld.C0 = a.CFrame:inverse() * b.CFrame
	weld.Part0 = a
	weld.Part1 = b
	if not (...) then
		a.Anchored = false
	end
	b.Anchored = false

Here's the article: Welds

2 comments

0

So I welded the fans to the rotor. I don't know how to make the rotor spin from the weld though or whatever.

0

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.