I need help with my rotation part

  1. What do you want to achieve? Keep it simple and clear!

I want the part to rotate in circular motion and not in a fast pace.

  1. What is the issue? Include screenshots / videos if possible!

theres no error but it is rotating in a different direction and is very fast.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I tried researching it on devforum and google search it but I couldn’t seems to find it.

I’d be really appreciative if you could help me with this…

local RotationSpeed = 0.01

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

Think you meant to do a . between 0 and 1

CFrame.fromEulerAnglesXYZ(0,0.1,0)

Also if it’s too fast, then you may need to increase the wait() to a higher number. And if this still rotates in a different direction, put 0.1 as the 1st or 3rd argument instead

while true do
script.Parent:SetPrimaryPartCFrame(script.Parent:GetPrimaryPartCFrame()*CFrame.fromEulerAnglesXYZ(.0,.15,.0))
wait()
end

Just change the Y value to an higer number to change the speed.

it is giving me an error… :confused:

Workspace.Part.BoarderSpinner:4: attempt to index nil with ‘fromEulerAnglesXYZ’

Attempt to index nil in that case is confusing me, may I see your code?

sure, here you go!

local RotationSpeed = 0.01

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

You repeated CFrame. twice

local RotationSpeed = 0.01

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

I have something to ask

Change the 0.1 in the EulerAngles function to be negative, or put it as the 1st or 3rd argument instead of the 2nd. Trial and error basically

to make it negative do I need to subtract it?

You turn 0.1 into -0.1, so essentially yes

uhh, why is it still spinning in the same direction?

Then do the other thing I said

CFrame.fromEulerAnglesXYZ takes a rotation angle in radians. It’s easier for humans to reason with degrees, so you can convert them. You’re also not using RotationSpeed for any thing; I’m guessing you want that to be the delay?

local Angle = math.rad(5) -- converts 5 degrees to radians
local RotationSpeed = 0.01

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

I also moved the Angle to be applied on the Z axis, which rotates it about the line drawn thru the Y axis.

1 Like

Yas! Finally it rotate in the desire direction I wanted. Thank you so much man! :smiley:

You’re welcome. You can tweak Angle to adjust how far it rotates each step, and change RotationSpeed to adjust how long there is between each step. That gives you pretty decent control over your rate of rotation.