I have made a FPS limiter script, and it's working just fine. But if the user changes the FPS limit to something else, they would need to rejoin the game for the changes to take effect, because the script wouldn't register the changes.
I have tried disabling and enabling again and cloning but none worked. Can someone help me out?
Script: (without the resetting code)
local FPSCAP = game.StarterGui.ScreenGui.System.FPS.LimitFPSto.Value
local LOOPCount = 200
local MLoopCount = 27
local FPS = 0
local Broken = 0
local function DOLOOP()
spawn(function()
while true do
game:GetService("RunService").Heartbeat:Wait()
if FPS+5 < FPSCAP and Broken <= LOOPCount*MLoopCount then
Broken += 1
break
end
end
end)
end
game:GetService("RunService").RenderStepped:Connect(function(delta)
FPS = 1/delta
end)
spawn(function()
while true do
game:GetService("RunService").Heartbeat:Wait()
if FPS >= FPSCAP then
spawn(function()
for i = 1, LOOPCount do
DOLOOP()
end
end)
end
end
end)
spawn(function()
while wait(1) do
Broken = 0
end
end)

1 comment
I don't understand anything about it. I belive it won't helpw ith the issue because once the script is started, the local FPS cap value won't change anymore, and it'll just be what the value was at joining