I'm trying to make the background of the gui keep transitioning from being visible to being transparent, this is what I have thought of so far.
01 | BetaPassNeededGui = script.Parent |
02 | Up = false |
03 | BetaPassNeededGui.BackgroundTransparency = 0 |
04 | while true do |
05 | print ( "Script Active" ) |
06 | wait() |
07 | while Up = = true do |
08 | print ( "Mode = " .. Up) |
09 | while BetaPassNeededGui.BackgroundTransparency < = 1 do |
10 | BetaPassNeededGui.BackgroundTransparency = BetaPassNeededGui.BackgroundTransparency + 0.1 |
11 | wait( 0.1 ) |
12 | if BetaPassNeededGui.BackgroundTransparency = = 1 then |
13 | Up = false |
14 | end |
15 | end |
I think that tweening is a much cleaner way to achieve what you want. If you want to change how long it takes for the transparency to change, modify the ChangeTime
variable.
01 | local ChangeTime = 1 -- Time in seconds |
02 |
03 | local twn |
04 | local BGui = script.Parent |
05 | local t = game:GetService( "TweenService" ) |
06 |
07 | BGui.Transparency = 0 |
08 |
09 | while BGui.Visible do |
10 | twn = t:Create(BGui, TweenInfo.new(ChangeTime, Enum.EasingStyle.Linear), { Transparency = 1 } ) twn:Play() |
11 | twn.Completed:Wait() |
12 | twn = t:Create(BGui, TweenInfo.new(ChangeTime, Enum.EasingStyle.Linear), { Transparency = 0 } ) twn:Play() |
13 | twn.Completed:Wait() |
14 | twn = nil |
15 | wait() |
16 | end |
If my answer helped you please make sure to mark it as correct!