I want a black screen to fade in once the player has died and to fade out once they respawn. I've made a start and it doesn't seem to be appearing.
I have put a ScreenGui in the 'StarterGui' called 'BlackScreen', then a Frame inside the ScreenGui called 'Black' and then a LocalScript inside the Frame with the following:
01 | local black = script.Parent |
02 | local humanoid = game.Players.LocalPlayer:FindFirstChild( 'Humanoid' ) |
03 |
04 | while true do |
05 | if humanoid.Died() then |
06 | for i = 1 , 10 do |
07 | black.BackgroundTransparency = black.BackgroundTransparency - 0.10 |
08 | wait(. 1 ) |
09 | end |
10 | end |
11 | if humanoid = = 100 then |
12 | for i = 1 , 10 do |
13 | black.BackgroundTransparency = black.BackgroundTransparency + 0.10 |
14 | wait(. 1 ) |
15 | end |
16 | end |
17 | wait( 1 ) |
18 | end |
01 | local black = script.Parent |
02 | local humanoid = game.Players.LocalPlayer:FindFirstChild( 'Humanoid' ) |
03 |
04 | humanoid.Died:connect( function () |
05 | for i = 1 , 10 do |
06 | black.BackgroundTransparency = black.BackgroundTransparency - 0.10 |
07 | wait(. 1 ) |
08 | end |
09 | if humanoid.Health = = 100 then |
10 | for i = 1 , 10 do |
11 | black.BackgroundTransparency = black.BackgroundTransparency + 0.10 |
12 | wait(. 1 ) |
13 | end |
14 | end |
15 | end ) |
Here try this