How Can I Continuously Rotate A Part?

Hey developers I feel stupid not knowing this but how can I continoulsy rotate a part around its complete 360 degrees, I am unsure what to do and the best i’ve come up with is

local TweenService = game:GetService("TweenService")

local Info = TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true, 0)
local Goals = { 
	Orientation = Vector3.new(0, 90, 0)
}

local tween = TweenService:Create(script.Parent, Info, Goals)

tween:Play()

The goal is to give a portal effect so all help would be appreciated.

in tween info set the repeat count to math.huge or an extremely high number

try this, put the script in the part you want to rotate

Speed = 0.5 -- how fast it spins
while true do -- infinite loop
for i = 0, 360, Speed do 
script.Parent.CFrame = CFrame.new(script.Parent.Position)*CFrame.fromEulerAnglesXYZ(0, math.rad(i)*-5, 0) -- move "math.rad(i)*-5" to other parts of the rotation if you want it to rotate differently, or very simpily just rotate the part
task.wait()
	end 
end

it defaults to rotating the part clockwise

1 Like

-1 makes it go unlimited times thats not the issue man. What I have there rotates it 90 degrees then brings it back I’m unsure how to make it do the full 360

1 Like

your TweenInfo also has true instead of false in it, which reverses it when its done

local Info = TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true, 0)

change that to false, and it shouldnt reverse anymore

1 Like

yeah I didnt know how to get the full 360 im testing ur script now

k

char limit

ok so issue with your script is it changes the way the part is facing to somewhere I wish it not to face. Any solution to this?

try for the goal instead of making it a specific angle use some math to add to the current angle

or just use the script i provided above

whatever works for you ¯_( ͡° ͜ʖ ͡°)_/¯

if your trying not to infinitely loop it, change the -1 to a 0

local Info = TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true, 0)
1 Like

i wanted to infinte loop it thanks

try this script instead of the wierd tween stuff, change the 0.5 to the speed you need
by default, it rotates on the center point of the y axis

I did try your script and It does work but it changes the way the part is facing which I do not wish to happen how can I fix that?

are you trying to roll the part without changing its facing direction?

yeah my bad I do not wish to change it’s facing direction

try this, i moved the math.rad over so it doesnt rotate the same way

Speed = 0.5 -- how fast it spins
while true do -- infinite loop
for i = 0, 360, Speed do 
script.Parent.CFrame = CFrame.new(script.Parent.Position)*CFrame.fromEulerAnglesXYZ(0, 0, math.rad(i)*-5) -- move "math.rad(i)*-5" to other parts of the rotation if you want it to rotate differently, or very simpily just rotate the part
task.wait()
	end 
end

a part that was affected by this would roll


so I want it to stay facing this way but rotate on the Z axis

if its particles, just change the rotation speed

its a image decal not particles

I had already moved the axis over but it changes the direction it’s facing other then that it works fine