Roblox GUI Maker logoRoblox GUI Maker
Unofficial third-party tool · Not affiliated with Roblox Corporation

Loading Screen Roblox GUI Template with Progress Bar & Tips

A loading screen with progress bar, rotating gameplay tips, and fade-out once loading is complete. This template provides a polished, professional loading experience that keeps players engaged while assets load. Features a smooth animated progress bar, helpful rotating gameplay tips to educate players, and an elegant fade-out transition when loading completes.

Loading ScreenFree
Loading Screen Roblox GUI template — Progress Bar & Tips, clean loading screen layout, screenshot 1
Loading Screen Roblox GUI template — screenshot 1 of 1, showing progress bar & tips on a clean loading screen layout for desktop.
Open in Web EditorJoin Studio plugin waitlist

Live preview

Loading Screen

1920×1080
Zoom100%
Desktop (FHD)
ScreenGui
Frame
Loading...
Frame
Frame
65%
Tip: Collect coins to unlock pets!
A loading screen with progress bar, rotating gameplay tips, and fade-out once loading is complete. This template provides a polished, professional loading experience that keeps players engaged while assets load. Features a smooth animated progress bar, helpful rotating gameplay tips to educate players, and an elegant fade-out transition when loading completes.

Includes real, production-ready Luau logic — not a static mockup.

What's inside

How to use this template

The Loading Screen template shows a progress bar and rotating gameplay tips while the game loads. Paste the client Luau into StarterGui and the loading screen appears on join, fading out when loading completes. The progress bar fills based on ContentProvider:PreloadAsync, so it reflects real asset loading. The tips rotate every 4 seconds using a simple loop. The layout uses Scale-based sizing with a full-screen Frame, so it covers any device. To customize, replace the placeholder tips with your own gameplay hints. The fade-out uses TweenService on the Frame's Transparency. To wire it to your game, call the loading screen's hide function when your game is ready. Test in Studio by preloading a few large assets and confirming the progress bar fills.

Add it to your game in 3 steps

  1. 1

    Copy the Luau

    Open the template in the web editor and click Export. Choose LocalScript to copy the full client Luau to your clipboard.

  2. 2

    Paste into StarterGui

    In Roblox Studio, right-click StarterGui in the Explorer, insert a LocalScript, and paste the copied Luau. Rename it to match the template.

  3. 3

    Press Play to verify

    Click Play in Studio. The GUI should appear exactly as designed. Tweak any Size or Position values in the script if you want to adjust the layout.

loading-screen.lua
lua
1--[[
2 Loading Screen - Client Side
3 A loading screen with progress bar, rotating tips, and fade-out
4 Features: Animated progress, gameplay tips, smooth transitions, asset tracking
5]]
6
7-- Services
8local Players = game:GetService("Players")
9local TweenService = game:GetService("TweenService")
10local ReplicatedStorage = game:GetService("ReplicatedStorage")
11local ContentProvider = game:GetService("ContentProvider")
12local RunService = game:GetService("RunService")
13local Lighting = game:GetService("Lighting")
14
15local player = Players.LocalPlayer
16local playerGui = player:WaitForChild("PlayerGui")
17
18-- Constants
19local PROGRESS_DURATION = 8 -- Minimum seconds to show loading screen
20local TIP_ROTATION_INTERVAL = 4 -- Seconds between tips
21local FADE_OUT_DURATION = 1.5 -- Fade out animation time
22local PROGRESS_BAR_WIDTH = 400
23local PROGRESS_BAR_HEIGHT = 12
24
25-- Colors
26local COLOR_BG = Color3.fromRGB(15, 15, 25)
27local COLOR_BG_GRADIENT_TOP = Color3.fromRGB(20, 20, 40)
28local COLOR_BG_GRADIENT_BOTTOM = Color3.fromRGB(10, 10, 20)
29local COLOR_ACCENT = Color3.fromRGB(100, 180, 255)
30local COLOR_ACCENT_GLOW = Color3.fromRGB(80, 140, 220)
31local COLOR_TEXT_PRIMARY = Color3.fromRGB(255, 255, 255)
32local COLOR_TEXT_SECONDARY = Color3.fromRGB(150, 160, 180)
33local COLOR_TEXT_MUTED = Color3.fromRGB(80, 90, 110)
34local COLOR_PROGRESS_BG = Color3.fromRGB(35, 38, 50)
35local COLOR_PROGRESS_FILL = Color3.fromRGB(100, 180, 255)
36local COLOR_TIP_HIGHLIGHT = Color3.fromRGB(255, 200, 80)
37
38-- Tween presets
39local tweenInfoStandard = TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
40local tweenInfoSmooth = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
41local tweenInfoFadeOut = TweenInfo.new(FADE_OUT_DURATION, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
42local tweenInfoTipFade = TweenInfo.new(0.4, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
43
44-- Gameplay Tips (rotate through these)
45local GAMEPLAY_TIPS = {
46 "Press 'E' to interact with objects around the world.",
47 "Use the map (M key) to fast-travel to discovered locations.",
48 "Complete daily quests for bonus rewards and XP.",
49 "Team up with friends for harder challenges and better loot.",
50 "Upgrade your equipment at the blacksmith regularly.",
51 "Explore hidden areas to find rare collectibles.",
52 "Join a guild to access exclusive events and rewards.",
53 "Use potions wisely - they have a cooldown between uses.",
54 "Check the leaderboard to see how you rank globally.",
55 "Customize your character at the wardrobe station.",
56 "Trade with other players at the marketplace.",
57 "Save your game progress frequently at save points.",
58}
59
60-- GUI References
61local loadingGui, progressBarFill, progressText, progressStatus
62local tipText, tipDots = {}, {}
63local fadeOutOverlay, assetsLoadedLabel, timeElapsedLabel
64local backgroundGradient
65
66-- State
67local isLoadingComplete = false
68local currentTipIndex = 1
69local loadingStartTime = 0
70local assetsToLoad = {}
71local assetsLoaded = 0
72
73-----------------------------------------------------------
74-- Helper Functions
75-----------------------------------------------------------
76
77local function Create(className, props)
78 local instance = Instance.new(className)
79 for key, value in pairs(props or {}) do
80 instance[key] = value
81 end
82 return instance
83end
84
85local function Tween(instance, properties, tweenInfoOverride)
86 local info = tweenInfoOverride or tweenInfoStandard
87 local tween = TweenService:Create(instance, info, properties)
88 tween:Play()
89 return tween
90end
91
92-----------------------------------------------------------
93-- UI Construction
94-----------------------------------------------------------
95
96local function BuildUI()
97 -- ScreenGui
98 loadingGui = Create("ScreenGui", {
99 Name = "LoadingScreenGui",
100 ResetOnSpawn = false,
101 ZIndexBehavior = Enum.ZIndexBehavior.Sibling,
102 DisplayOrder = 999, -- On top of everything
103 Parent = playerGui,
104 })
105
106 -- Background Frame
107 local bgFrame = Create("Frame", {
108 Name = "BackgroundFrame",
109 Size = UDim2.new(1, 0, 1, 0),
110 BackgroundColor3 = COLOR_BG,
111 BorderSizePixel = 0,
112 ZIndex = 1000,
113 Parent = loadingGui,
114 })
115
116 backgroundGradient = Create("UIGradient", {
117 Color = ColorSequence.new({
118 ColorSequenceKeypoint.new(0, COLOR_BG_GRADIENT_TOP),
119 ColorSequenceKeypoint.new(0.5, Color3.fromRGB(15, 15, 30)),
120 ColorSequenceKeypoint.new(1, COLOR_BG_GRADIENT_BOTTOM),
121 }),
122 Rotation = 0,
123 Parent = bgFrame,
124 })
125
126 -- Subtle background pattern
127 Create("ImageLabel", {
128 Name = "BackgroundPattern",
129 Size = UDim2.new(1, 0, 1, 0),
130 BackgroundTransparency = 1,
131 Image = "rbxassetid://6071575925", -- Dot grid pattern
132 ImageColor3 = Color3.fromRGB(255, 255, 255),
133 ImageTransparency = 0.95,
134 ScaleType = Enum.ScaleType.Tile,
135 TileSize = UDim2.new(0, 30, 0, 30),
136 ZIndex = 1001,
137 Parent = bgFrame,
138 })
139
140 -- Logo Container
141 local logoContainer = Create("Frame", {
142 Name = "LogoContainer",
143 Size = UDim2.new(0, 300, 0, 120),
144 Position = UDim2.new(0.5, -150, 0.35, -60),
145 AnchorPoint = Vector2.new(0.5, 0.5),
146 BackgroundTransparency = 1,
147 ZIndex = 1002,
148 Parent = loadingGui,
149 })
150
151 -- Game Logo (placeholder - replace with your game logo)
152 Create("ImageLabel", {
153 Name = "GameLogo",
154 Size = UDim2.new(0, 80, 0, 80),
155 Position = UDim2.new(0.5, -40, 0, 0),
156 BackgroundTransparency = 1,
157 Image = "rbxassetid://7072706316", -- Placeholder star icon
158 ImageColor3 = COLOR_ACCENT,
159 ZIndex = 1003,
160 Parent = logoContainer,
161 })
162
163 -- Game Title
164 Create("TextLabel", {
165 Name = "GameTitle",
166 Size = UDim2.new(1, 0, 0, 36),
167 Position = UDim2.new(0, 0, 0, 84),
168 BackgroundTransparency = 1,
169 Text = "YOUR GAME TITLE",
170 TextColor3 = COLOR_TEXT_PRIMARY,
171 TextSize = 28,
172 Font = Enum.Font.GothamBlack,
173 TextXAlignment = Enum.TextXAlignment.Center,
174 ZIndex = 1003,
175 Parent = logoContainer,
176 })
177
178 -- Subtitle
179 Create("TextLabel", {
180 Name = "GameSubtitle",
181 Size = UDim2.new(1, 0, 0, 20),
182 Position = UDim2.new(0, 0, 0, 120),
183 BackgroundTransparency = 1,
184 Text = "Loading your adventure...",
185 TextColor3 = COLOR_TEXT_SECONDARY,
186 TextSize = 14,
187 Font = Enum.Font.Gotham,
188 TextXAlignment = Enum.TextXAlignment.Center,
189 ZIndex = 1003,
190 Parent = logoContainer,
191 })
192
193 -- Progress Section
194 local progressSection = Create("Frame", {
195 Name = "ProgressSection",
196 Size = UDim2.new(0, PROGRESS_BAR_WIDTH, 0, 80),
197 Position = UDim2.new(0.5, -PROGRESS_BAR_WIDTH/2, 0.55, 0),
198 AnchorPoint = Vector2.new(0.5, 0),
199 BackgroundTransparency = 1,
200 ZIndex = 1002,
201 Parent = loadingGui,
202 })
203
204 -- Progress Bar Background
205 local progressBarBg = Create("Frame", {
206 Name = "ProgressBarBackground",
207 Size = UDim2.new(1, 0, 0, PROGRESS_BAR_HEIGHT),
208 Position = UDim2.new(0, 0, 0, 0),
209 BackgroundColor3 = COLOR_PROGRESS_BG,
210 BorderSizePixel = 0,
211 ZIndex = 1003,
212 Parent = progressSection,
213 })
214
215 Create("UICorner", {
216 CornerRadius = UDim.new(0, PROGRESS_BAR_HEIGHT/2),
217 Parent = progressBarBg,
218 })
219
220 -- Progress Bar Fill
221 progressBarFill = Create("Frame", {
222 Name = "ProgressBarFill",
223 Size = UDim2.new(0, 0, 1, 0),
224 BackgroundColor3 = COLOR_PROGRESS_FILL,
225 BorderSizePixel = 0,
226 ZIndex = 1004,
227 Parent = progressBarBg,
228 })
229
230 Create("UICorner", {
231 CornerRadius = UDim.new(0, PROGRESS_BAR_HEIGHT/2),
232 Parent = progressBarFill,
233 })
234
235 -- Gradient on fill
236 Create("UIGradient", {
237 Color = ColorSequence.new({
238 ColorSequenceKeypoint.new(0, Color3.fromRGB(150, 210, 255)),
239 ColorSequenceKeypoint.new(1, COLOR_PROGRESS_FILL),
240 }),
241 Rotation = 0,
242 Parent = progressBarFill,
243 })
244
245 -- Moving shine effect on progress bar
246 local progressShine = Create("Frame", {
247 Name = "ProgressBarShine",
248 Size = UDim2.new(0, 60, 1, 0),
249 Position = UDim2.new(0, -60, 0, 0),
250 BackgroundColor3 = Color3.fromRGB(255, 255, 255),
251 BackgroundTransparency = 0.7,
252 BorderSizePixel = 0,
253 ZIndex = 1005,
254 Parent = progressBarFill,
255 })
256
257 Create("UIGradient", {
258 Color = ColorSequence.new({
259 ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 255, 255)),
260 ColorSequenceKeypoint.new(0.5, Color3.fromRGB(255, 255, 255)),
261 ColorSequenceKeypoint.new(1, Color3.fromRGB(255, 255, 255)),
262 }),
263 Transparency = NumberSequence.new({
264 NumberSequenceKeypoint.new(0, 1),
265 NumberSequenceKeypoint.new(0.5, 0),
266 NumberSequenceKeypoint.new(1, 1),
267 }),
268 Parent = progressShine,
269 })
270
271 -- Glow around progress bar
272 Create("UIStroke", {
273 Color = COLOR_ACCENT_GLOW,
274 Thickness = 1,
275 Transparency = 0.6,
276 Parent = progressBarBg,
277 })
278
279 -- Progress Text (percentage)
280 progressText = Create("TextLabel", {
281 Name = "ProgressText",
282 Size = UDim2.new(0, 80, 0, 24),
283 Position = UDim2.new(0, 0, 0, PROGRESS_BAR_HEIGHT + 8),
284 BackgroundTransparency = 1,
285 Text = "0%",
286 TextColor3 = COLOR_ACCENT,
287 TextSize = 16,
288 Font = Enum.Font.GothamBold,
289 TextXAlignment = Enum.TextXAlignment.Left,
290 ZIndex = 1003,
291 Parent = progressSection,
292 })
293
294 -- Progress Status
295 progressStatus = Create("TextLabel", {
296 Name = "ProgressStatus",
297 Size = UDim2.new(1, -90, 0, 24),
298 Position = UDim2.new(0, 90, 0, PROGRESS_BAR_HEIGHT + 8),
299 BackgroundTransparency = 1,
300 Text = "Initializing...",
301 TextColor3 = COLOR_TEXT_SECONDARY,
302 TextSize = 13,
303 Font = Enum.Font.Gotham,
304 TextXAlignment = Enum.TextXAlignment.Right,
305 TextTruncate = Enum.TextTruncate.AtEnd,
306 ZIndex = 1003,
307 Parent = progressSection,
308 })
309
310 -- Tips Section
311 local tipsSection = Create("Frame", {
312 Name = "TipsSection",
313 Size = UDim2.new(0, 500, 0, 80),
314 Position = UDim2.new(0.5, -250, 0.7, 0),
315 AnchorPoint = Vector2.new(0.5, 0),
316 BackgroundTransparency = 1,
317 ZIndex = 1002,
318 Parent = loadingGui,
319 })
320
321 -- Tip Icon
322 Create("TextLabel", {
323 Name = "TipIcon",
324 Size = UDim2.new(0, 30, 0, 30),
325 Position = UDim2.new(0, 0, 0, 0),
326 BackgroundTransparency = 1,
327 Text = "i",
328 TextColor3 = COLOR_TIP_HIGHLIGHT,
329 TextSize = 20,
330 Font = Enum.Font.GothamBold,
331 TextXAlignment = Enum.TextXAlignment.Center,
332 ZIndex = 1003,
333 Parent = tipsSection,
334 })
335
336 -- Tip Label
337 Create("TextLabel", {
338 Name = "TipLabel",
339 Size = UDim2.new(0, 80, 0, 20),
340 Position = UDim2.new(0, 30, 0, 5),
341 BackgroundTransparency = 1,
342 Text = "DID YOU KNOW?",
343 TextColor3 = COLOR_TIP_HIGHLIGHT,
344 TextSize = 11,
345 Font = Enum.Font.GothamBold,
346 TextXAlignment = Enum.TextXAlignment.Left,
347 ZIndex = 1003,
348 Parent = tipsSection,
349 })
350
351 -- Tip Text
352 tipText = Create("TextLabel", {
353 Name = "TipText",
354 Size = UDim2.new(1, -30, 0, 40),
355 Position = UDim2.new(0, 30, 0, 24),
356 BackgroundTransparency = 1,
357 Text = GAMEPLAY_TIPS[1],
358 TextColor3 = COLOR_TEXT_SECONDARY,
359 TextSize = 14,
360 Font = Enum.Font.Gotham,
361 TextXAlignment = Enum.TextXAlignment.Left,
362 TextWrapped = true,
363 ZIndex = 1003,
364 Parent = tipsSection,
365 })
366
367 -- Tip Indicator Dots
368 local dotContainer = Create("Frame", {
369 Name = "TipIndicatorContainer",
370 Size = UDim2.new(1, 0, 0, 12),
371 Position = UDim2.new(0, 0, 0, 68),
372 BackgroundTransparency = 1,
373 ZIndex = 1003,
374 Parent = tipsSection,
375 })
376
377 for i = 1, math.min(#GAMEPLAY_TIPS, 8) do
378 local dot = Create("Frame", {
379 Name = "TipDot_" .. i,
380 Size = UDim2.new(0, 8, 0, 8),
381 Position = UDim2.new(0.5, (i - 4.5) * 16 - 4, 0.5, -4),
382 BackgroundColor3 = (i == 1) and COLOR_ACCENT or COLOR_TEXT_MUTED,
383 BackgroundTransparency = (i == 1) and 0 or 0.5,
384 BorderSizePixel = 0,
385 ZIndex = 1004,
386 Parent = dotContainer,
387 })
388 Create("UICorner", {
389 CornerRadius = UDim.new(1, 0),
390 Parent = dot,
391 })
392 tipDots[i] = dot
393 end
394
395 -- Stats Section
396 local statsSection = Create("Frame", {
397 Name = "StatsSection",
398 Size = UDim2.new(0, 400, 0, 30),
399 Position = UDim2.new(0.5, -200, 0.88, 0),
400 AnchorPoint = Vector2.new(0.5, 0),
401 BackgroundTransparency = 1,
402 ZIndex = 1002,
403 Parent = loadingGui,
404 })
405
406 assetsLoadedLabel = Create("TextLabel", {
407 Name = "AssetsLoadedLabel",
408 Size = UDim2.new(0.5, 0, 1, 0),
409 Position = UDim2.new(0, 0, 0, 0),
410 BackgroundTransparency = 1,
411 Text = "Assets: 0/0",
412 TextColor3 = COLOR_TEXT_MUTED,
413 TextSize = 11,
414 Font = Enum.Font.Gotham,
415 TextXAlignment = Enum.TextXAlignment.Left,
416 ZIndex = 1003,
417 Parent = statsSection,
418 })
419
420 timeElapsedLabel = Create("TextLabel", {
421 Name = "TimeElapsedLabel",
422 Size = UDim2.new(0.5, 0, 1, 0),
423 Position = UDim2.new(0.5, 0, 0, 0),
424 BackgroundTransparency = 1,
425 Text = "Time: 0.0s",
426 TextColor3 = COLOR_TEXT_MUTED,
427 TextSize = 11,
428 Font = Enum.Font.Gotham,
429 TextXAlignment = Enum.TextXAlignment.Right,
430 ZIndex = 1003,
431 Parent = statsSection,
432 })
433
434 -- Fade Out Overlay (used for fade-out transition)
435 fadeOutOverlay = Create("Frame", {
436 Name = "FadeOutOverlay",
437 Size = UDim2.new(1, 0, 1, 0),
438 Position = UDim2.new(0, 0, 0, 0),
439 BackgroundColor3 = Color3.fromRGB(0, 0, 0),
440 BackgroundTransparency = 1,
441 BorderSizePixel = 0,
442 ZIndex = 2000,
443 Parent = loadingGui,
444 })
445
446 -- Skip Button (for debugging, hidden by default)
447 local skipButton = Create("TextButton", {
448 Name = "SkipButton",
449 Size = UDim2.new(0, 80, 0, 28),
450 Position = UDim2.new(1, -100, 1, -40),
451 BackgroundColor3 = COLOR_PROGRESS_BG,
452 BackgroundTransparency = 0.5,
453 Text = "Skip >>",
454 TextColor3 = COLOR_TEXT_MUTED,
455 TextSize = 11,
456 Font = Enum.Font.Gotham,
457 AutoButtonColor = false,
458 Visible = false, -- Set true for debugging
459 ZIndex = 1002,
460 Parent = loadingGui,
461 })
462
463 Create("UICorner", {
464 CornerRadius = UDim.new(0, 6),
465 Parent = skipButton,
466 })
467
468 skipButton.MouseButton1Click:Connect(function()
469 isLoadingComplete = true
470 end)
471end
472
473-----------------------------------------------------------
474-- Progress Update
475-----------------------------------------------------------
476
477local function SetProgress(percent, status)
478 percent = math.clamp(percent, 0, 1)
479
480 -- Update progress bar fill
481 Tween(progressBarFill, {
482 Size = UDim2.new(percent, 0, 1, 0)
483 }, tweenInfoStandard)
484
485 -- Update progress text
486 progressText.Text = tostring(math.floor(percent * 100)) .. "%"
487
488 -- Update status
489 if status then
490 progressStatus.Text = status
491 end
492
493 -- Animate shine effect across the fill
494 local shine = progressBarFill:FindFirstChild("ProgressBarShine")
495 if shine then
496 Tween(shine, {
497 Position = UDim2.new(1, -60, 0, 0)
498 }, TweenInfo.new(0.6, Enum.EasingStyle.Quad, Enum.EasingDirection.Out))
499 task.delay(0.3, function()
500 shine.Position = UDim2.new(0, -60, 0, 0)
501 end)
502 end
503
504 -- Scale animation on percentage text for key milestones
505 if percent == 0.25 or percent == 0.5 or percent == 0.75 or percent == 1 then
506 Tween(progressText, {TextSize = 20}, tweenInfoSmooth)
507 task.delay(0.2, function()
508 Tween(progressText, {TextSize = 16}, tweenInfoSmooth)
509 end)
510 end
511end
512
513-----------------------------------------------------------
514-- Tip Rotation
515-----------------------------------------------------------
516
517local function RotateTip()
518 -- Fade out current tip
519 Tween(tipText, {TextTransparency = 1}, tweenInfoTipFade)
520
521 task.delay(0.4, function()
522 -- Update tip index
523 currentTipIndex = currentTipIndex + 1
524 if currentTipIndex > #GAMEPLAY_TIPS then
525 currentTipIndex = 1
526 end
527
528 -- Update text
529 tipText.Text = GAMEPLAY_TIPS[currentTipIndex]
530
531 -- Fade in new tip
532 Tween(tipText, {TextTransparency = 0}, tweenInfoTipFade)
533 end)
534
535 -- Update dot indicators
536 for i, dot in pairs(tipDots) do
537 if i == currentTipIndex then
538 Tween(dot, {
539 BackgroundColor3 = COLOR_ACCENT,
540 BackgroundTransparency = 0,
541 Size = UDim2.new(0, 10, 0, 10),
542 Position = UDim2.new(0.5, (i - 4.5) * 16 - 5, 0.5, -5),
543 })
544 else
545 Tween(dot, {
546 BackgroundColor3 = COLOR_TEXT_MUTED,
547 BackgroundTransparency = 0.5,
548 Size = UDim2.new(0, 8, 0, 8),
549 Position = UDim2.new(0.5, (i - 4.5) * 16 - 4, 0.5, -4),
550 })
551 end
552 end
553end
554
555local tipRotationConnection = nil
556
557local function StartTipRotation()
558 if tipRotationConnection then
559 tipRotationConnection:Disconnect()
560 end
561
562 local accumulator = 0
563 tipRotationConnection = RunService.Heartbeat:Connect(function(dt)
564 accumulator = accumulator + dt
565 if accumulator >= TIP_ROTATION_INTERVAL then
566 accumulator = 0
567 RotateTip()
568 end
569 end)
570end
571
572local function StopTipRotation()
573 if tipRotationConnection then
574 tipRotationConnection:Disconnect()
575 tipRotationConnection = nil
576 end
577end
578
579-----------------------------------------------------------
580-- Asset Preloading
581-----------------------------------------------------------
582
583-- Collect important assets to preload
584local function CollectAssets()
585 local assets = {}
586
587 -- Add all image/decal IDs from ReplicatedStorage
588 for _, obj in ipairs(ReplicatedStorage:GetDescendants()) do
589 if obj:IsA("ImageLabel") or obj:IsA("ImageButton") then
590 if obj.Image ~= "" and obj.Image:find("rbxassetid://") then
591 table.insert(assets, obj.Image)
592 end
593 end
594 if obj:IsA("Sound") and obj.SoundId ~= "" then
595 table.insert(assets, obj.SoundId)
596 end
597 end
598
599 -- Add Lighting assets
600 for _, child in ipairs(Lighting:GetChildren()) do
601 if child:IsA("Sky") then
602 for _, prop in ipairs({"SkyboxUp", "SkyboxDn", "SkyboxLf", "SkyboxRt", "SkyboxFt", "SkyboxBk"}) do
603 local id = child[prop]
604 if id and id ~= "" then
605 table.insert(assets, id)
606 end
607 end
608 end
609 end
610
611 return assets
612end
613
614local function PreloadAssets(assets)
615 assetsToLoad = assets
616 local totalAssets = #assets
617
618 if totalAssets == 0 then
619 return -- Nothing to preload
620 end
621
622 -- Preload in batches
623 local batchSize = 10
624 for i = 1, totalAssets, batchSize do
625 local batch = {}
626 for j = i, math.min(i + batchSize - 1, totalAssets) do
627 table.insert(batch, assets[j])
628 end
629
630 ContentProvider:PreloadAsync(batch, function(assetId, assetFetchStatus)
631 assetsLoaded = assetsLoaded + 1
632 local progress = assetsLoaded / totalAssets
633
634 -- Update status
635 local status = string.format("Loading asset %d/%d...", assetsLoaded, totalAssets)
636 SetProgress(progress, status)
637
638 -- Update stats
639 assetsLoadedLabel.Text = string.format("Assets: %d/%d", assetsLoaded, totalAssets)
640 end)
641 end
642end
643
644-----------------------------------------------------------
645-- Background Animation
646-----------------------------------------------------------
647
648local gradientConnection = nil
649
650local function StartBackgroundAnimation()
651 if gradientConnection then
652 gradientConnection:Disconnect()
653 end
654
655 local rotation = 0
656 gradientConnection = RunService.Heartbeat:Connect(function(dt)
657 rotation = rotation + dt * 2
658 if rotation > 360 then
659 rotation = rotation - 360
660 end
661 if backgroundGradient then
662 backgroundGradient.Rotation = math.sin(rotation * 0.1) * 15
663 end
664 end)
665end
666
667local function StopBackgroundAnimation()
668 if gradientConnection then
669 gradientConnection:Disconnect()
670 gradientConnection = nil
671 end
672end
673
674-----------------------------------------------------------
675-- Loading Sequence
676-----------------------------------------------------------
677
678local function RunLoadingSequence()
679 loadingStartTime = tick()
680
681 -- Phase 1: Initializing (0% - 20%)
682 SetProgress(0, "Initializing...")
683 task.wait(0.5)
684
685 -- Phase 2: Collect and preload assets (20% - 80%)
686 SetProgress(0.2, "Scanning assets...")
687 task.wait(0.3)
688
689 local assets = CollectAssets()
690
691 if #assets > 0 then
692 SetProgress(0.25, string.format("Preloading %d assets...", #assets))
693 PreloadAssets(assets)
694 else
695 -- Simulate loading if no assets to preload
696 for i = 1, 10 do
697 task.wait(PROGRESS_DURATION / 20)
698 SetProgress(0.25 + (i / 10) * 0.55, "Loading game data...")
699 assetsLoadedLabel.Text = string.format("Assets: %d/0", i)
700 end
701 end
702
703 -- Ensure minimum display time
704 local elapsed = tick() - loadingStartTime
705 local remaining = PROGRESS_DURATION - elapsed
706
707 if remaining > 0 then
708 -- Phase 3: Finalizing (80% - 100%)
709 SetProgress(0.8, "Finalizing...")
710
711 -- Gradually fill to 100%
712 local steps = 20
713 for i = 1, steps do
714 task.wait(remaining / steps)
715 local progress = 0.8 + (i / steps) * 0.2
716 SetProgress(progress, i < steps and "Finalizing..." or "Ready!")
717
718 -- Update elapsed time
719 timeElapsedLabel.Text = string.format("Time: %.1fs", tick() - loadingStartTime)
720 end
721 end
722
723 SetProgress(1, "Ready!")
724 task.wait(0.5)
725
726 isLoadingComplete = true
727end
728
729-----------------------------------------------------------
730-- Fade Out and Cleanup
731-----------------------------------------------------------
732
733local function FadeOutAndCleanup()
734 -- Stop animations
735 StopTipRotation()
736 StopBackgroundAnimation()
737
738 -- Fade out overlay
739 fadeOutOverlay.BackgroundTransparency = 0
740
741 -- Fade out entire loading screen
742 Tween(fadeOutOverlay, {BackgroundTransparency = 1}, tweenInfoFadeOut)
743
744 -- Also fade all children
745 for _, child in ipairs(loadingGui:GetDescendants()) do
746 if child:IsA("GuiObject") and child ~= fadeOutOverlay then
747 local targetTransparency = 1
748 if child:IsA("TextLabel") or child:IsA("TextButton") then
749 Tween(child, {TextTransparency = targetTransparency}, tweenInfoFadeOut)
750 elseif child:IsA("ImageLabel") or child:IsA("ImageButton") then
751 Tween(child, {ImageTransparency = targetTransparency}, tweenInfoFadeOut)
752 end
753 if child.BackgroundTransparency < 1 then
754 Tween(child, {BackgroundTransparency = targetTransparency}, tweenInfoFadeOut)
755 end
756 end
757 end
758
759 -- Wait for fade then destroy
760 task.delay(FADE_OUT_DURATION, function()
761 if loadingGui and loadingGui.Parent then
762 loadingGui:Destroy()
763 end
764 end)
765end
766
767-----------------------------------------------------------
768-- Wait for game to be ready
769-----------------------------------------------------------
770
771local function WaitForGameReady()
772 -- Wait for essential services
773 local servicesReady = false
774 local attempts = 0
775
776 repeat
777 attempts = attempts + 1
778 local success = pcall(function()
779 -- Check if workspace is loaded
780 local _ = workspace:WaitForChild("Terrain", 2)
781 -- Check if player character data is available
782 local _ = player:WaitForChild("PlayerGui", 2)
783 end)
784 servicesReady = success
785 if not servicesReady then
786 task.wait(0.1)
787 end
788 until servicesReady or attempts > 50
789
790 return servicesReady
791end
792
793-----------------------------------------------------------
794-- Initialization
795-----------------------------------------------------------
796
797local function Initialize()
798 BuildUI()
799 StartBackgroundAnimation()
800 StartTipRotation()
801
802 -- Wait for game to be ready
803 WaitForGameReady()
804
805 -- Run loading sequence in background
806 task.spawn(function()
807 RunLoadingSequence()
808 end)
809
810 -- Wait for loading to complete
811 task.spawn(function()
812 while not isLoadingComplete do
813 task.wait(0.1)
814 -- Update elapsed time
815 if timeElapsedLabel and timeElapsedLabel.Parent then
816 timeElapsedLabel.Text = string.format("Time: %.1fs", tick() - loadingStartTime)
817 end
818 end
819
820 -- Fade out
821 FadeOutAndCleanup()
822 end)
823
824 print("[LoadingScreen] Loading screen initialized.")
825end
826
827Initialize()

Code preview

Loading Screen

Luau
Interactive visual preview is shown in the Live preview section above.Switch tabs to inspect the generated Luau client/server code.
Visual preview of the templateRoblox GUI Maker

Frequently asked questions

Keep going