Help with cframe

No error. Script works ok. I just want to know the maximum increment to make the clock hands go crazy. Like. Real fast crazy.

local part = script.Parent

local INCREMENT = 1000 / 200

-- Rotate the part continually
while true do
	for degrees = 360, 0, INCREMENT do
		-- Set only the Y axis rotation
		part.CFrame = CFrame.new(part.Position) * CFrame.Angles(0, 0, math.rad(degrees))
		-- A better way to do this would be setting CFrame
		--part.CFrame = CFrame.new(part.Position) * CFrame.Angles(0, math.rad(degrees), 0)
		task.wait()
	end
end

This should do the job:

local part = script.Parent

local INCREMENT = 10000 / 200

-- Rotate the part continually
while true do
	for degrees = 360, 0, -INCREMENT do
		-- Set only the Y axis rotation
		part.CFrame = CFrame.new(part.Position) * CFrame.Angles(0, 0, math.rad(degrees))
		task.wait(0.01)
	end
end

I also changed the for loop to count down instead of up, because with a large INCREMENT it would otherwise immediately reach the limit of 360 degrees and then stay at 0 and I think roblox can’t render more than one frame in less than 1/60 of a second but this should still work!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.