Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to change background transparency of a frame with scripts?

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

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.