Using while(wait(...)) laging in roblox player

So I am trying to make a rotating models (the models must be anchored so I cant use BodyAngularVelocity) so I used while(wait(…)) and its working well in roblox studio but when I run the game in roblox player everything that is rotating is laging. is the problem that im using while ? and if its the problem is there any other way to do it ?

This is an example for a rotating model that I did :

while true do
    local cframe = item.PrimaryPart.CFrame
	item:SetPrimaryPartCFrame(cframe * CFrame.Angles(0, math.rad(1), 0))
	wait()
end

Do not use wait(), instead you should use RunService.Stepped. wait() waits 0.03 seconds when there is no number provided and there is a 29ms delay also. .Stepped fires every frame prior to the physics simulation (Developer Hub).

1 Like