I have already tried a couple different scripts, including this one
local rotateX = script.Parent.Orientation.X
local rotateZ = script.Parent.Orientation.Z
while true do
if rotateX <= 90 and rotateZ == 180 then
rotateX = rotateX - 1
elseif rotateX >= -90 and rotateZ == 180 then
rotateX = rotateX - 1
else
rotateX = rotateX + 1
end
wait(0.05)
end
You have to change the Orientation itself if you want to rotate it, the XY and Z parts can only be used for reference.
while true do
for i = 0, 359 do
script.Parent.Orientation = Vector3.new(i, 0, 0)
wait()
end
end
If this script causes the windmill to rotate the wrong way, you can switch i with one of the zeros in the Vector3.new call, like Vector3.new(0, 0, i) or Vector3.new(0, i, 0).
Edit: If that code crashed your game, add the wait
You would have to weld each part in your model to the rotating part and rotate the central part.
However, I would rather use a motor like @LandofLee1620 suggested, along with the welds.
Mess around with the angular velocity (the higher the number the faster it will go. Note: to change directions simply put a negative symbol in front of the number.
The motormaxtorque is higher for how heavy the object was. (In my case I did a water wheel and since it had a lot of parts I made the torque very high).
If the wheel isn’t moving you’ll just have to mess around with the numbers some more.
@TSF_Lacker, the reason that happened was that the CFrame script you were using was trying to center it around the center of the windmill blade model. If you select the model with the Move tool, you will see the arrows are pointing around the center of the model and that’s where it will spin.
Also make sure none of the rotating components are Anchored! This isn’t a CFramed model anymore if you are using a HingeConstraint. When using a HingeConstraint make sure the Attachments are at the same location physically. If not they’ll try to move to that location.
How many Parts in your windmill rotating model?
You could keep them anchored and use a Weld script to weld them together then unanchor them, or if there are only a few Parts use the Weld tool (while in Studio, the first drop-down list that @LandofLee1620 showed you in the image has the Weld tool in it) to connect the Parts.
If your windmill is purely decorative and not expected to be used for gameplay, you should use a Motor6d instead. This will create a constant smooth motion without eating up CPU.
Use this plugin:
Make sure the blades are unanchored and welded together. Set Part0 to the hub of your windmill, Part1 to one of the blades, then use the hub as the pivot. The motor will be parented under the hub where you can change its speed.