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

Is there a way to make a frame fade in then out?

Asked by 4 years ago

Sorry I know this is kinda a rookie question but I have been working on this game for a while now and I need to know if there is a way to make a frame fade in then out. If you know please let me know. Thanks.

1 answer

Log in to vote
0
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

Yes, you’ve seen it occurring before. It is the act of using a for loop to iterate over the Transparency property of a Frame. Keep in mind, Transparency is a double that ranges from 0-1, therefore, we must ensure our loop iterates respectfully within said range. Using a float number, and these principals, we can increment and decrement the Transparency values to give the effect of "fading".

--// Basic application of theory
local Player = game:GetService("Players").LocalPlayer

local PlayerGui = Player:WaitForChild("PlayerGui")
local ScreenGui = PlayerGui:WaitForChild("ScreenGui")
local Frame = ScreenGui:WaitForChild("Frame")

for t = 0,1,.1 do wait(.1)
    Frame.BackgroundTransparency = t
end
for t = 1,0,-.1 do wait(.1)
    Frame.BackgroundTransparency = t
end
0
Thank you! Algometry 6 — 4y
Ad

Answer this question