Advertisement
Guest User

Flex Your Fps script

a guest
Jul 30th, 2024
20,641
2
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.54 KB | None | 2 0
  1. local Players = game:GetService("Players")
  2. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  3.  
  4. local player = Players.LocalPlayer
  5. local screenGui = Instance.new("ScreenGui")
  6. screenGui.Name = "FPSControlGUI"
  7. screenGui.Parent = player:WaitForChild("PlayerGui")
  8.  
  9. local frame = Instance.new("Frame")
  10. frame.Size = UDim2.new(0, 300, 0, 250)
  11. frame.Position = UDim2.new(0, 10, 0, 10)
  12. frame.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  13. frame.Parent = screenGui
  14.  
  15. local function makeDraggable(frame)
  16. local dragToggle = nil
  17. local dragInput = nil
  18. local dragStart = nil
  19. local startPos = nil
  20.  
  21. frame.InputBegan:Connect(function(input)
  22. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  23. dragToggle = true
  24. dragStart = input.Position
  25. startPos = frame.Position
  26.  
  27. input.Changed:Connect(function()
  28. if input.UserInputState == Enum.UserInputState.End then
  29. dragToggle = false
  30. end
  31. end)
  32. end
  33. end)
  34.  
  35. frame.InputChanged:Connect(function(input)
  36. if input.UserInputType == Enum.UserInputType.MouseMovement then
  37. dragInput = input
  38. end
  39. end)
  40.  
  41. game:GetService("RunService").RenderStepped:Connect(function()
  42. if dragToggle and dragInput then
  43. local delta = dragInput.Position - dragStart
  44. frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  45. end
  46. end)
  47. end
  48.  
  49. makeDraggable(frame)
  50.  
  51. local fpsLabel = Instance.new("TextLabel")
  52. fpsLabel.Size = UDim2.new(1, 0, 0, 30)
  53. fpsLabel.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  54. fpsLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  55. fpsLabel.Text = "FPS Control"
  56. fpsLabel.Parent = frame
  57.  
  58. local fpsInput = Instance.new("TextBox")
  59. fpsInput.Size = UDim2.new(1, -20, 0, 30)
  60. fpsInput.Position = UDim2.new(0, 10, 0, 40)
  61. fpsInput.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  62. fpsInput.TextColor3 = Color3.fromRGB(0, 0, 0)
  63. fpsInput.PlaceholderText = "Enter FPS Value"
  64. fpsInput.Parent = frame
  65.  
  66. local fluctuationInput = Instance.new("TextBox")
  67. fluctuationInput.Size = UDim2.new(1, -20, 0, 30)
  68. fluctuationInput.Position = UDim2.new(0, 10, 0, 80)
  69. fluctuationInput.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  70. fluctuationInput.TextColor3 = Color3.fromRGB(0, 0, 0)
  71. fluctuationInput.PlaceholderText = "Enter Fluctuation Range"
  72. fluctuationInput.Parent = frame
  73.  
  74. local waitTimeInput = Instance.new("TextBox")
  75. waitTimeInput.Size = UDim2.new(1, -20, 0, 30)
  76. waitTimeInput.Position = UDim2.new(0, 10, 0, 120)
  77. waitTimeInput.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  78. waitTimeInput.TextColor3 = Color3.fromRGB(0, 0, 0)
  79. waitTimeInput.PlaceholderText = "Enter Wait Time (s)"
  80. waitTimeInput.Parent = frame
  81.  
  82. local enterButton = Instance.new("TextButton")
  83. enterButton.Size = UDim2.new(1, -20, 0, 30)
  84. enterButton.Position = UDim2.new(0, 10, 0, 160)
  85. enterButton.BackgroundColor3 = Color3.fromRGB(0, 128, 0)
  86. enterButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  87. enterButton.Text = "Apply"
  88. enterButton.Parent = frame
  89.  
  90. local clearButton = Instance.new("TextButton")
  91. clearButton.Size = UDim2.new(1, -20, 0, 30)
  92. clearButton.Position = UDim2.new(0, 10, 0, 200)
  93. clearButton.BackgroundColor3 = Color3.fromRGB(128, 0, 0)
  94. clearButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  95. clearButton.Text = "Clear FPS"
  96. clearButton.Parent = frame
  97.  
  98. local notification = Instance.new("TextLabel")
  99. notification.Size = UDim2.new(1, 0, 0, 50)
  100. notification.Position = UDim2.new(0, 0, 1, -50)
  101. notification.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  102. notification.TextColor3 = Color3.fromRGB(255, 255, 255)
  103. notification.Text = "GUI Hidden"
  104. notification.Visible = false
  105. notification.Parent = screenGui
  106.  
  107. local UserInputService = game:GetService("UserInputService")
  108. local isVisible = true
  109.  
  110. UserInputService.InputBegan:Connect(function(input)
  111. if input.KeyCode == Enum.KeyCode.RightShift then
  112. isVisible = not isVisible
  113. frame.Visible = isVisible
  114. notification.Visible = not isVisible
  115. notification.Text = isVisible and "GUI Visible" or "GUI Hidden"
  116. end
  117. end)
  118.  
  119. local fluctuationCoroutine = nil
  120. local storedFPS = 1000
  121.  
  122. local function stopFluctuation()
  123. if fluctuationCoroutine then
  124. coroutine.close(fluctuationCoroutine)
  125. fluctuationCoroutine = nil
  126. end
  127. end
  128.  
  129. clearButton.MouseButton1Click:Connect(function()
  130. stopFluctuation()
  131. local args = { [1] = storedFPS }
  132. ReplicatedStorage.UpdateFPS:FireServer(unpack(args))
  133. fpsInput.Text = tostring(storedFPS)
  134. fluctuationInput.Text = "0"
  135. waitTimeInput.Text = "0.01"
  136. end)
  137.  
  138. local function applyFPSSettings(fpsValue, fluctuationRange, waitTime)
  139. if waitTime <= 0 then
  140. waitTime = 0.01
  141. end
  142.  
  143. while true do
  144. local fluctuation = math.random(-fluctuationRange, fluctuationRange)
  145. local fluctuatedValue = fpsValue + fluctuation
  146.  
  147. local args = { fluctuatedValue }
  148. ReplicatedStorage.UpdateFPS:FireServer(unpack(args))
  149. wait(waitTime)
  150. end
  151. end
  152.  
  153. enterButton.MouseButton1Click:Connect(function()
  154. storedFPS = tonumber(fpsInput.Text) or 1000
  155. local fluctuationRange = tonumber(fluctuationInput.Text) or 10
  156. local waitTime = tonumber(waitTimeInput.Text) or 0.01
  157.  
  158. stopFluctuation()
  159. fluctuationCoroutine = coroutine.create(function()
  160. applyFPSSettings(storedFPS, fluctuationRange, waitTime)
  161. end)
  162. coroutine.resume(fluctuationCoroutine)
  163. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement