How can i make a "fade" animation for my gui without having to wait for every single frame in it?
How can i make a "fade" animation for my gui without having to wait for every single frame in it?
here's my current code:
03 | local ok = require(gui.MAINMOD) |
04 | ok:FadeOut(gui.loader) |
05 | for _,c in pairs (gui.loader:GetDescendants()) do |
06 | if c.Name~ = "LocalScript" then |
12 | gui.main.Visible = true |
14 | for _,c in pairs (gui.main:GetDescendants()) do |
19 | ArtificialHB = Instance.new( "BindableEvent" , script) |
20 | ArtificialHB.Name = "ArtificialHB" |
22 | script:WaitForChild( "ArtificialHB" ) |
29 | script.ArtificialHB:Fire() |
31 | game:GetService( "RunService" ).Heartbeat:connect( function (s, p) |
34 | if allowframeloss then |
35 | script.ArtificialHB:Fire() |
38 | for i = 1 , math.floor(tf / frame) do |
39 | script.ArtificialHB:Fire() |
46 | tf = tf - frame * math.floor(tf / frame) |
50 | function module:swait(num) |
51 | if num = = 0 or num = = nil then |
52 | ArtificialHB.Event:wait() |
55 | ArtificialHB.Event:wait() |
59 | function module:FadeOut(gui) |
60 | if gui:IsA( "TextLabel" ) or gui:IsA( "TextBox" ) or gui:IsA( "TextButton" ) then |
62 | gui.TextTransparency = gui.TextTransparency + 0.01 |
67 | gui.BackgroundTransparency = gui.BackgroundTransparency + 0.01 |
71 | function module:FadeIn(gui) |
72 | if gui:IsA( "TextLabel" ) or gui:IsA( "TextBox" ) or gui:IsA( "TextButton" ) then |
73 | for i = 1 , 100 do gui.TextTransparency = gui.TextTransparency - 0.01 |
78 | gui.BackgroundTransparency = gui.BackgroundTransparency - 0.01 |
This code will wait for every gui part instead of doing it all together. I would like it to do the fade animation all together but I don't know how.