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 » Scripting Helpers
Home Search
 

Re: vars and ipairs

Previous Thread :: Next Thread 
skate1011 is not online. skate1011
Joined: 13 Mar 2010
Total Posts: 688
07 Oct 2012 12:10 AM
so I wanted to know if I could do this with ipairs

w = game.Workspace:GetChildren()
l = game.Lighting:GetChildren()
sg = game.StarterGui:GetChildren()
sp = game.StarterPack:GetChildren()

for _, v in pairs(w, l, sg, sp) do
if v:IsA("Terrain") then
else
v:Remove()
end
end

wiki.roblox.com
Report Abuse
thedeathmaster01 is not online. thedeathmaster01
Joined: 14 Mar 2010
Total Posts: 6331
07 Oct 2012 12:20 AM
First of all, you can't remove the Terrain object.
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
07 Oct 2012 12:22 AM
No. Just do this:

w = game.Workspace:GetChildren()
l = game.Lighting:GetChildren()
sg = nil
sp = game.StarterPack:GetChildren()

for k,v in pairs(game.Players.Players:GetPlayers()) do
--this is so sg is the PlayerGuis
for a,b in pairs(v.PlayerGui:GetChildren()) do
table.insert(sg, b)
end
end

tbls = {l, sp, sg}

for k,v in pairs(tbls) do
v:ClearAllChildren()
for a,b in pairs(w) do
if not a.Name == "Terrain" and not a.Name == "Camera" then
b:destroy()
end
end
end


http://wiki.roblox.com/index.php/User:ElectricBlaze
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
07 Oct 2012 02:00 AM
Why would You want to....
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
07 Oct 2012 02:18 AM
@thecaptain - I'm using his scripting style. That's obviously not the most efficient way to do it, but I don't want to force a certain style upon him. Let him learn at his own pace.

http://wiki.roblox.com/index.php/User:ElectricBlaze
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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