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 repeat this until their is none left?

Previous Thread :: Next Thread 
haydebug2003 is not online. haydebug2003
Joined: 21 Jan 2012
Total Posts: 5302
15 Jun 2015 04:44 PM
num = 1
for _,v in pairs(game.Workspace:GetChildren()) do
if v.Name == num then
v.Anchored = false
x=Instance.new("Explosion",v)
x.Position = v.Position
end
end

How can I repeat that until it has searched through every part in workspace then when it has add 1 on to num and see if its that value?


As a wise man once told me, get out.
Report Abuse
haydebug2003 is not online. haydebug2003
Joined: 21 Jan 2012
Total Posts: 5302
15 Jun 2015 04:46 PM



As a wise man once told me, get out.
Report Abuse
haydebug2003 is not online. haydebug2003
Joined: 21 Jan 2012
Total Posts: 5302
15 Jun 2015 04:51 PM
ogmogmogmog


As a wise man once told me, get out.
Report Abuse
haydebug2003 is not online. haydebug2003
Joined: 21 Jan 2012
Total Posts: 5302
15 Jun 2015 04:55 PM
bump


As a wise man once told me, get out.
Report Abuse
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
15 Jun 2015 04:55 PM
"if v.Name == num then"

Change to

"if v.Name == tostring(num) then"


Since your variable is a number and not a string. Alternative is to change the variable to a string like so, "1"
Report Abuse
haydebug2003 is not online. haydebug2003
Joined: 21 Jan 2012
Total Posts: 5302
15 Jun 2015 04:59 PM
@Novus How can I make it so when their is none left it adds one?


As a wise man once told me, get out.
Report Abuse
haydebug2003 is not online. haydebug2003
Joined: 21 Jan 2012
Total Posts: 5302
15 Jun 2015 05:03 PM
:DDDDDD


As a wise man once told me, get out.
Report Abuse
haydebug2003 is not online. haydebug2003
Joined: 21 Jan 2012
Total Posts: 5302
15 Jun 2015 05:07 PM
:D


As a wise man once told me, get out.
Report Abuse
haydebug2003 is not online. haydebug2003
Joined: 21 Jan 2012
Total Posts: 5302
15 Jun 2015 05:10 PM
omg


As a wise man once told me, get out.
Report Abuse
FauxHawke is not online. FauxHawke
Joined: 08 Jun 2012
Total Posts: 2190
15 Jun 2015 05:11 PM
can you like not spam


Never trust atoms, they make up everything.™
Report Abuse
haydebug2003 is not online. haydebug2003
Joined: 21 Jan 2012
Total Posts: 5302
15 Jun 2015 05:15 PM
@Faux Yeah. But first I need this solved.


As a wise man once told me, get out.
Report Abuse
haydebug2003 is not online. haydebug2003
Joined: 21 Jan 2012
Total Posts: 5302
15 Jun 2015 05:18 PM



As a wise man once told me, get out.
Report Abuse
haydebug2003 is not online. haydebug2003
Joined: 21 Jan 2012
Total Posts: 5302
15 Jun 2015 05:25 PM
OMG


As a wise man once told me, get out.
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
15 Jun 2015 05:31 PM
function derp(model,name)
local function iterate(m,n)
for _,v in next, m:GetChildren() do
if v.Name == n then
v.Anchored = false;
local x = Instance.new("Explosion",v);
x.Position = v.Position;
end;
iterate(v);
end;
end;
iterate(model,name);
end;

derp(workspace,'1');
Report Abuse
BlueWizard12345 is not online. BlueWizard12345
Joined: 31 Mar 2012
Total Posts: 906
15 Jun 2015 05:37 PM
number = 1

function delete(num, parent)
for _,v in pairs(parent:GetChildren()) do
if v.Name == tostring(num) then
v.Anchored = false
x=Instance.new("Explosion",v)
x.Position = v.Position
end
delete(number, v)
end
end

while wait() do
delete(number, game.Workspace)
number = number + 1
end
Report Abuse
haydebug2003 is not online. haydebug2003
Joined: 21 Jan 2012
Total Posts: 5302
15 Jun 2015 05:57 PM
@Goul then why doesnt this work?
function explode(model,name)
local function iterate(m,n)
for _,v in next, m:GetChildren() do
if v.Name == n then
for _,v in pairs(v:GetChildren()) do
v.Anchored = false;
local x = Instance.new("Explosion",v);
x.Position = v.Position;
end
end;
iterate(v);
end;
end;
iterate(model,name);
end;
a=1
while wait(0.5) do
if game.Workspace.Value.Value>0 then
game.Workspace.Value.Value = game.Workspace.Value.Value-1
explode(workspace,a)
a=a+1
end
end


As a wise man once told me, get out.
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