Mr_3242

Fps Limiter and counter

Sep 12th, 2026 (edited)
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.13 KB | None | 0 0
  1. --// RAYFIELD
  2. local Rayfield = loadstring(game:HttpGet("https://sirius.menu/rayfield"))()
  3.  
  4. --// CLEAN RE-EXECUTE
  5. if getgenv().FpsController then
  6. pcall(getgenv().FpsController)
  7. end
  8.  
  9. --// FILTER RAYFIELD SYSTEM NOTIFICATIONS
  10. local oldNotify = Rayfield.Notify
  11.  
  12. Rayfield.Notify = function(self, data)
  13. if data and data.Title then
  14. local t = tostring(data.Title)
  15.  
  16. if t:find("Rayfield") or t:find("Interface") then
  17. return
  18. end
  19. end
  20.  
  21. return oldNotify(self, data)
  22. end
  23.  
  24. --// CUSTOM NOTIFICATION
  25. local function Notify(title, content)
  26. Rayfield:Notify({
  27. Title = title,
  28. Content = content,
  29. Duration = 3,
  30. Image = 4483362458
  31. })
  32. end
  33.  
  34. --// WINDOW
  35. local Window = Rayfield:CreateWindow({
  36. Name = "FPS Limiter",
  37. LoadingTitle = "Loading..",
  38. LoadingSubtitle = "Follow me on TikTok Mr_3242",
  39.  
  40. ConfigurationSaving = {
  41. Enabled = false
  42. },
  43.  
  44. Discord = {
  45. Enabled = false
  46. },
  47.  
  48. KeySystem = false
  49. })
  50.  
  51. --// TABS
  52. local FPSTab = Window:CreateTab("FPS", 4483362458)
  53. local CreditsTab = Window:CreateTab("Credits", 4483362458)
  54. local UnloadTab = Window:CreateTab("Unload", 4483362458)
  55.  
  56. --// STATE
  57. local RunService = game:GetService("RunService")
  58.  
  59. local fpsLimit = 60
  60. local limiterEnabled = false
  61.  
  62. local fpsConnection
  63.  
  64. --// =========================================================
  65. --// FPS COUNTER
  66. --// =========================================================
  67.  
  68. local frameTimes = {}
  69. local totalTime = 0
  70. local updateTimer = 0
  71. local window = 1
  72.  
  73. local FPSLabel = FPSTab:CreateLabel("FPS: --")
  74.  
  75. fpsConnection = RunService.RenderStepped:Connect(function(dt)
  76. frameTimes[#frameTimes + 1] = dt
  77. totalTime += dt
  78. updateTimer += dt
  79.  
  80. -- Keep the latest 1 second of frame timing
  81. if totalTime > window then
  82. local excess = totalTime - window
  83.  
  84. while #frameTimes > 0 and excess >= frameTimes[1] do
  85. excess -= frameTimes[1]
  86. totalTime -= frameTimes[1]
  87. table.remove(frameTimes, 1)
  88. end
  89.  
  90. if #frameTimes > 0 then
  91. totalTime -= excess
  92. frameTimes[1] -= excess
  93. end
  94. end
  95.  
  96. -- Update display every 0.1 seconds
  97. if updateTimer >= 0.1 then
  98. if totalTime > 0 then
  99. local fps = #frameTimes / totalTime
  100.  
  101. FPSLabel:Set(
  102. string.format("FPS: %.1f", fps)
  103. )
  104. end
  105.  
  106. updateTimer = 0
  107. end
  108. end)
  109.  
  110. --// =========================================================
  111. --// FPS LIMITER
  112. --// =========================================================
  113.  
  114. local function setFPSLimit(value)
  115. if setfpscap then
  116. setfpscap(value)
  117. end
  118. end
  119.  
  120. --// =========================================================
  121. --// FPS SLIDER
  122. --// =========================================================
  123.  
  124. FPSTab:CreateSlider({
  125. Name = "FPS Limit",
  126. Range = {1, 3000},
  127. Increment = 1,
  128. Suffix = " FPS",
  129. CurrentValue = 240,
  130. Flag = "FPSLimit",
  131.  
  132. Callback = function(Value)
  133. fpsLimit = Value
  134.  
  135. if limiterEnabled then
  136. setFPSLimit(fpsLimit)
  137. end
  138. end
  139. })
  140.  
  141. --// =========================================================
  142. --// UNLOCK FPS
  143. --// =========================================================
  144.  
  145. FPSTab:CreateButton({
  146. Name = "Unlock FPS",
  147.  
  148. Callback = function()
  149. if setfpscap then
  150. setfpscap(9999)
  151. end
  152. end
  153. })
  154.  
  155. --// =========================================================
  156. --// FPS LIMITER TOGGLE
  157. --// =========================================================
  158.  
  159. local FPSLimiterToggle
  160.  
  161. FPSLimiterToggle = FPSTab:CreateToggle({
  162. Name = "FPS Limiter",
  163. CurrentValue = false,
  164. Flag = "FPSLimiter",
  165.  
  166. Callback = function(Value)
  167. limiterEnabled = Value
  168.  
  169. if limiterEnabled then
  170. setFPSLimit(fpsLimit)
  171. end
  172. end
  173. })
  174.  
  175. --// =========================================================
  176. --// CREDITS
  177. --// =========================================================
  178.  
  179. CreditsTab:CreateParagraph({
  180. Title = "Credits",
  181. Content = "Script created by Mr_3242\nThanks for using the script!"
  182. })
  183.  
  184. CreditsTab:CreateButton({
  185. Name = "Copy TikTok Link",
  186.  
  187. Callback = function()
  188. if setclipboard then
  189. setclipboard("https://www.tiktok.com/@Mr_3242")
  190. Notify("Copied", "TikTok link copied")
  191. end
  192. end
  193. })
  194.  
  195. CreditsTab:CreateButton({
  196. Name = "Copy YouTube Link",
  197.  
  198. Callback = function()
  199. if setclipboard then
  200. setclipboard("https://www.youtube.com/@Mr_3242.")
  201. Notify("Copied", "YouTube link copied")
  202. end
  203. end
  204. })
  205.  
  206. CreditsTab:CreateButton({
  207. Name = "Copy Twitch Link",
  208.  
  209. Callback = function()
  210. if setclipboard then
  211. setclipboard("https://m.twitch.tv/quantumx_42/home")
  212. Notify("Copied", "Twitch link copied")
  213. end
  214. end
  215. })
  216.  
  217. --// =========================================================
  218. --// UNLOAD FUNCTION
  219. --// =========================================================
  220.  
  221. getgenv().FpsController = function()
  222.  
  223. -- Disable the limiter state
  224. limiterEnabled = false
  225.  
  226. -- Turn the Rayfield toggle off
  227. pcall(function()
  228. FPSLimiterToggle:Set(false)
  229. end)
  230.  
  231. -- Remove the executor FPS cap
  232. pcall(function()
  233. if setfpscap then
  234. setfpscap(9999)
  235. end
  236. end)
  237.  
  238. -- Stop FPS counter
  239. pcall(function()
  240. if fpsConnection then
  241. fpsConnection:Disconnect()
  242. fpsConnection = nil
  243. end
  244. end)
  245.  
  246. -- Destroy Rayfield
  247. pcall(function()
  248. Rayfield:Destroy()
  249. end)
  250.  
  251. -- Clean global
  252. getgenv().FpsController = nil
  253. end
  254.  
  255. --// =========================================================
  256. --// UNLOAD BUTTON
  257. --// =========================================================
  258.  
  259. UnloadTab:CreateButton({
  260. Name = "Unload Script",
  261.  
  262. Callback = function()
  263. if getgenv().FpsController then
  264. getgenv().FpsController()
  265. end
  266. end
  267. })
Advertisement
Add Comment
Please, Sign In to add comment