Windmill Script Problem

I have a problem with my script, it is not rotating in the middle but it spins in circle, here is the screenshot: https://gyazo.com/69dc67b356332fb9d4f7516134bf65a5

The properties tab

This is the script I used
— while true do
script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(0, 0, math.rad(2))
wait()
end

That’s because your making the wrong part rotate and not the middle thing.

Add an invisible part in the center of the windmill blades and use that as a PrimaryPart

I tried that and it didn’t worked.

You might not have set it up correctly. You would have to group the blade and the center part inside a model, set the part as the model’s primarypart, then instead of changing the CFrame of the blade part, use SetPrimaryPartCFrame on the model.

--script is in the model with the blade part and the primary part
local speed = 1 --radians per second
game:GetService("RunService").Heartbeat:Connect(function(delta) -- runservice events are more reliable with timing than 'while true do'
	script.Parent:SetPrimaryPartCFrame(script.Parent.PrimaryPart.CFrame * CFrame.Angles(0, 0, speed * delta))
end)
2 Likes

Thank youu!
30chaaaaaaaaaaaaaaars