I want to have a loop that keeps teleporting the player through loads off parts in a folder. This is easy with a for loop. BUT I have Parts being added to the Folder and destroyed as well so I need it to also teleport the player to the newly added parts but I do not know how I can do that with a for loop I tried a for I = 1 loop but to no avail. I have experimented with ChildAdded but nothing worked I am hoping someone can help me.
Can you guys help me
PLEASE?
I have about 5 parts in at the start then I start adding more parts and destroying some other parts.
while true do
for i, telelocs in pairs(Assign your folder with the parts to teleport to) do
-- Script that teleports the player
wait(.1)
end
wait()
end
Note this will run without end simply change while true do to while Whatever will state whether the player can be teleported.Value == true do
workspace.Parts.ChildAdded:Connect(function(ChildAdded)
if ChildAdded.Name == "LocalParts" then
ChildAdded.ChildAdded:Connect(function(ChildAdded2)
if ChildAdded2.CLassName == "Part" then
print(ChildAdded2.Name)
end
end)
end
end)