Hi. I was asked to make a stamina bar that fades to black in a project. The problem is, I'm not very good with UIs so I'm pretty much a noob you could say. The color starts at a darkish orange and fades to black as it decreases. Here's the code:
local rgb = {bar.BackgroundColor3.r, bar.BackgroundColor3.g, bar.BackgroundColor3.b}
Bla, bla, bla, so on and so forth...
bar.BackgroundColor3 = Color3.fromRGB(bar.BackgroundColor3.r - (rgb[1] / 200), bar.BackgroundColor3.g - (rgb[2] / 200), bar.BackgroundColor3.b - (rgb[3] / 200))
As soon as the character starts sprinting, it immediately snaps to pitch black. What am I doing wrong? It's probably a silly mistake or a noob question but I really am stumped.
Any help is appreciated. Thanks! ~Loughdough :}

3 comments
Please provide all of your code - the problem may be in the loop you use to fade in. I assume a problem could be that you didn't use wait() in your loop?
@TheDeadlyPanther using a 0.01 wait loop. i could just use wait() but meh
It's basically a while true do loop that checks to see if the player is either idle, walking, or sprinting.