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

Making a map rotate constantly?

Asked by
Irvene 5
9 years ago

I've created a map, and modeled it. How would I make it rotate? Like spinning clockwise??

2 answers

Log in to vote
0
Answered by
Ben1925 25
9 years ago
function rotateMod(mod,rotation)
local center = mod:GetModelCFrame()
local parts ={}
local function scan(parent)
for _,obj in pairs(parent:GetChildren()) do
if (obj:IsA("BasePart")) then
table.insert(parts,obj)
end
scan(obj)
end
end
scan(mod)
for _,part in pairs(parts) do
part.CFrame = (center*rotation*(center:inverse()*part.CFrame))
end
end

while true do
wait (0.4)
rotateMod(game.Workspace.Map,CFrame.Angles(0,-0.2,0))
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!

Ad
Log in to vote
0
Answered by 9 years ago

You could use a for loop, constantly adding 1 to the rotation every 0.1 or 0.01 second

for i = 0,math.huge do
    map.Rotation = Vector3.new(0,i,0)
    wait(0.01)
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

0
That wouldn't work because the "Map" would be a model and you can't use that to rotate a model. VariadicFunction 335 — 9y

Answer this question