Setting part CFrame rotation lagging

I have made a script which rotates all the parts in a model every 1/30 seconds

while wait() do
for i,v in pairs(script.Parent:GetChildren()) do
	handle = v:FindFirstChild("Handle")
	if handle then
		handle.CFrame = handle.CFrame * CFrame.fromEulerAnglesXYZ(0.0, 0.1, 0.05)
	end
end

end

So I expect the parts to rotate smoothly changing their CFrame 30 times a second ish. But however it only does it around 3 times a second as if the wait() timer were 0.33. Im not really sure why this is happening because the map is not very big and there aren’t a lot of components which could cause the game to lag.

  1. Instead of wait() you should follow this guide here and use something like game:GetService(“RunService”).Heartbeat:Wait().

  2. You could set the root part to a part in the center of the model and then just call :SetPrimaryPartCFrame(model:GetPrimaryPartCFrame() * CFrame.fromEulerAnglesXYZ(0, 0.1, 0.05)). This will rotate the model based on that part.

1 Like

Also by default the wait() is 0.33 you can change it in settings > lua but it is not recommended