Rotate object using ui?

How should I make a scroll ui that rotates an object? ( Like adopt me for example )

I am having troubles with detecting if it’s going a certain way so it rotates right or left.

ezgif.com-gif-maker

You can do:

object.CFrame = CFrame * CFrame.Angles(0, math.rad(degrees), 0)