How do you make the screen fade into white when a specific object is touched?
Asked by
8 years ago Edited 8 years ago
I want the screen to fade into white basically.
03 | if hit.Parent:FindFirstChild( "Humanoid" ) ~ = nil then |
05 | if game.Players:FindFirstChild(hit.Parent.Name) ~ = nil then |
06 | local player = game.Players:FindFirstChild(hit.Parent.Name) |
08 | if player:FindFirstChild( "PlayerGui" ):FindFirstChild( "ScreenGui" ) = = nil then |
09 | sg = Instance.new( "ScreenGui" ) |
10 | sg.Parent = player:FindFirstChild( "PlayerGui" ) |
14 | if player.PlayerGui.ScreenGui:FindFirstChild( "MessageBox" ) = = nil then |
16 | local f = Instance.new( "Frame" ) |
18 | f.Position = UDim 2. new( 0 , 0 , 0 , 0 ) |
19 | f.Size = UDim 2. new( 1 , 0 , 1 , 0 ) |
20 | f.Parent = player.PlayerGui:FindFirstChild( "ScreenGui" ) |
21 | f.BackgroundTransparency = 1 |
22 | f.BackgroundColor 3 = Color 3. fromRGB( 255 , 255 , 255 ) |
24 | if f.Name = = ( "WhiteFrame" ) and f.BackgroundTransparency ~ = 1 then |
27 | f.BackgroundTransparency = f.BackgroundTransparency - 0.1 |
32 | f.BackgroundTransparency = f.BackgroundTransparency + 0.1 |
41 | script.Parent.Touched:connect(onTouch) |