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

Frame doesn't fade out and doesn't change... Why? [SOLVED]

Asked by
Loot_O 42
4 years ago
Edited 4 years ago

Hello! I've wanted to figure out, why my frame doesn't change the background transparency at all. and how to fix it. What I'm trying to do, is make a gui fade out I've tried for i = #, #, # loops, but it doesn't work, here's what I tried...

for i = 0, 1, 0.05 do
        wait()
        Cutscene.Transition.BackgroundTransparency = i
end

Some extra info: Cutscene is defined. Transition.BackgroundTransparency Is on 0.

Edit: Turns out, I made a function with the code above, and connected it to a player added event. Also the code was in a localscript.

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

If transition is a variable it's not going to work. You would be better off getting the gui frame from a variable and then mess with the background transparency. Not only that but you used the wait() command too early, it's supposed to go at the very end of the for loop.

--For this example, pretend there is a local script inside of a frame, and which that frame is inside of a screen gui, which is in the StarterGui service.

local frame = script.Parent -- Finds the frame, which is the parent of this local script'

for i = 0, 1, 0.05 do
    frame.BackgroundTransparency = i
    wait()
end
Ad

Answer this question