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

How do i make a rotation go smoother?

Asked by 6 years ago

How do i make this go smoother without changing the dely between each 'frame'?

My code

local model = script.Parent local mainPart = model.Center -- the "Origin" of rotation.

--Rotation values (in degrees):

**

local rotX = 5 local rotY = 0 local rotZ = 0

local delay = 0.9 -- delay between each "Frame"

local mTable = {} local offsetTable = {}

function getListOfParts(inst) for i, v in pairs(inst:GetChildren()) do if v:isA("BasePart") then table.insert(mTable, v) else getListOfParts(v) end end end

getListOfParts(model)

for i, v in pairs(mTable) do offsetTable[i] = mainPart.CFrame:toObjectSpace(mTable[i].CFrame) end

while wait(delay) do mainPart.CFrame = mainPart.CFrame * CFrame.Angles(math.rad(rotX), math.rad(rotY), math.rad(rotZ)) for i, v in pairs(mTable) do v.CFrame = mainPart.CFrame * offsetTable[i] end end

Answer this question