I need some help making my FPS performance warner. This is how it looks like in-game:
Legend
Orange = Unstable performance, low FPS ---- NAME: performanceWarning
White symbol = opens game status GUI (where FPS is listed) ---- NAME: info
If the FPS is very low, the orange will turn red.
I’ve tried to add this script to performanceWarning which will decide when it will be visible or change color to orange/red. These are the two things I’ve tried to do:
local RunService = game:GetService("RunService")
local FpsLabel = script.Parent
local TimeFunction = RunService:IsRunning() and time or os.clock
local LastIteration, Start
local FrameUpdateTable = {}
local function HeartbeatUpdate()
LastIteration = TimeFunction()
for Index = #FrameUpdateTable, 1, -1 do
FrameUpdateTable[Index + 1] = FrameUpdateTable[Index] >= LastIteration - 1 and FrameUpdateTable[Index] or nil
end
FrameUpdateTable[1] = LastIteration
local FPS = tostring(math.floor(TimeFunction() - Start >= 1 and #FrameUpdateTable or #FrameUpdateTable / (TimeFunction() - Start)))
print(FPS)
end
Start = TimeFunction()
RunService.Heartbeat:Connect(HeartbeatUpdate)
Then remove the print statement and add the if statement for something like: