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

How to spin models like a ufo rotation?

Asked by 6 years ago

I did everything from rotating models tutorial in Youtube but it doens't spin as i like and as a UFO rotate.

Model i want to make rotate like a UFO: https://i.imgur.com/A2ZaVjj.png

Sorry for my bad english, i am brazilian and i'm pretty new at scripting

0
You'll have to show us your script first. We can't magically see your script. Tomstah 401 — 6y
0
my script: while true do script.Parent:SetPrimaryPartCFrame(script.Parent.Center.CFrame * CFrame.fromEulerAnglesXYZ(0,.1,0) wait() end RomanHanish 0 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

Do this:

local model = workspace.UFO --The UFO

while true do wait()
    model:SetPrimaryPartCFrame(model:GetPrimaryPartCFrame() * CFrame.Angles(0, math.rad(1), 0)) -- This rotates the model 1 degree
end

Make sure that you have set the PrimaryPart property of the model to a part that is exactly in the middle of your UFO

0
Fixed!!!! ik what was the error, was the primary part that was rotating it like a possesed thing, i set the primary part in a normal block THX now it is spinning like a "real" ufo RomanHanish 0 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

The most efficient way (as far as I know) to rotate a model is by using the "SetPrimaryPartCFrame" function. It takes a model and rotates it around its PrimaryPart, but take note that you must set that before you use it, or else you will encounter an error. As an example, this rotates the model 90 degrees along its Y axis:

local model = workspace.yourModel

model:SetPrimaryPartCFrame(CFrame.new(0, math.deg(90), 0))
0
I set the primary part already and i tried it, but it when i pressed "Run" in the studio it "jumped" to the sky and it didnt moved RomanHanish 0 — 6y

Answer this question