Hello! I've been trying to make an (as accurate as possible) model of Hogwarts. I thought it could be a lot of fun for kids to wander around, and the moving staircases are a pretty big part of this. Since it's just rotating, I thought it'd be a pretty good place to start learning. But I'm still really new to this, so I'd appreciate anyone pointing me in the right direction. After the forums were closed I'm not sure who to ask.
COMMUNITY QUESTION
How to create a swivelling staircase for Harry Potter?
1 answer
In order to rotate a model properly, you need to use Model:SetPrimaryPartCFrame().
If you don't really know how to use CFrame or what it is, check out this page and this one.
In order for SetPrimaryPartCFrame() to work, you need to set the model's PrimaryPart, according to which the rest of the model will rotate.
Another function which might come in handy is CFrame:lerp()
Here's an example of rotating a model 90 degrees on the Y axis:
model:SetPrimaryPartCFrame(model.PrimaryPart.CFrame * CFrame.Angles(0,math.rad(90), 0))
Here's an example of using CFrame:lerp() to rotate a model 360 degrees:
local pos = model.PrimaryPart.CFrame * CFrame.Angles(0,math.rad(360),0)
for i=0,1,0.1 do
wait()
model:SetPrimaryPartCFrame(model.PrimaryPart.CFrame:lerp(pos, i))
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
workspace:WaitForChild('staircase'):Swivel(360, 5, true) -- rotation, time, repeat
( ::::