05-14-2011, 10:20 PM
Exactly. Here's some extra code bits to help you out, and a script that uses them:
while true do: This is a loop. It will repeat until instructed to "break".
[lua]
count = 0
while true do
sleep(1)
print("Looping.")
count = count + 1
if count > 10 then
break
end
end
[/lua]
It loops 10 times, printing "Looping" each time, then stops.
stuff:getChildren(): Gets a table with all the members being the descendents of stuff.
for q = 1, #table do: Loops through each member of table 'table'. q can be any letter. I use q because it's the first letter in the keyboard.
[lua]
local itemz = game.World:getChildren()
for q = 1, #itemz do
if itemz[q]:isA("Character") then
itemz[q].Body.Velocity = Vec2D(0,200)
end end
[/lua]
Makes everyone jump high
while true do: This is a loop. It will repeat until instructed to "break".
[lua]
count = 0
while true do
sleep(1)
print("Looping.")
count = count + 1
if count > 10 then
break
end
end
[/lua]
It loops 10 times, printing "Looping" each time, then stops.
stuff:getChildren(): Gets a table with all the members being the descendents of stuff.
for q = 1, #table do: Loops through each member of table 'table'. q can be any letter. I use q because it's the first letter in the keyboard.
[lua]
local itemz = game.World:getChildren()
for q = 1, #itemz do
if itemz[q]:isA("Character") then
itemz[q].Body.Velocity = Vec2D(0,200)
end end
[/lua]
Makes everyone jump high