How do I fade screen to black?

local ReplicatedFirst = game:GetService("ReplicatedFirst")

local player = Players.LocalPlayer 
local playerGui = player:WaitForChild("PlayerGui")

local screenGui = Instance.new("ScreenGui")
screenGui.IgnoreGuiInset = true
screenGui.Parent = playerGui
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.BackgroundColor3 = Color3.fromRGB(16, 16, 16)
textLabel.Font = Enum.Font.Merriweather
textLabel.TextColor3 = Color3.new(0.819608, 0.819608, 0.819608)
textLabel.Text = ""
textLabel.TextSize = 40
textLabel.Parent = screenGui

-- Remove the default loading screen
ReplicatedFirst:RemoveDefaultLoadingScreen()

wait(5)  -- Force screen to appear for a minimum number of seconds
if not game:IsLoaded() then
	game.Loaded:Wait()
end

if game:IsLoaded() then
	textLabel.Text = "Extraction Point"
	wait(2)
	screenGui:Destroy()
end```

Does someone know how to fade the screen to transperancy 1 instead of just disappearing immediatley?

Hi, you could use a gui object that covers the screen and its black. You could then tween the transparency of this. To fix the topbar problem, you could make a property of it called IgnoreGuiInset and set that to true.

1 Like

If you are asking how to make the actual way to make it go invisible slowly, instead of tweening you could use a for loop.

So
Frame:TweenTransperancy
isn’t a function?

What do you mean, that is a function? You have spelt it wrong

https://i.gyazo.com/358626d6a77f5aa85fbeacc19abd9ba9.png

You have spelt the function wrong

To tween properties other than Position and Size you would want to use TweenService.

Class Page:
https://developer.roblox.com/en-us/api-reference/class/TweenService

Example:

local TweenService = game:GetService("TweenService")
local tween = TweenService:Create(textLabel, TweenInfo.new(5), {BackgroundTransparency = 1})
tween:Play()
1 Like

What is the correct way to spell the function?

:TweenTransparency
(char limit)

:TweenTransparency() is not a valid function. Please do not try and spread misinformation.

@rustyhuskey’s solution is valid, please follow that instead. You can only tween size and position as a method of an instance on GuiObject‘s only.

2 Likes

Oh sorry I didn’t check if it was valid. My mistake!

Thanks. I used rusty’s advice and I made something like this:

BlackScreenFade.BackgroundColor = BrickColor.Black()
local Transperancy = {}
BlackScreenFade.Transparency = 1
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear)

if game:IsLoaded() then
	textLabel.Text = "Extraction Point"
	wait(2)
	BlackScreenFade.Size = UDim2.new(1, 0, 1, 0)
	local tween = TweenService:Create(BlackScreenFade, tweenInfo, Transperancy)
end

It doesn’t give me any errors, but it doesn’t work

Tweens created using TweenService must be played using :Play() from the created tween here

local tween = TweenService:Create(BlackScreenFade, tweenInfo, Transperancy)

i.e tween:Play()

Odd, i added tween:Play and it still doesn’t seem to work

oh, Transparency isn’t a property of the TextLabel
They have TextTransparency and BackgroundTransparency

Assuming you’ll want to fade the background, you would use the one containing the keyword “background”.

local Players = game:GetService("Players")
local ReplicatedFirst = game:GetService("ReplicatedFirst")

local player = Players.LocalPlayer 
local playerGui = player:WaitForChild("PlayerGui")

local screenGui = Instance.new("ScreenGui")
screenGui.IgnoreGuiInset = true
screenGui.Parent = playerGui
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.BackgroundColor3 = Color3.fromRGB(16, 16, 16)
textLabel.Font = Enum.Font.Merriweather
textLabel.TextColor3 = Color3.new(0.819608, 0.819608, 0.819608)
textLabel.Text = ""
textLabel.TextSize = 40
textLabel.Parent = screenGui
local TextTurnOnSound = game.SoundService["Lights Turning On"]

-- Remove the default loading screen
ReplicatedFirst:RemoveDefaultLoadingScreen()

wait(5)  -- Force screen to appear for a minimum number of seconds
if not game:IsLoaded() then
	game.Loaded:Wait()
end
local BlackScreenFade = Instance.new("Frame")
BlackScreenFade.BackgroundColor = BrickColor.Black()
local Transperancy = {}
BlackScreenFade.Transparency = 1
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear)
local tween = TweenService:Create(BlackScreenFade, tweenInfo, Transperancy)
BlackScreenFade.Size = UDim2.new(1, 0, 1, 0)

if game:IsLoaded() then
	textLabel.Text = "Extraction Point"
	if TextTurnOnSound.Playing then
		TextTurnOnSound.Playing = false
	else
		TextTurnOnSound.Playing = true
	end
	wait(2)
	tween:Play()
end

Here is my full script

K first line, I’m guessing that’s a Frame. It’s BackgroundColor3
Then you spelt transparency wrong
Then it’s BackgroundTransparency, not Transparency on line 3
Then for the third argument in the :Create, you are setting it to an empty table. You need to set it to this {BackgroundTransparency = 0}

BlackScreenFade.BackgroundColor = BrickColor.Black()
BackgroundColor3 can’t be set to BrickColor.Black()

Are you not getting any errors? This should be erroring all over the place. Open your output window and take a screenshot of what you see