A sprite sheet seems easier but…
both methods i have tried only result in this (my original method included):
https://gyazo.com/edcdca425d929abee47b0d8dac4b886a
edit: going to sleep, will pick up on this in the morning
RPM.rbxl (22.6 KB)
Can be modified to use percentages like this:
Now at 100 rpm it will make 11% visible, at 500 rpm 25% will be visible and so on…
local RPMZ = {{100,11}, {500,25}, {1000, 50}, {2000, 100}}
while true do
wait()
local BestChoice = {0,0}
for i,v in pairs(RPMZ) do
if math.floor(RPM) >= v[1] and v[1] >= BestChoice[1] then
BestChoice = v
end
end
local Names = {}
for x = 1, math.floor((BestChoice[2]/100)*#rpmBar:GetChildren()) do
table.insert(Names, "R"..x)
end
for c,p in pairs(rpmBar:GetChildren()) do
local IsInTable = false
for i,v in pairs(Names) do
if p.Name == v then
IsInTable = true
end
end
if IsInTable then
p.Visible = true
else
p.Visible = false
end
end
end
Here is a table based on your original post (Not percentages)
local RPMZ = {
{500, 1},
{1000, 2},
{1500, 3},
{2000, 4},
{2500, 5},
{3000, 6},
{3500, 7},
{4000, 8},
{4250, 9},
{4500, 10},
{4750, 11},
{5000, 12},
{5250, 13},
{5500, 14},
{5750, 15},
{6000, 16},
{6250, 17},
{6500, 18},
{6750, 19},
{7000, 20},
{7250, 21},
{7500, 22},
{7750, 23},
{8000, 24},
{8250, 25},
{8500, 26}
}