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

How to fade a black frame? [closed]

Asked by 6 years ago

I'm trying to fade a black frame where it starts when you load up the game but then fades out, i tried to do this myself and searched on youtube and etc, but couldn't find anything, so can you guys like explain it or even probably give me a code for it? But i'm mainly would like how to do it.

Closed as Not Constructive by minikitkat

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 6 years ago

You would use a for loop for this. The for loop is a way of running a set of code for a defined number of times.

This is the syntax for for loop

for variable = StartingNum, FinishingNum, Increment do
end 

To need to know materials for this piece

For Loop

BackgroundTransparency

This is an example

-- Declaration Section 
local BlackFrame = script.Parent --Where your frame is 

-- Processing Section 

for number = 1, 0, -0.1 do --Declaring a loop
    BlackFrame.BackgroundTransparency = number --Changing BlackFrame's Transparency and decreasing it by 0.1 each millisecond. 
    wait()
end 

wait(5) --Waiting for 5 seconds before reverting back to original transparency

for number = 0, 1, 0.1 do
    BlackFrame.BackgroundTransparency = number
    wait()
end 

And that is how you do it. Comment below if you still don't understand it

Have a lovely day of coding
Ad