FPSSetter - Set Players' FPS

I have no clue how this worked, but it did. I’m guessing because of the lag it causes with the LocalScript, though hackers could remove that.

Also, I had to make some changes to the script for it to work. The script you wrote had some major unneeded repitition.

Here’s the sources:

image

Script named SetFPS, parented to ServerScriptService:

FPSSetter = require(script.FPSSetter)
SetFPS = FPSSetter.SetFPS

fpsToSetTo = 5

game.Players.PlayerAdded:Connect(function(player)
	wait(5) -- so that you can feel the change
	print("set",player,"'s fps to",fpsToSetTo)
	SetFPS(player,fpsToSetTo)
end)

ModuleScript named FPSSetter, parented to SetFPS:

local FPSSetter = {}

function FPSSetter.SetFPS(player, fps)
	local oldscript = player.PlayerGui:FindFirstChild("FPSSetting")
	if oldscript then oldscript:Destroy() end

	pcall(function()
		local src = script.FPSSetting:Clone()
		src.Parent = player.PlayerGui
		src.Name = "FPSSetting"
		src:SetAttribute("MaxFPS", fps)
	end)
end


return FPSSetter

LocalScript named FPSSetting, parented to FPSSetter:

local RunService = game:GetService("RunService")

wait()

while true do
	local MaxFPS = script:GetAttribute('MaxFPS') or 60
	
	local t = tick()
	RunService.RenderStepped:Wait()
	repeat until (t + 1/MaxFPS) < tick()
end

(I have a wait(5) in the Script so that I can feel the change 5 seconds after joining.)

A major flaw you had was putting

local MaxFPS = script:GetAttribute('MaxFPS') or 60

outside of the while true do loop.

Other than that, it’s pretty good, even if hackers can remove it.

2 Likes