Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Problem with my FPS gui?

Asked by 8 years ago

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

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
8 years ago

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()
0
Even with that change, it doesn't work. User#9487 0 — 8y
0
Update with the new script. 1waffle1 2908 — 8y
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. User#9487 0 — 8y
0
Where's the new script? User#9487 0 — 8y
View all comments (9 more)
0
You update your post with your new script. 1waffle1 2908 — 8y
0
Ok. User#9487 0 — 8y
0
It's changed. User#9487 0 — 8y
0
You didn't fix the colors. Color3s take decimal values. 1waffle1 2908 — 8y
0
updated. 1waffle1 2908 — 8y
0
still doesnt work, updated User#9487 0 — 8y
0
format it right. 1waffle1 2908 — 8y
0
ok ill check now User#9487 0 — 8y
0
thanks! it works great. i just started scripting yesterday so yeah lol ty User#9487 0 — 8y
Ad

Answer this question