generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: How to loop this

Previous Thread :: Next Thread 
Enderkick is online. Enderkick
Joined: 12 Nov 2012
Total Posts: 73
30 Oct 2016 04:38 PM
Will someone please tell me how to loop this script?

wait (70.8)
local p = game.Players:GetChildren()
for i = 1, #p do
p[i].Character:MoveTo(Vector3.new(0, 0, 0))
end
Report Abuse
Intended_Pun is not online. Intended_Pun
Joined: 10 Aug 2016
Total Posts: 4384
30 Oct 2016 04:40 PM
while wait(70.8) do
local p = game.Players:GetChildren()
for i = 1, #p do
p[i].Character:MoveTo(Vector3.new(0, 0, 0))
end
end
Report Abuse
Enderkick is online. Enderkick
Joined: 12 Nov 2012
Total Posts: 73
30 Oct 2016 04:51 PM
Did not work
Report Abuse
Intended_Pun is not online. Intended_Pun
Joined: 10 Aug 2016
Total Posts: 4384
30 Oct 2016 04:53 PM
http://wiki.roblox.com/index.php?title=Loops
Report Abuse
TiresomeGskw is not online. TiresomeGskw
Joined: 27 Feb 2015
Total Posts: 49
30 Oct 2016 04:53 PM
Not to be confused with Flow control (data).

The lead section of this article may need to be rewritten. Please discuss this issue on the article's talk page. Use the lead layout guide to ensure the section follows Wikipedia's norms and to be inclusive of all essential details. (July 2014) (Learn how and when to remove this template message)
In computer science, control flow (or alternatively, flow of control) is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated. The emphasis on explicit control flow distinguishes an imperative programming language from a declarative programming language.

Within an imperative programming language, a control flow statement is a statement whose execution results in a choice being made as to which of two or more paths should be followed. For non-strict functional languages, functions and language constructs exist to achieve the same result, but they are not necessarily called control flow statements.

A set of statements is in turn generally structured as a block, which in addition to grouping also defines a lexical scope.

Interrupts and signals are low-level mechanisms that can alter the flow of control in a way similar to a subroutine, but usually occur as a response to some external stimulus or event (that can occur asynchronously), rather than execution of an 'in-line' control flow statement.

At the level of machine or assembly language, control flow instructions usually work by altering the program counter. For some CPUs the only control flow instructions available are conditional or unconditional branch instructions (also called jumps).

Contents [hide]
1 Categories
2 Primitives
2.1 Labels
2.2 Goto
2.3 Subroutines
2.4 Sequence
3 Minimal structured control flow
4 Control structures in practice
5 Choice
5.1 If-then-(else) statements
5.2 Case and switch statements
6 Loops
6.1 Count-controlled loops
6.2 Condition-controlled loops
6.3 Collection-controlled loops
6.4 General iteration
6.5 Infinite loops
6.6 Continuation with next iteration
6.7 Redo current iteration
6.8 Restart lo###############xit from loops
6.10 Loop variants and invariants
6.11 Loop sublanguage
6.12 Loop system cross-reference table
7 Structured non-local control flow
7.1 Conditions
7.2 Exceptions
7.3 Continuations
7.4 Async
7.5 Generators
7.6 Coroutines
7.7 Non-local control flow cross reference
8 Proposed control structures
8.1 Loop with test in the middle
8.2 Multiple early exit/exit from nested loops
9 Security
10 See also
11 References
12 External links
Categories[edit]

A flow chart showing control flow.
The kinds of control flow statements supported by different languages vary, but can be categorized by their effect:

continuation at a different statement (unconditional branch or jump),
executing a set of statements only if some condition is met (choice - i.e., conditional branch),
executing a set of statements zero or more times, until some condition is met (i.e., loop - the same as conditional branch),
executing a set of distant statements, after which the flow of control usually returns (subroutines, coroutines, and continuations),
stopping the program, preventing any further execution (unconditional halt).
Primitives[edit]
Labels[edit]
Main article: Label (computer science)
A label is an explicit name or number assigned to a fixed position within the source code, and which may be referenced by control flow statements appearing elsewhere in the source code. Other than marking a position within the source code a label has no effect.

Line numbers are an alternative to a named label (and used in some languages such as Fortran and BASIC), that are whole numbers placed at the beginning of each line of text within the source code. Languages which use these often impose the constraint that the line numbers must increase in value in each subsequent line, but may not require that they be consecutive. For example, in BASIC:

10 LET X = 3
20 PRINT X
In other languages such as C and Ada a label is an identifier, usually appearing at the beginning of a line and immediately followed by a colon. For example, in C:

Success: printf("The operation was successful.\n");
The Algol 60 language allowed both whole numbers and identifiers as labels (both attached by colons to the following statement), but few if any other variants of Algol allowed whole numbers.

Goto[edit]
Main article: GOTO
The goto statement (a combination of the English words go and to, and pronounced accordingly) is the most basic form of unconditional transfer of control.

Although the keyword may either be in upper or lower case depending on the language, it is usually written as:

goto label
The effect of a goto statement is to cause the next statement to be executed to be the statement appearing at (or immediately after) the indicated label.

Goto statements have been considered harmful by many computer scientists, notably Dijkstra.

Subroutines[edit]
Main article: Subroutine
The terminology for subroutines varies; they may alternatively be known as routines, procedures, functions (especially if they return results) or methods (especially if they belong to classes or type classes).

In the 1950s, computer memories were very small by current standards so subroutines were used primarily[citation needed] to reduce program size; a piece of code was written once and then used many times from various other places in the program.

Nowadays, subroutines are more frequently used to help make a program that is more structured, e.g. by isolating some particular algorithm or hiding some particular data access method. If many programmers are working on a single program, subroutines are one kind of modularity that can help split up the work.

Sequence[edit]
Main article: Structured programming
In structured programming, the ordered sequencing of successive commands is considered one of the basic control structures, which is used as a building block for programs alongside iteration, recursion and choice.
Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
30 Oct 2016 04:56 PM
why is this clown above me copying and pasting Wikipedia pages
Report Abuse
Enderkick is online. Enderkick
Joined: 12 Nov 2012
Total Posts: 73
30 Oct 2016 04:57 PM
lol
Report Abuse
Enderkick is online. Enderkick
Joined: 12 Nov 2012
Total Posts: 73
30 Oct 2016 05:05 PM
It only loops once, I want to do an infinite loop.
Report Abuse
wchar_t is not online. wchar_t
Joined: 11 Oct 2016
Total Posts: 65
30 Oct 2016 05:07 PM
while wait(70.8) do
local p = game.Players:GetChildren()
for i = 1, #p do
p[i].Character:MoveTo(Vector3.new(0, 0, 0))
end
end


Report Abuse
Enderkick is online. Enderkick
Joined: 12 Nov 2012
Total Posts: 73
30 Oct 2016 05:13 PM
Am I supposed to add on to that? I put it in the game and it only teleports me once instead of every 70 seconds.
Report Abuse
Enderkick is online. Enderkick
Joined: 12 Nov 2012
Total Posts: 73
30 Oct 2016 05:20 PM
Ohhh, the time is a bit off.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image