Make on object rotate infinitely with tweens

I have gears on my map that constantly rotate for aesthetic purposes. While they do end up rotating back to the original orientation, the tween makes them go sideways beforehand. Does anyone know how I could rotate it 360 degrees while keeping the gear vertical?

This is the code I currently have. (the default orientation of the gear is 90,90,0)

local info = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1, false, 0)
local target = {Orientation = Vector3.new(-90, -90, 0)}
local tween = TweenService:Create(gear,info,target)
tween:Play()

Tweens should not be used for infinite movement. Instead, it would be better to use a RunService loop.

For performance reasons, this rotation should ideally be done on the client.

local RunService = game:GetService("RunService")

RunService.RenderStepped:Connect(function(dt)
	gear.Orientation += Vector3.new(0, 30 * dt, 0)
end)

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