Ah, the issue is quite simple, here's an explanation:
The error:
The CFrame property is only for parts, and basically what the script has tried to do is edit the CFrame property on a script which it doesn't have.
The fix:
In order to ensure that the script doesn't attempt to change the CFrame of something which hasn't got a CFrame property, you should do something along the lines of this:
while true do
for i,v in pairs(script.Parent:GetChildren()) do
if v:IsA("BasePart") then
v.CFrame = v.CFrame * CFrame.fromEulerAnglesXYZ(0, 0, math.pi/25)
wait()
end
end
end
What I've added in your script is the following line: if v:IsA("BasePart") then ... end. What this does is check if it is a Part, Wedge, Union, Cylinder, Sphere etc. and if it is, applies the CFrame value. This would prevent the script from breaking, as this filters out what is a part, and what isn't.
The :IsA("") basically asks: Is this a Part?, Is this a Script?, Is this a SpotLight? and things of the sort, so you are able to filter parts out.
I hope this explanation has helped, please do leave a comment if you require further assistance!
2 comments
Now it's even slow to rotate.. Anyway, thank you for helping me.
Move that wait outside the for loop and they should all rotate at once, sorry about that