Rotating part (with a light)

As the title, I’m trying to make a part spin (it has a light inside it)

First of all, the code doesn’t error, It doesn’t do what it’s supposed to. And it’s slow / and I can’t change the speed it needs. Perhaps I could use tweenservice if someone could help out? I never experienced tweenservice with rotating a part…

Code:

while true do
	script.Parent.Parent.AlarmModel.LightRotate.Orientation += Vector3.new(0,1,0)
	wait(0.05)
end

Please let me know what I’m doing wrong, this thing is just lagging.

your just adding the Y value if you want to rotate, use CFrame.

I tried using CFrame but it always just moved the part,

Are you using CFrame.Angles? That might be ur issue

I did. I multiplied it by the parts cframe

part.CFrame = CFrame.fromOrientation(math.rad(90),0,0)

paste this inside a server script inside the part.

while wait() do
	script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(0,math.rad(1),0)
end

if you want it to be less choppy, you could run a renderstepped function on the client.

only downside of doing that is the fact that it wont be synced across multiple clients.

Local part = yourpart
Local thetween = game.TweenService:Create(part, TweenInfo.new(secondsthetweentakes),{Orientation = Vector3.new(your,orientation,here)})
thetween:Play()

If it’s making a full rotation, you simply play the tween again, with some logic that waits for completion.

while true do
    script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,1,0)
    wait(0.1)
end

This also works

HI this works, but it tweens in all kinds of directions, It doesn’t spin in one axis.

You can just make the default Y orientation of the part set to 0, then you can tween it with:

local part = --your part goes here
local tweenTime = --your tween time goes here
local thetween = game.TweenService:Create(part, TweenInfo.new(tweenTime), {Orientation = Vector3.new(0, 360, 0)})
thetween:Play()

Is it because it’s slow and you want it to be faster or the problem is it doesn’t rotate?