Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to change background transparency of a frame with scripts?

Asked by 4 years ago

I am trying to make a fading blindness effect what i have currently is shown here:

-- 1 = invis 0 = vis
inviswall = workspace.Hall.InvisWall
blindness = game.StarterGui.ScreenGui.Blindness
function ShowWall()
    print("touched")
    inviswall.Transparency = 0
    print("made visible")
    wait(5)
    blindness.BackgroundTransparency = 0
    wait(5)
    print("started the unblinding")
    wait(0.1)
    blindness.BackgroundTransparency = 0.1
    wait(0.1) 
    blindness.BackgroundTransparency = 0.2
    wait(0.1)
    blindness.BackgroundTransparency = 0.3
    wait(0.1)
    blindness.BackgroundTransparency = 0.4
    wait(0.1)
    blindness.BackgroundTransparency = 0.5
    wait(0.1)
    blindness.BackgroundTransparency = 0.6
    wait(0.1)
    blindness.BackgroundTransparency = 0.7
    wait(0.1)
    blindness.BackgroundTransparency = 0.8
    wait(0.1) 
    blindness.BackgroundTransparency = 0.9
    wait(0.1)
    blindness.BackgroundTransparency = 1

end

workspace.Hall.InvisTouch.Touched:Connect(ShowWall)

1 answer

Log in to vote
0
Answered by
SirGamezy 186
4 years ago
Edited 4 years ago

For one thing, you can shorten it out:

inviswall = workspace.Hall.InvisWall
blindness = game.StarterGui.ScreenGui.Blindness

function ShowWall()
    print("Touched")
    inviswallTransparency = 0
    print("Wall visible.")
    wait(5)
    blindness.BackgroundTransparency = 0
    wait(5)
    print("Unblinding.")
    for i = 0, 1, 0.1 do
        blindness.BackgroundTransparency = i
    end
end)

workspace.Hall.InvisTouch.Touched:Connect(ShowWall)
Ad

Answer this question