script.Parent.PrimaryPart = script.Parent.H
script.Parent:SetPrimaryPartCFrame(script.Parent.H.CFrame)
while wait(0.081) do
for i,v in pairs(script.Parent:GetChildren()) do
if v:IsA("Part") or v:IsA("MeshPart") and v.Name == "H" then
v.Orientation = v.Orientation + Vector3.new(0,1,0)
print("rot")
end
end
end
If the reply above does not work ( which it probably will, however I am away from my laptop ), try Welding all the parts to your primary part and rotating the PrimaryPart from there.
I think the people here don’t know what they’re talking about. Your issue is likely in the if statement; you can just check if something is a BasePart instead, and using or and and in the same line without parentheses will cause you to mess something up.
speed=math.rad(1)*40
while wait(.081) do
currentCFrame=script.Parent:GetPrimaryPartCFrame()
script.Parent:SetPrimaryPartCFrame(currentCFrame * CFrame.Angles(0, speed, 0))
end
Where you went wrong earlier was setting the angle offset; if you want a constant velocity rotation then the angle offset should be constant. Before you calculated the angle offset as a full CFrame (with position); which made it go haywire when you multiplied that CFrame position and rotation with the original.
Yes of course (Sorry for the late reply, I went for a run outside)
script.Parent.PrimaryPart = script.Parent.H
while wait(0.02) do
for i,v in pairs(script.Parent:GetChildren()) do
if v:IsA("Part") or v:IsA("MeshPart") and v.Name == "H" then
local angleOffset = ( CFrame.Angles(math.rad(script.Parent.H.Orientation.X + 0.2),0,math.rad(0.0001)))
script.Parent:SetPrimaryPartCFrame(script.Parent.H.CFrame * angleOffset )
print("rot")
end
end
end
end
end
end
I really do not suggest using a very small number because it will make it look like it’s moving very slow despite having a loop run every 0.02 seconds.
Bump it up to 1 or higher if you can.
As for the stopping thing, I couldn’t seem to find any issues that’s causing it.
Its okay, I have figured out the issue. Its due to the ‘H’ moving to a different orientation while not doing so at the same time. I bumped 0.2 to 10 and it works like a charm, its not changing the orientation 100% of the way but instead making it seem like it is. Basically what I’m saying is that it sets it to a position instead of always adding a position.
script.Parent.PrimaryPart = script.Parent.H
while wait(0.02) do
for i,v in pairs(script.Parent:GetChildren()) do
if v:IsA("Part") or v:IsA("MeshPart") and v.Name == "H" then
local angleOffset = ( CFrame.Angles(math.rad(script.Parent.H.Orientation.X + 10),0,0))
script.Parent:SetPrimaryPartCFrame(script.Parent.H.CFrame * angleOffset )
print("rot")
end
end
end
I really appreciate your help, thank you very much