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: [Plugins] Checking when the place is all loaded up

Previous Thread :: Next Thread 
coplox is not online. coplox
Joined: 07 Jun 2008
Total Posts: 3252
25 Nov 2013 01:51 PM
I made a camera reset plugin, it snaps your camera (clones it and keeps the clone in memory), and lets you snap back to the same settings it had (sets the important properties in your CurrentCamera to the one in memory).

I had a problem, the place was loading up the plugin before everything was set and the plugin was snapping a newly created camera with default settings, AFTER which studio would set the properties of the camera to the one in the place.

I solved it, and I want to give it to you guys so you can use it in your plugins if you need to wait for the place to be completely loaded before your plugin wants to mess with things.

Here's the code:

--------
local ChangedTime = tick();
local UpdateChangedTime = function()
ChangedTime = tick();
end;
local Listeners = {};
local ChangeListen = Game:GetService("Workspace").DescendantAdded:connect(function(d)
UpdateChangedTime();
table.insert(Listeners, d.Changed:connect(UpdateChangedTime));
end);
repeat wait();
until (tick() - ChangedTime) > 0.5
for i, L in pairs(Listeners) do
L:disconnect();
end;
Listeners = {};
--------

Take it, use it, talk about the concept in this thread and possibly show everyone your crazy method that does the same thing!
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
25 Nov 2013 02:14 PM
Here's my method.

game.Loaded:wait()

:)
Report Abuse
coplox is not online. coplox
Joined: 07 Jun 2008
Total Posts: 3252
25 Nov 2013 02:26 PM
:O

I'm dumb..

..wait..

I just tried it in my plugin and it isn't firing at all.
MY CODE IS SUPERIOR
Report Abuse
coplox is not online. coplox
Joined: 07 Jun 2008
Total Posts: 3252
25 Nov 2013 02:35 PM
Well this is embarrassing..

I forgot to include the strip of code to disconnect the original listener, oh well..


Sorry for being dumb, code v1.0.1:

--------
local ChangedTime = tick();
local UpdateChangedTime = function()
ChangedTime = tick();
end;
local Listeners = {};
table.insert(Listeners, Game:GetService("Workspace").DescendantAdded:connect(function(d)
UpdateChangedTime();
table.insert(Listeners, d.Changed:connect(UpdateChangedTime));
end));
repeat wait();
until (tick() - ChangedTime) > 0.5
for i, L in pairs(Listeners) do
L:disconnect();
end;
Listeners = {};
--------
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
25 Nov 2013 03:14 PM
guys omg

if game:IsLoaded() == false then
game.Loaded:wait()
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