local h=game:GetService("\082\117\110\083\101\114\118\105\099\101")function slerp(h,L,x)return h*((1+math.cos(x*math.pi))/2)+L*((1-math.cos(x*math.pi))/2)end local L=script.Parent local x=.0 local T=L.Rotation h.Heartbeat:Connect(function(h)x+=(h/script.speed.Value)*2 if h<=1 then L.Rotation=slerp(-script.rotation.Value,script.rotation.Value,x)+T else if h<=2 then L.Rotation=slerp(script.rotation.Value,-script.rotation.Value,x)+T else x=0 end end end)
-- place this script under the gui object you want to rotate and use the rotation and speed value to change the rotation (degrees) and speed (seconds for full loop)

local RunService = game:GetService("RunService")
function slerp(a, b, x)
	return a * ((1 + (math.cos(x * math.pi))) / 2) + b * ((1 - (math.cos(x * math.pi))) / 2)
end

local object = script.Parent
local count = 0.0
local rotation = object.Rotation

RunService.Heartbeat:Connect(function(step)
	count += step / script.speed.Value * 2
	if step <= 1 then
		object.Rotation = slerp(-script.rotation.Value, script.rotation.Value, count) + rotation
	else
		if step <= 2 then
			object.Rotation = slerp(script.rotation.Value, -script.rotation.Value, count) + rotation
		else
			count = 0
		end
	end
end)
