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: Is there some method I could make something load last?

Previous Thread :: Next Thread 
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
27 May 2015 03:32 PM
If I just clone a map into workspace, my main script will continue executing lines under the line that clones, regardless if the map is completely loaded or not. I was thinking a foolproof way to get around this was to make it so the script waits for a child in the map that loads last before it executes the rest of the code, like Map:WaitForChild("DoneLoading")
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
27 May 2015 03:36 PM
Just use a for loop.

for i, v in pairs(Map:GetChildren()) do
v.Parent = workspace
end

--Other things.

Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784
Report Abuse
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
27 May 2015 03:36 PM
No, because then it won't stay grouped and I will have a hard time removing it.
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
27 May 2015 03:41 PM
put the parts of the map in a designated empty model inside of workspace called "MapHolder" or something like that.
Report Abuse
DeveloperBlue is not online. DeveloperBlue
Joined: 15 Apr 2009
Total Posts: 1344
27 May 2015 03:45 PM
Did using :WaitForChild() not work?


- “My dear, here we must run as fast as we can, just to stay in place. And if you wish to go anywhere you must run twice as fast as that.”
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
27 May 2015 03:53 PM
so put an empty model named MapHolder inside of workspace, and do some like this:

local randomMap = maps[math.random(1, #maps)]

function loadMap(map)
for i, v in pairs(map:GetChildren()) do
v.Parent = game.Workspace.MapHolder
wait()
end
end

-- code

loadMap(randomMap)
-- stuff after map has loaded

when you want to clear the map, just loop through map holder and destroy everything.

for i, v in pairs(game.Workspace.MapHolder:GetChildren()) do
v:Destroy()
end

and that should yield the thread until the map is fully loaded i think

i didn't test this
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
27 May 2015 04:00 PM
I just gave you the barebones dude. You need to add the meat. :P

Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784
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