Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is it possible to make a screen fade to black then stop?

Asked by 8 years ago

I was wondering if it was possible i didn't see it on the wiki's.

3 answers

Log in to vote
0
Answered by
FiredDusk 1466 Moderation Voter
8 years ago

Yes it is possible, by doing that you would need to make a script in a gui and change the transparency in a loop (so that it makes it fade).

Ad
Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
8 years ago
Edited 8 years ago

Yes. This is possible. What you want to do can be accomplished using a ScreenGui and a Frame.



Setup

Make this your hierarchy in the explorer:

StarterGui

ScreenGui

Frame


By placing the ScreenGui in StarterGui, it replicates the ScreenGui to every player when their players are loaded. By placing a Frame inside the ScreenGui, you make a physical 2D object appear.


Now, make the Frame look how you want. Set the BackgroundColor3 property to Black, or Color3.new(0,0,0) through a script. They're the same thing.


Now that it's colored the way you want, make it cover the entire screen. Set the Sizeproperty to {1,0},{1,0}, or UDim2.new(1,0,1,0) through a script.


The last step is to make it invisible. You only want the gui to fade "in" so it must start out as being invisible. Set the Transparency property to 1.



Code

Now that the gui is setup, you have to code the "fade in". This can be done by setting the Transparency property using a simple numerical for loop. Numerical for loops syntax look like this:

for [variable] = [start],[finish],[increment] do

You start at [start], and count to [finish] in steps if [increment], or 0 if none is given.


So, use 1 as your [start], since you want the gui to start out being invisible. Use 0 as your [finish], since you want the gui to end up being visible. And use -.1 as your [increment], since you want it to be a smooth transition.

local gui --Define the gui!!

for i = 1,0,-.1 do
    gui.Frame.Transparency = i
    wait(.1)
end
Log in to vote
0
Answered by 8 years ago

Yes...

Answer this question