#Running code at 60 Fps

1 messages · Page 1 of 1 (latest)

wicked sparrow
#

I want a part of my code to run at 60 FPS, regardless of the player’s FPS. However, I’ve been told that a while loop with a delay isn’t precise, and Heartbeat/Stepped won’t run at 60 FPS when the player’s frame rate drops below that.

agile stream
#

impossible

flint yew
#

But if you're looking to always make it run at 60fps then yeah it's impossible

wicked sparrow
#

ok ):

agile stream
#

also, in fact, if you strictly need 60 fps you may want to think of another way to do this, as you didn't say what are you trying to do

wicked sparrow
#

i wanna move alot of objects with tween but had the issue that tweeing onyl had limited function so i tried making my own Tweening with lerping but on key factor of tweening was it run at 60fps and i cant replicate it

proud scaffoldBOT
#

studio** You are now Level 2! **studio

agile stream
#

🤔 tween is just updating a variable each frame thats why if it less fps is so much less smoother and if its more fps it is so much more smoother, that doesn't say either why do you strictly need 60 fps

wicked sparrow
#

yes but, if i do hearthbeat the movement may be slower/ faster depending on the players fps

agile stream
#

in that case you should use delta time, you can find resources on why and how you can use it

atomic elm
#

just use tweenservice.

#

it can handle hundreds of parts. you're good. prove a performance problem, like actually prove it, recording, benchmark stats, etc, and then consider optimizing it. not before.

atomic elm
wicked sparrow
atomic elm
wicked sparrow
atomic elm
#

if you really want to take it advanced

atomic elm
#

i realize how obvious that sounds but, no, really, it really is that stupid simple of a solution.

wicked sparrow
#

):

atomic elm
#

there's no fancy tricky trick that magically interpolates between large time gaps in frames.

#

you have to make your own.

#

deal with it.

wicked sparrow