I’m making a script where if a value is below a certain point, a red GUI will start to lose transparency.
Simple as this: It won’t work.
I’m only using the Developer Forum to get help right now. If possible, please help!
This is my script:
AirValue = game.Players.LocalPlayer.Character.Water.Air
TransparencyObj = script.Parent.LowOxygenEffect
while true do
if AirValue <= 35 then
TransparencyObj.BackgroundTransparency = AirValue / 35
wait(0)
elseif AirValue >= 35 then
TransparencyObj.BackgroundTransparency = 1
end
end
I’m going to add a limit to how opaque the GUI can get - but right now, I need this to be fixed.
I don’t see how anything is wrong with the script.
You don’t need to put if and elseif condition since the outcome still the same, when the value reaches 35 it became whole invisible and when 0, its opaque.
The things that @Legend_Allen has said are correct. And it might help if you answered his questions. Also, are you getting any error in the output window?