Hey so, FYI I forgot my account to this website so I just made a random account but any who here's my question:
So I have a rotating script I found from a YouTube video (I can't Script) and it worked for rotating the model in its position however it does not rotate in my wished direction. It's rotating up and down. I wish for it to rotate left and right, 360, non stop. It can do the 360 non stop but it's not in my wanted direction as I said before. Here is the Script:
-- Turning logics. local function rotateModel(objects, center, new, recurse) for _,v in pairs(objects) do if v:IsA("BasePart") then v.CFrame = new:toWorldSpace(center:toObjectSpace(v.CFrame)) end if recurse then rotateModel(v:GetChildren(), center, new, true) end end end -- Set your variables. local model = script.Parent -- Model to transofrm local turnSpeed = 1 -- Radians it will turn ever 1/100th of a second local center = model:GetModelCFrame() -- Center point to turn around -- Run it constantly. while true do rotateModel( model:GetChildren(), center, center * CFrame.Angles(0,math.rad(turnSpeed),0), true ) wait() end
Thanks if you could help me with this, if you know the answer please answer by putting in the script that would work for this model. (NOTE: Model)
I am new to scripting as well. But, I think I know enough to answer this. I'll say again though, I'm new, and I'm not sure if this will work. So, at the part where you have:
center * CFrame.angles(0,math.rad(turnSpeed),0)
The CFrame.angles part are the position in which the parts rotate. So what you should do is this:
center * CFrame.angles(math.rad(turnSpeed),0,0)
OR(depending which way you want it to spin)
center * CFrame.angles(0,0,math.rad(turnSpeed))
Hope this helped! If you have questions, feel free to comment below. If it helped, don't forget to accept my answer!