Hi!
My frist post here in a while lol
So, I decided to make my FPS Counter RGB (The FPS/100), because it would look cool.
But, I don’t use math very much in my code, os I aleays have errors with it when I need it.
I know my RGB Script works, but the math doesn’t.
task.wait(5)
local attrib = script.Parent:GetAttribute("FPS")
local Speed = attrib/100
while true do
Speed = attrib/100
for Transition = 0, 1, 0.001 * Speed do
script.Parent.TextColor3 = Color3.fromHSV(Transition, 1, 1)
task.wait()
end
end
It isn’t, I added the task.wait at the stat to give it time to load. Here’s the FPS script.
local FPS = 0
local Tiempo = tick()
local att = script.Parent.Parent.PC.FPS:GetAttribute("FPS")
spawn(function()
while game:GetService("RunService").RenderStepped:wait() do
local Transcurrido = math.abs(Tiempo-tick())
Tiempo = tick()
FPS = math.floor(1/Transcurrido)
script.Parent.Parent.PC.FPS:SetAttribute("FPS",FPS)
end
end)
game:GetService("RunService").Stepped:Connect(function()
script.Parent.Text = tostring(FPS) .. " fps"
end)
task.wait(5)
local attrib = script.Parent:GetAttribute("FPS")
local Speed = attrib/100
while true do
print(attrib)
print(Speed)
Speed = attrib/100
for Transition = 0, 1, 0.001 * Speed do
script.Parent.TextColor3 = Color3.fromHSV(Transition, 1, 1)
task.wait()
end
end
Yes, how would I do the division? I dont see the print when I changed attrib to outside the loop. I’m creating the attribute right now bc idk if the script is creating it.
task.wait(5)
local attrib = script.Parent:GetAttribute("FPS")
local Speed = tonumber(attrib)/100
local PrintDebugInfo = true --/////not reccomended, floods the console
print(attrib)
while true do
Speed = tonumber(attrib)/100
task.wait()
for Transition = 0, 1, 0.001 * Speed do
script.Parent.TextColor3 = Color3.fromHSV(Transition, 1, 1)
if PrintDebugInfo then print(attrib) end
task.wait()
end
end