Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Problem with my FPS gui?

I've made an fps gui/script, it all works fine, but i've made it so the text turns to red if it's smaller than 10, and attempted to make it go to it's original colour if it's greater than 10. It goes red, but it won't go yellow again (yes, it does go above 10, i reached 60). It's a LocalScript parented inside a TextBox, which is parented in a ScreenGui. Could someone please help me fix this? Thanks in advance.

wait(0.0000001)

local gui = script.Parent
local Format = "%.0f"
local delay = 0.0000001
function M8FPS()
	while (true) do
		local fps = game.Workspace:GetRealPhysicsFPS()
		local fpstr = Format:format(fps)
		gui.Text = fpstr
		wait(delay)
		if game.Workspace:GetRealPhysicsFPS() < 10 then
			script.Parent.TextColor3 = Color3.new(206/255,0,0)
			
			if game.Workspace:GetRealPhysicsFPS() > 11 then
			script.Parent.TextColor3 = Color3.new(1,1,0)
			
			
           end
            end
             end
              end

M8FPS()

1 answer

✓ Accepted answer

Color3s take decimal values, so you want to have Color3.new(206/255,0,0) instead. Neither of those colors are yellow, also. They're just very slightly different shades of red. Yellow is Color3.new(1,1,0).

Since your code is formatted horribly, I'll also point out that you're checking if the FPS is greater than 11 inside the if statement that checks if it is less than 10. Here it is fixed.

wait()
local gui=script.Parent
function M8FPS()
	while wait()do
		local fps=workspace:GetRealPhysicsFPS()
		gui.Text=("%.0f"):format(fps)
		if fps<10 then
			gui.TextColor3=Color3.new(1,0,0)
		else
			gui.TextColor3=Color3.new(1,1,0)
		end
	end
end
M8FPS()

13 comments

0

Even with that change, it doesn't work.

0

Update with the new script.

0

The script is designed to go red if it's a value smaller than 10, and yellow if it's a value higher than 10. Both of the colours are correct.

0

Where's the new script?

0

You update your post with your new script.

0

Ok.

0

It's changed.

0

You didn't fix the colors. Color3s take decimal values.

0

updated.

0

still doesnt work, updated

0

format it right.

0

ok ill check now

0

thanks! it works great. i just started scripting yesterday so yeah lol ty

This discussion is preserved as it was. New answers, comments, and votes are closed.