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 any wait time smaller than wait()?

Previous Thread :: Next Thread 
doggy00 is not online. doggy00
Joined: 11 Jan 2011
Total Posts: 3571
07 Jul 2016 04:45 AM
title


--what should be siggy be?
Report Abuse
MedwedianPresident is not online. MedwedianPresident
Joined: 03 Mar 2012
Total Posts: 1351
07 Jul 2016 04:49 AM
Idk. Try something like wait(0.000000000000000000000000000000000001).
Report Abuse
unwarranted is not online. unwarranted
Joined: 05 Jun 2009
Total Posts: 1087
07 Jul 2016 04:53 AM
game:GetService"RunService".RenderStepped:wait() ---wait's 1/60th of a second i believe


mom wheres the spaghetti | R$19,427
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
07 Jul 2016 05:01 AM
-- LocalScript:
game:GetService("RunService").RenderStepped:wait() -- 60 fps

-- Script:
game:GetService("RunService").HeartBeat:connect(function() -- User's fps.

end)

What doesn't make sense to me though is why RenderStepped only works in LocalScripts and runs in 60 fps, whereas HeartBeat runs in a script and capture's the user's fps. Oh well.


-=[ RAP: 347,257 || DurstAuric; the narb of ROBLOX ]=-
Report Abuse
MedwedianPresident is not online. MedwedianPresident
Joined: 03 Mar 2012
Total Posts: 1351
07 Jul 2016 05:07 AM
What is the shortest time possible with something like wait(0.00000000000001)?
Report Abuse
MathematicalPie is not online. MathematicalPie
Joined: 19 Aug 2014
Total Posts: 28
07 Jul 2016 05:07 AM
Just a little correction to above. HeartBeat is basically fired every time the game updates. For example let's say the game is running very smoothly (as stated on the wiki) at 1/60th of a second and fires successfully each time you have a 60FPS game not rendering.

Just remember that, the higher the divisor of the step, the faster. 1/1 = 1 but 1/2 = 0.5 so of course 1/60 is faster than 1/30.

Report Abuse
MathematicalPie is not online. MathematicalPie
Joined: 19 Aug 2014
Total Posts: 28
07 Jul 2016 05:08 AM
Also, never do things such as wait(0.00000000000000001) as it literally has no use and regardless of how small you make the number they'll be a roughly same timestep which means you're not doing much.
Report Abuse
unwarranted is not online. unwarranted
Joined: 05 Jun 2009
Total Posts: 1087
07 Jul 2016 05:09 AM
adding a negative number into wait() will make you time travel, ex: wait(-10)


mom wheres the spaghetti | R$19,427
Report Abuse
MathematicalPie is not online. MathematicalPie
Joined: 19 Aug 2014
Total Posts: 28
07 Jul 2016 05:10 AM
This is true^
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
07 Jul 2016 05:11 AM
Have you ever time traveled by doing that? I didn't think so. Putting that at the top of your script instead makes it read from the bottom up.


Report Abuse
MedwedianPresident is not online. MedwedianPresident
Joined: 03 Mar 2012
Total Posts: 1351
07 Jul 2016 05:11 AM
What would seriously happen if you say wait(-1)? Game would break or not?
Report Abuse
unwarranted is not online. unwarranted
Joined: 05 Jun 2009
Total Posts: 1087
07 Jul 2016 05:12 AM
nothing, sadly


mom wheres the spaghetti | R$19,427
Report Abuse
MathematicalPie is not online. MathematicalPie
Joined: 19 Aug 2014
Total Posts: 28
07 Jul 2016 05:12 AM
Nothing, as I said there's a standard value. If you enter an invalid value or you enter something like 0.000000000000000001, it won't make a difference.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
07 Jul 2016 05:23 AM
Oh, but there's coroutine.yield()
Test how long that waits for. :)
IIRC, it's ~1/60


Report Abuse
MathematicalPie is not online. MathematicalPie
Joined: 19 Aug 2014
Total Posts: 28
07 Jul 2016 05:38 AM
Yep, coroutine.yield() is 1/60th and is more stable than all the above!
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
07 Jul 2016 07:15 AM
The real question is:

Why do you need to wait for less time?
Report Abuse
doggy00 is not online. doggy00
Joined: 11 Jan 2011
Total Posts: 3571
07 Jul 2016 08:57 AM
Because ROBLOX studio gets different test results than ROBLOX player, and I fixed it by adding a wait() somewhere but it can still be kinda buggy in a way.


--what should be siggy be?
Report Abuse
0Dan is not online. 0Dan
Joined: 22 Oct 2009
Total Posts: 2552
07 Jul 2016 08:59 AM
"Idk. Try something like wait(0.000000000000000000000000000000000001)."
That's useless, it'll just automatically be rounded back to the normal wait() time
> print(wait(0.000000000000000000000000000000000001))
0.038490141465239 42.51938375691
> print(wait())
0.032619116495063 50.161808152217


𝐃𝐚𝐧𝐢𝐞𝐥
Report Abuse
crazyman32 is not online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
07 Jul 2016 09:24 AM
I'm not convinced you guys know what you're talking about.

Please note that things like RenderStepped and Heartbeat are throttled. That means that they do not guarantee a consistent update rate. In other words, it is not guaranteed to stay at 60FPS. For instance, it might move between 40FPS and 60FPS every few seconds in a really performance-intensive game.

There is really no reason to have code running at a faster rate than the rendering speed. Here's the main gist of this all:

If you are rendering objects (moving objects, moving the camera, etc.), then you should do that with RenderStepped. If you are updating game logic, you should do that with Heartbeat. If you need anything faster, you should just use a loop to do multiple iterations within an update frame.
Report Abuse
crazyman32 is not online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
07 Jul 2016 09:26 AM
Also: When you use the "wait" function, what happens is that your code yields and is thrown into a queue to be resumed essentially. That queue is only flushed based on the speed of the task scheduler, which I believe runs alongside Stepped or Heartbeat. That means that throwing a really small number into a 'wait' function is pointless.
Report Abuse
TheAddictPlayer is not online. TheAddictPlayer
Joined: 21 Jun 2014
Total Posts: 2003
07 Jul 2016 09:30 AM
wait(math.min())?


"When you're gonna do something stupid then don't do it it's simple as 123" - TheAddictPlayer | RIP Tickets you'll be always missed ;-; 2007-2016 | Errare humanum est, perseverare diabolicum | Current RAP: R$210
Report Abuse
Skellobit is not online. Skellobit
Joined: 13 Apr 2016
Total Posts: 12758
07 Jul 2016 09:30 AM
^ Do you even know what math.min is/how it works?

Formerly ToxicDominator - add 17,509 posts | :(){:|:&};:
Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
07 Jul 2016 09:34 AM
^ lmao
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
07 Jul 2016 10:14 AM
coroutine.yield() is the shortest wait


#code R+ | local RAP = "R$762,351"; local robux = "R$72,046"; life = nil;
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
07 Jul 2016 10:28 AM
No wait is the shortest.


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