Rotation script delay needed

Is there any way I can make it so this rotation script can have a delay before it starts to rotate?

function rotateMod(mod,center,rotation)
	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



local mod = script.Parent
local step = 1
for i = 0,360,step do
	while true do
	rotateMod(mod,mod:GetModelCFrame(),CFrame.Angles(0,math.rad(step),0))
	wait()
	end
	wait()
	end

Any help is appreciated!

Hi!

You should use tweenservice for stuff like this. It even have a inbuilt delay feature!
https://developer.roblox.com/en-us/api-reference/function/TweenService/Create

Hi, if I’ve gotten what your asking correctly, you could put a wait(5) (Or however many seconds you want to wait) in your code.

1 Like

I’ve tried that but I can’t seem to find where specifically to put it.

I believe line 17 would be a good spot to put it.

1 Like