Advertisement
choco99

fps drop when unfoccused

Sep 23rd, 2022
1,262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. local UserInputService = game:GetService("UserInputService") --not created off of start up
  2. local RunService = game:FindService("RunService") --created on start up
  3.  
  4. local function render(state)
  5.     RunService:Set3dRenderingEnabled(state)
  6. end
  7.  
  8. local function Initialize()
  9.     UserInputService.WindowFocusReleased:Connect(function() --I personally perfer this unless you need to refer to the function more then once
  10.         render(false)
  11.         setfpscap(10)
  12.     end)
  13.  
  14.     UserInputService.WindowFocused:Connect(function()
  15.         render(true)
  16.         setfpscap(360)
  17.     end)
  18. end
  19. Initialize()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement