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:
local black = script.Parent local humanoid = game.Players.LocalPlayer:FindFirstChild('Humanoid') while true do if humanoid.Died() then for i = 1, 10 do black.BackgroundTransparency = black.BackgroundTransparency - 0.10 wait(.1) end end if humanoid == 100 then for i = 1, 10 do black.BackgroundTransparency = black.BackgroundTransparency + 0.10 wait(.1) end end wait(1) end
local black = script.Parent local humanoid = game.Players.LocalPlayer:FindFirstChild('Humanoid') humanoid.Died:connect(function() for i = 1, 10 do black.BackgroundTransparency = black.BackgroundTransparency - 0.10 wait(.1) end if humanoid.Health == 100 then for i = 1, 10 do black.BackgroundTransparency = black.BackgroundTransparency + 0.10 wait(.1) end end end)
Here try this