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: Using RenderStepped

Previous Thread :: Next Thread 
Wittiest is not online. Wittiest
Joined: 02 Mar 2009
Total Posts: 9665
20 Feb 2016 12:35 AM
How can I use RenderStepped to make my function wait 1/60th of a second in each step for my for loop?


Report Abuse
CloneTrooper1019 is not online. CloneTrooper1019
Joined: 19 Jan 2009
Total Posts: 6227
20 Feb 2016 12:38 AM
local rs = game:GetService("RunService")

for i = 0,60 do
print(i)
rs.RenderStepped:wait()
end
Report Abuse
mycheeze is not online. mycheeze
Joined: 27 Jun 2011
Total Posts: 6748
20 Feb 2016 12:38 AM
game:GetService'RunService'.RenderStepped:wait()
Report Abuse
Wittiest is not online. Wittiest
Joined: 02 Mar 2009
Total Posts: 9665
20 Feb 2016 12:39 AM
So this will essentially make a :wait() that is 1/60 of a second instead of 1/30?


Report Abuse
mycheeze is not online. mycheeze
Joined: 27 Jun 2011
Total Posts: 6748
20 Feb 2016 12:41 AM
RenderStepped fires every time a frame is rendered, so it isn't a guarantee for it to be 60 times a second, but it has the potential since the maximum fps for roblox is 60.

But using :wait() doesn't mean it waits that amount of time, what is actually happening is :wait() is yielding until that event is fired. If you used workspace.DescendantAdded:wait() print'ye' it would wait until an instance is added to the workspace and then print 'ye'
Report Abuse
morashsPeasant is not online. morashsPeasant
Joined: 06 Jan 2011
Total Posts: 4944
20 Feb 2016 12:41 AM
(kind of?) Isn't this dependent on the clients frame rate?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
20 Feb 2016 12:48 AM
Yes but you keep track of how long it took and alter your calculations accordingly
Report Abuse
DrHaximus is not online. DrHaximus
Joined: 22 Nov 2011
Total Posts: 8410
20 Feb 2016 12:50 AM
as cntkillme said, you can record the deltatime between frames and take any framerate spiking into account

that said, you shouldn't really rely on a perfect framerate :p
Report Abuse
mycheeze is not online. mycheeze
Joined: 27 Jun 2011
Total Posts: 6748
20 Feb 2016 12:54 AM
@Dr, bb y must u label it as delta time qq
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