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()
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()