--CODED BY V1SIONUSE--
local fps = 0
local rs = game:GetService("RunService")
local textLabel = script.Parent
local tweenService = game:GetService("TweenService")
local textColors = {
Red = Color3.fromRGB(255, 0, 0),
White = Color3.fromRGB(255, 255, 255)
}
function updateFPS()
fps = fps + 1
end
rs.RenderStepped:Connect(updateFPS)
local function blinkText()
local originalColor = textLabel.TextColor3
local blinkColor = textColors.Red
local tweenDuration = 0.2 -- Duration of each blink in seconds
local numBlinks = 6 -- Number of times to blink
for i = 1, numBlinks do
local blinkTween = tweenService:Create(textLabel, TweenInfo.new(tweenDuration), { TextColor3 = blinkColor })
blinkTween:Play()
blinkTween.Completed:Wait()
local originalTween = tweenService:Create(textLabel, TweenInfo.new(tweenDuration), { TextColor3 = originalColor })
originalTween:Play()
originalTween.Completed:Wait()
end
textLabel.TextColor3 = originalColor
end
while wait(1) do
textLabel.Text = fps .. " FPS"
local targetColor
if fps < 30 then
targetColor = textColors.Red
blinkText()
else
targetColor = textColors.White
end
local currentColor = textLabel.TextColor3
local tweenInfo = TweenInfo.new(0.5) -- Set the duration of the tween in seconds
local tween = tweenService:Create(textLabel, tweenInfo, { TextColor3 = targetColor })
tween:Play()
fps = 0
end
Cool Resource, but I recommend using TopbarPlus and NumberSpinner, as they do a better job on that, Here is the code which can help you (no copy paste!)
local RunService = game:GetService("RunService")
local Icon = require(game.ReplicatedStorage.Icon)
local NumberSpinner = require(game.ReplicatedStorage.NumberSpinner)
local fps = 0
RunService.RenderStepped:Connect(function()
fps += 1
end)
local icon = Icon.new()
icon:setRight()
icon:lock()
icon:setSize(75, 32)
icon:give(function(ic)
local spinner = NumberSpinner.new()
ic:convertLabelToNumberSpinner(spinner)
spinner.Duration = 0.25
spinner.Prefix = ""
spinner.Suffix = " FPS"
spinner.Decimals = 0
coroutine.wrap(function()
while task.wait(1) do
spinner.Value = fps
fps = 0
end
end)()
end)
This is the model (packed using @LambHubGoBrrrrr’s Packer Plugin) FPSCounter.rbxm, but you don’t need it if you are fine by installing it by hand
Mind I remind you, the original code is wrapping everything in a while wait(1) do which clearly is a bad practice. We can always use the provided deltaTime which tells us how long it has elapsed since the last RenderStep.
That’s amazing and I congratulate you, but instead of just posting a random script and calling the OP’s resource reinventing the wheel, I suggest giving a suggestion on how exactly they could improve by using their code with examples.
Also, your code you replied with has unused variables.