I am trying to make a simple meter.
Heres my needs.
I wanted so it would go up if the value is not less than the last value it previously had(Achieved).
It would not go down after it was less than the last value.
Code:
local P = game.Players.LocalPlayer:WaitForChild('Data')['ServerData']['Rage']
function Get(bool)
repeat
wait()
local V = 1
local lastval = 1
local hasbeenset = false
if script.Parent:FindFirstChild(P.Value) then
for i = V,P.Value do
if script.Parent[11].Visible == true then
for i = 11,V do
script.Parent[i].Visible = false
end
else
if lastval ~= P.Value then
if hasbeenset == false then
for i = V,P.Value do
script.Parent[i].Visible = true
lastval = P.Value
hasbeenset = true
end
elseif hasbeenset == true then
for i = P.Value,1 do
print(i)
end
end
else
for i = V,P.Value do
script.Parent[i].Visible = true
lastval = P.Value
hasbeenset = true
end
end
end
end
end
until bool == true
end
P.Changed:connect(function()
if script.Parent:FindFirstChild(P.Value) then
local B = Get(false)
if B == true then
Get(true)
else
Get(true)
end
end
end)
The issue is it is not going down if the numbervalue was less than the last value it had.
I don’t want it so it skips a bar.
I want it to be smooth.

There are 11 in total.
Let’s give a simple scenario.
Let’s say the last value was 6.
And the new value for the number value was 4.
It would not go down for some reason.
I have tried to restart my code, but this version of it is better, it just needs to go down whenever the number value is less than the last value.