I’m basically trying to get all children of a model (All children have the same names) to teleport somewhere. I know how to do that, I just don’t know how to add a delay between each children’s teleportation. How do I do it?
(In this situation, I want the children aka the parts to teleport to the player’s HumanoidRootPart)
ipairs is used for arrays, GetDescendants() returns an array, and ipairs runs faster in this case. pairs is more used for dictionaries.
Also, if you assign it to a local variable, it will speed it up even more.
Here’s an example:
local Workspace = game:GetService('Workspace')
local GetDescendants = Workspace:GetDescendants()
for _, Inside in ipairs(GetDescendants) do
if Inside:IsA('BasePart') then
--- Teleport the parts
Inside.CFrame = NewCFrame
end
end