Optimization help for rotating and parts moving up and down

The code below is to rotate the part and make it go up and down, however, I’m getting rates of 30% for script performance. I would like to know what improvements I can do so it’s not so high.

--Rotate
--Variables
local PowerUp = script.Parent
local Rotate = CFrame.fromEulerAnglesXYZ(0,.1,0)
while wait(.01) do
	PowerUp.CFrame = PowerUp.CFrame * Rotate
end
---------------------------------------------------------------
--Up and Down
while wait(.01) do
	local Limt = 5
	local PowerUp = script.Parent
	local Down = CFrame.new(0, -0.05, 0)
	local Up = CFrame.new(0, 0.05, 0)
	for i = 1,Limt,1 do
		PowerUp.CFrame = PowerUp.CFrame * Down
		wait(.01)
	end 
	for i = 1,Limt,1 do
		PowerUp.CFrame = PowerUp.CFrame * Up
		wait(.01)
	end
end
1 Like

Have you considered using TweenService?

1 Like

If you don’t want to use TweenService you can use
RunService instead.