Simple fade from and to black

I could post my tries at this but none work.

Looking to do 3 things …
#1. On starting and re-spawn the screen comes in black.
#2. Screen fades out the black after each spawn.
#3. On death screen fades to black.

Seems easy right? It’s not turning out that way …
The screen is to remain black after death and load until the fade black out.
This is a bit of a hit or miss when the program is published.

This don’t work … but it should.
FadeGUI.rbxm (6.7 KB)

2 Likes

maybe you sould try disabling ResetOnSpawn property from the BlackScreenGUI see if that solves it. Otherwise send your code attempts so I can see whats going on

1 Like

Here is a fixed solution to your problems. Below I have inserted the physical place that you can download or if you want you can also just download the physical model. Feel free to study the code and learn from the mistakes that were made :slight_smile:

There are many ways of going about this but this is what I am proposing to you.

GUI:
GUI_FIXED_MODEL.rbxm (4.3 KB)

PLACE:
GUI_FIXED_PLACE.rbxl (56.5 KB)

VIDEO:

The problem was that you were making it more complicated than it needed to be. The gui can be accessed by itself due to it being cloned into the playerGui already so there is no need to access the player and then try to get into the gui. I made changes accordingly so I hope this helps you out. :smiley:

3 Likes

This doesn’t completely work …
Here is a totally stripped down version and this one doesn’t completely work.
fade.rbxm (3.7 KB)

As fast as possible
drp = script.Parent.drop
function Drop(mode)
	if mode then drp.BackgroundTransparency = 0
		
		repeat task.wait(0.02)
			drp.BackgroundTransparency += 0.1
		until(drp.BackgroundTransparency >=1)
		drp.BackgroundTransparency = 1
		
	else drp.BackgroundTransparency = 1
		
		repeat task.wait(0.02)
			drp.BackgroundTransparency -= 0.1
		until(drp.BackgroundTransparency <=0)
		drp.BackgroundTransparency = 0
		
	end
end task.wait(1)
Drop(true)

plr = game.Players.LocalPlayer
chr = plr.Character or plr.CharacterAdded:Wait()
chr:WaitForChild("Humanoid").Died:Connect(function()
	Drop(false)		
end)

The real problem here is Roblox doesn’t come up with a black screen by default (or have an option for that). When you get a game load that takes more than 3 seconds. You’re not connected fast enough to Roblox to have any GUI show before the you get the default not black screen load …

This all looks good in the studio but is not consistent when published.

1 Like

An alternative method you can use to set the background visible at first instance is that you can just set the background to visible = true manually in the properties so that way when the game starts, it is already visible as shown in the place example.

1 Like

Not sure you understand what I’m looking to do here …

This should come up black. It is visible and set to black. That is still not fast enough to consistently load up as a black screen. It takes too long to even set up the GUI, even if there was no code at all …

1 Like

Perhaps looking into this then?

1 Like

Yes this works, but only for the 1st load. Respawns will get that screen flash.

1 Like

If Roblox is running slow or your connect is slow at all … There is no possible way to get a black screen load up via GUI. What I need here apparently is an option to load to a black screen added to the studio.

1 Like

You Could Try Placing A LocalScript Into StarterPlayerScripts

local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local TweenService = game:GetService(“TweenService”)
local Players = game:GetService(“Players”)

Players.PlayerAdded:Connect(function(Player)

local PlayerGui = Player.PlayerGui
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character.Humanoid
local Frame = Instance.new(“Frame”)

Frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
Frame.BackgroundTransparency = 0

TweenService:Create(Frame, TweenInfo.new(.5, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {BackgroundTransparency = 1}):Play()

Humanoid.Died:Connect(function()

Frame.BackgroundTransparency = 1

TweenService:Create(Frame, TweenInfo.new(.5, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {BackgroundTransparency = 0}):Play()

task.wait(.5)

Frame.Parent = ReplicatedStorage

task.wait(Players.RespawnTime)

Frame.Parent = PlayerGui

print(“Worked?”)

end)

end)

I wrote this on a mobile device, so forgive me for any typos, hope this helps!

1 Like

The problem isn’t with the GUI. The problem is with lag. You can not consistently get a set to black GUI to load up fast enough to stop a “screen flash” on respawns. Even if that GUI has no script to it at all. This may work 10 times, but on the slower load … it will flash.

With my GUI set up as black by default and running the code “As fast as possible” from my reply a few back. When published if the game loadup takes more than 3 seconds. My respawns will screen flash.
:frowning:

1 Like

I’d assume the “screen flash” is occurring due to StarterGui not being fast enough replicate the fade into PlayerGui, but thats just a theory (pun not intended)

1 Like

Not fast enough to even come up black … before you even get to fading anything.
It will once loaded but there is a moment of not black. aka “screen flash”

1 Like

Maybe you could use “RunService.PreRender” (PreRender is the new RenderStepped) to check if the player has died and load the fade that way

1 Like

Interesting. However, the problem is on the re-spawns … not the deaths. Can you elaborate if I’m misunderstanding you.

1 Like

Respawning causes issues like yours for some reason, my module im working on had a issue with respawning and caused the UI to never even load on respawn, i somehow fixed the issue though, i’ll check the code when i use my laptop to see how i fixed it and maybe it could help you.

1 Like

That sounds more like ResetOnSpawn was not checked.

1 Like

ResetOnSpawn Dosen’t work when parented into PlayerGui instead of being replicated into it via StarterGui, the code i used was similar to the code i provided above, but it did not work for some reason.

1 Like

This is an odd error as it doesn’t happen all the time. It’s when you get a slower connect to Roblox. That time it took 4-5 seconds to load up. On respawns it is just a fraction of a second too slow to set up that black GUI without a “screen flash”. When published this happens not in Studio.

1 Like

Maybe try making the fade wait a couple seconds to load and see if theres a difference.

1 Like