Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I change/fix this rotating model Script?

Asked by 8 years ago
Edited by M39a9am3R 8 years ago

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:

01-- Turning logics.
02local function rotateModel(objects, center, new, recurse)
03 for _,v in pairs(objects) do
04  if v:IsA("BasePart") then
05   v.CFrame = new:toWorldSpace(center:toObjectSpace(v.CFrame))
06  end
07  if recurse then
08   rotateModel(v:GetChildren(), center, new, true)
09  end
10 end
11end
12 
13-- Set your variables.
14local model = script.Parent -- Model to transofrm
15local turnSpeed = 1 -- Radians it will turn ever 1/100th of a second
View all 27 lines...

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)

0
Edited for code block. M39a9am3R 3210 — 8y

1 answer

Log in to vote
0
Answered by
Peeshavee 226 Moderation Voter
8 years ago

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:

1center * 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:

1center * CFrame.angles(math.rad(turnSpeed),0,0)

OR(depending which way you want it to spin)

1center * 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!

Ad

Answer this question