This is just a showcase of some FPS detection scripts I wrote. There are two options for Detection, #1 and #2. If you want a detailed explanation, check the Notes & Credits. If you run the project normally, you should have a pretty steady Frame rate, but to test it press space to create lag. It will go away in a couple of seconds.
This section is for explanations, credits, and instructions on how to apply it to your project. Before I start, I just want to say this is not mobile friendly. The FPS detection works for anything, but creating lag is not available on mobile. Most mobile devices just don't have the same computing power as most computers, and choosing the create lag button is taxing on even my computer. I don't want to crash anyone's device. You can run the script manually, but be prepared. Alright, I'll explain how it works. Most of my mini projects are just testing features to see if I can put them in my game. I needed an FPS detector, so I did some research. The thing is, I have a thumbnail program in my game. I'll explain those later. But the thing with thumbnail scripts is that they use the timer function, resetting it every millisecond. And FPS scripts also use the timer script, but they need it to continuously run. So it's one or the other. And I need the thumbnail. So, I started tinkering with FPS scripts. And that's when I came up with this. Script #1 This is an adaption of the regular FPS script. Every repeat, it sets a timer variable to the current value of the timer. It then adds 1 to the frames variable until the timer is greater then the timer variable +1. Then, it sets the FPS variable to the frames variable, resets the frames variable, and repeats. Script This one is more complicated. There are actually two scripts, and two timer variables. One script is a forever loop that sets the first timer variable to the current second. The other script is first setting the second timer variable to the current second. Then, it waits until the first, up to date variable to be greater then the second variable. In the meantime, it is counting frames. If the first variable is 59, it waits until the second variable is greater, because the first will go down to 0 or 1. Once that happens, it sets the second variable to the first, sets the FPS to the frames variable, and reset the frames and repeat. Thumbnails The only thumbnail script went something like this: Forever, reset the timer. If the timer is ever greater then 0.01, which would mean the script was stopped, then show the thumbnail. If you plan to use a thumbnail, but not FPS detection, use that script. However, my script sets a third timer to the timer every millisecond. Then, it waits until the timer is greater then the third timer, which would mean the third timer stopped updating, and then show the thumbnail. It also resets the third timer. _____________________________________________ Feel free to use the scripts or the thumbnail. You don't even have to give me credit in notes and credits, just put my name in the sprites name. _____________________________________________ All the scripts are written by me, but I would like to give credit to people like for allowing me to do research on this subject. _____________________________________________ This is really easy to put it into your project. Just make sure you don't have similarly named variables. Just pop it in and position the FPS variables.