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 can i make this more efficient?

Previous Thread :: Next Thread 
xXTheRobotXx is not online. xXTheRobotXx
Joined: 05 May 2012
Total Posts: 13343
07 Feb 2016 03:23 PM
for i,v in pairs(tree:GetChildren()) do
if v:IsA("Part") then
for s = 0,1,.1 do
v.Transparency = s
wait()
end
v:Destroy()
end
end

this works fine, however, it has to go through every part individually

how can i make it so that they all disappear at once


#Code print("Narwhals are our future")
Report Abuse
TheGreenDeveloper is not online. TheGreenDeveloper
Joined: 29 Dec 2013
Total Posts: 776
07 Feb 2016 03:27 PM
for s = 0,1,.1 do
for i,v in pairs(tree:GetChildren()) do
if v:IsA("Part") then
v.Transparency = s
end
end
wait()
end
for i,v in pairs(tree:GetChildren()) do
if v:IsA("Part") then
v:Destroy()
end
end
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
07 Feb 2016 03:28 PM
local function delete(part)
for i = 0,1,0.1 do
part.Transparency = i
wait()
end
part:Destroy()
end

for i,v in pairs(tree:GetChildren() do
if v:IsA("Part") then
coroutine.resume(coroutine.create(delete),v)
end
end


Report Abuse
xXTheRobotXx is not online. xXTheRobotXx
Joined: 05 May 2012
Total Posts: 13343
07 Feb 2016 03:28 PM
@TheGreen

worked like a charm

much appreciated


#Code print("Narwhals are our future")
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
07 Feb 2016 03:28 PM
for i,v in pairs(tree:GetChildren()) do
if v:IsA("BasePart") then
spawn(function()
for s = 0,1,.1 do
v.Transparency = s
wait()
end
v:Destroy()
end)
end
end


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