UI gets black even if it should be red

So i wanted to do a stamina bar and the color should change to red, when the player is exhausted unless they can sprint again.
The thing is the color turns black and i cant change it regards the RGB options

if exhausted and stamina < MaxStamina then
	barFrame.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Red color
elseif not running and stamina < MaxStamina then
	barFrame.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Red color
else
	barFrame.BackgroundColor3 = Color3.fromRGB(0, 255, 255) -- Default color
end```

![image|386x202](upload://rBebOwvepYhK71q0F1DcerK03A7.jpeg)
1 Like

can you send the image? and where is this code?

1 Like

So the code is a local code in StarterCharacterScripts

The bar down there is the problem

try putting it in starterplayerscripts

I tried that already tho
Is that a bug in studio?

Are you using UIGradient by any chance?

put a print() after you turn red the gui, maybe the code doesn’t run?

Yeah.

Is that the problem???

Is the UIGradient Black?
If it’s fully 0, 0, 0 RGB then the color will stay black no matter the Frame’s Color

While running the game, check the UIGradient’s color.

Quick question, why are you making a new Instance of the UIGradient?
You could just manually do that.

Yup, it seems to be the UIGradient’s problem:

Copied the code you took a screenshot of.

Yeah my friend did script after when i was offline so don’t ask me

It isn’t the codes fault, It’s the hue’s fault.
You could try it without the UIGradient.

yea i already figured it out, thank you for the help!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.