How do I make a "for" loop that repeats its task every 0.1 seconds?
✓ ANSWER ACCEPTED
How make a "for" loop that repeats its task every 0.1 seconds?
2 answers
✓ Accepted answer
Hey. It's pretty easy. You want a For Loop, that loops around a table every 0,1 Seconds, right? You could just do this:
while wait(0.1) do -- executes every 0.1 seconds
for i, v in pairs(game:GetChildren()) do -- add your for loop here
-- your code here that should execute every 0.1 seconds for i and v.
end -- for loop end
end -- while end
Example: Teleportation:
while wait(0.1) do
for i, v in pairs(game.Players:GetChildren()) do -- example for loop, loops through players
v.Character.PrimaryPart.Position = Vector3.new(0, 64, 0) -- example code line
end
end
2 comments
0
Thank you!
0
No problem!
while wait(0.1) do
-- your code here
end
Easy and simple loop. You can learn more about loops here: https://developer.roblox.com/en-us/articles/Loops
1 comment
0
you don't have to post something twice btw.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Wait a Moment. I will create a Script for you