TEMPLATE NAME: FPS Meter
TEMPLATE VERSION: 1.0.0
This module calculates players' frame rates and can display their FPS on screen. While it's possible to see frame rate through other means and Core provides good optimization tools, you may want your game to either:
- Show the FPS (frames per second) to the players.
- Detect players with low FPS and automatically reduce visual quality to improve their FPS.
TEMPLATE VERSION NOTES:
1.0.0 - Initial release
Drop a copy of the "FPSMeter" template into the hierarchy.
Players should now see their FPS in the upper-right corner.
To stop displaying the FPS, delete the "UI Text Box" object or
set its visibility to "Off".
Make client-side performance decisions, such as disabling post-
process filters, by reading a player's FPS from the global table:
function Tick() if _G.FPS then someEffectObject.isEnabled = (_G.FPS > 50) end Task.Wait(0.4) end
Make server-side decisions for a player based on their FPS:
Events.ConnectForPlayer("FrameRate", function(player, fps) print(player.name .. "'s FPS = " .. tostring(fps)) -- TODO: Make decisions for player end) function OnPlayerJoined(player) Task.Wait(1) if _G["Utils.FPSMeter"] then _G["Utils.FPSMeter"].GetFrameRateForPlayer(player) end end Game.playerJoinedEvent:Connect(OnPlayerJoined)