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: how could I make a local script load faster

Previous Thread :: Next Thread 
randomsmileyface is not online. randomsmileyface
Joined: 01 Aug 2010
Total Posts: 4538
02 Jul 2013 01:01 PM
I need my local scripts to load really fast, and normally from starterpack won't cut it.

what would make them load faster?

and
repeat wait(0.03) until game.Players.LocalPlayer.Torso
will break the script somehow
Report Abuse
magnalite is not online. magnalite
Joined: 18 Oct 2009
Total Posts: 2467
02 Jul 2013 01:03 PM
You can't make them "load" any faster.
Report Abuse
randomsmileyface is not online. randomsmileyface
Joined: 01 Aug 2010
Total Posts: 4538
02 Jul 2013 01:04 PM
run faster
Report Abuse
magnalite is not online. magnalite
Joined: 18 Oct 2009
Total Posts: 2467
02 Jul 2013 01:06 PM
Thats all down to your coding. There is so magical way to make it run faster.
Report Abuse
PsychoWaffle is not online. PsychoWaffle
Joined: 21 Feb 2012
Total Posts: 1429
02 Jul 2013 01:41 PM
someplayer.CharacterAdded:connect(functionhere)?

I have no idea if that will load any faster, though.
Report Abuse
randomsmileyface is not online. randomsmileyface
Joined: 01 Aug 2010
Total Posts: 4538
02 Jul 2013 03:56 PM
@magnalite.
no this is not the coding

its a very simple script with no waits beforehand

but when I spawn, I have to wait a certain amount of time to be able to run the local script from backpack
Report Abuse
PsychoWaffle is not online. PsychoWaffle
Joined: 21 Feb 2012
Total Posts: 1429
02 Jul 2013 10:55 PM
Just do what I said, then...
Report Abuse
SamuelKingx is not online. SamuelKingx
Joined: 27 Jan 2012
Total Posts: 3472
02 Jul 2013 10:59 PM
"game.Players.LocalPlayer.Torso"

Of course that will break it. Your torso is in your character.

Game.Players.LocalPlayer.Character.Torso
Report Abuse
randomsmileyface is not online. randomsmileyface
Joined: 01 Aug 2010
Total Posts: 4538
02 Jul 2013 11:01 PM
that does too
Report Abuse
SamuelKingx is not online. SamuelKingx
Joined: 27 Jan 2012
Total Posts: 3472
02 Jul 2013 11:03 PM
That won't break your code.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
02 Jul 2013 11:06 PM
Game.Players.LocalPlayer.Character:WaitForChild("Torso")
Report Abuse
randomsmileyface is not online. randomsmileyface
Joined: 01 Aug 2010
Total Posts: 4538
02 Jul 2013 11:23 PM
@Samuel, it does too. sometimes the script just keeps waiting and waiting and never goes
Report Abuse
MeBilly8440 is not online. MeBilly8440
Joined: 27 Jul 2009
Total Posts: 2783
02 Jul 2013 11:27 PM
I haven't done much research on what makes scripts go faster. However, if you're willing to do it yourself, here's a really good way!

local t = tick()
-- Your function here
print("The function took", tick() - t, "seconds to complete")
local t = tick()
-- Another version of your function here, but stated in a different way
print("The function took", tick() - t, "seconds to complete")

Now choose whichever one took less time to complete.

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
randomsmileyface is not online. randomsmileyface
Joined: 01 Aug 2010
Total Posts: 4538
02 Jul 2013 11:29 PM
the function will always take the same amount of time.

the fact that Roblox wont generate the script from the starterpack fast enough is annoying
Report Abuse
MeBilly8440 is not online. MeBilly8440
Joined: 27 Jul 2009
Total Posts: 2783
02 Jul 2013 11:34 PM
I read somewhere that there's ways to make your functions run faster, but I forget the page. I'll try to find it again for you, because if I remember correctly there is, in fact, ways to make your functions run faster. And to answer your "script not starting" fast enough questions:

repeat wait() until game.Players.LocalPlayer.Character
repeat wait() until game.Players.LocalPlayer.Character:FindFirstChild("Torso")

That will be fastest overall. Of course, it will only be faster by the teeeeniest bit (as in less than a 50th of a second). But it will be faster. However, if you have an extra 50th of a second on your hand and you want to be more compact, you can do this:

repeat wait() until game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:FindFirstChild("Torso")

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
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