I've created a map, and modeled it. How would I make it rotate? Like spinning clockwise??
01 | function rotateMod(mod,rotation) |
02 | local center = mod:GetModelCFrame() |
03 | local parts = { } |
04 | local function scan(parent) |
05 | for _,obj in pairs (parent:GetChildren()) do |
06 | if (obj:IsA( "BasePart" )) then |
07 | table.insert(parts,obj) |
08 | end |
09 | scan(obj) |
10 | end |
11 | end |
12 | scan(mod) |
13 | for _,part in pairs (parts) do |
14 | part.CFrame = (center*rotation*(center:inverse()*part.CFrame)) |
15 | end |
Change the Map in "rotateMod(game.Workspace.Map,CFrame.Angles(0,-0.2,0))" To whatever the name of the map model is there you go!
You could use a for loop, constantly adding 1 to the rotation every 0.1 or 0.01 second
1 | for i = 0 , math.huge do |
2 | map.Rotation = Vector 3. new( 0 ,i, 0 ) |
3 | wait( 0.01 ) |
4 | end |
This adds 1 to the rotation every 0.01 of a second. I have tried making the map.Rotation = map.Rotation+Vector3.new(0,i,0) but that doesn't seem to have worked