New update on it, added skip button, play button (can be both activated on the configuration object)
Hey there, sorry for the bump, but I found this resource super nice looking and wanted to use it, only issue I had was that it’s not modular (and I like having all my systems be modular), and it didn’t provide the customization that I needed.
So I went ahead and rewrote the thing from scratch in the form of a module, SwiftLoader, and thought it’d be cool to share it (would of made a separate post, but I don’t own this, so I figured it’s best to share it here).
Here’s how it looks when preloading one of my games (ignore the cutscene, it’s unfinished):
Some key differences between Lyxo and SwiftLoader are that:
- SwiftLoader doesn’t have a fixed duration, it loads all the assets you throw at it in order, and once done or skipped it’ll close.
- It provides an indicator so the user can tell how much assets are and remain to be loaded.
- It’s designed to scale with most games as it provides the ability to throw multiple collections of assets at it.
- Offers a slightly higher level of customization, but still not a whole lot.
And some cons are that:
- I am not an UI designer (thus why I’m using Lyxo as a base), so the transitions might be uglier (in fact, I removed some of the glow as I couldn’t tell what it did).
-
I didn’t really bother ensuring the CoreGuis disabled properly with a pcall like you do, they get disabled fine on my end, but maybe it doesn’t on yours.It retries forever until sucessful now. - If an asset fails to load, it won’t retry. This is because I read on the forums that retrying to load failed assets is useless and won’t actually load the asset as they get cached when they fail or something like that.
- I like the default loading screen, so I left it in. This triggers right as that screen is done loading.
How does it work?
You throw the module in workspace, tell it what assets to preload from it’s handler script, give it a property table to customize it, and you’re good to go! It’ll throw a Loaded event once your game is done loading.
Documentation
--[[
-- Initialization Arguments --
LoaderAssets(Table): The first parameter the Init function takes, it contains the assets you wanna load, with the text displayed during the loading.
LoaderProperties(Table): The second parameter the Init function takes, it contains the properties that will be applied to the loading screen (basically weather there's a skip button, and what CoreGui to disable if any).
-- Properties --
IconEnabled(boolean): Determines whether the game's icon is enabled or not.
BarEnabled(boolean): Determines whether the loading bar is enabled or not.
LabelEnabled(boolean): Determines whether the label describing the progress is enabled or not.
SkipEnabled(boolean): Determines whether the skip button is enabled or not.
AnimatedIcon(boolean): Determines whether the icon is animated while the game loads or not.
AnimatedLabel(boolean): Determines whether the label is animated while the game loads or not.
AnimatedSkip(boolean): Determines whether the skip button is animated while the game loads or not.
SkipIndex(number): Number representing at what point in the loading screen the skip button will show up, if enabled.
LoadingSound(boolean): Determines whether the loading sound will be played when the game starts loading or not.
SkippedSound(boolean): Determines whether the loading sound will be played when you skip the loading screen or not.
LoadedSound(boolean): Determines whether the loading sound will be played when the game ends loading or not.
CoreGui(table): Contains the names of the CoreGui components you wanna disable (will break if the component doesn't exist).
-- States/Events --
IsLoaded(boolean): Tells you whether the game loaded already or not.
Loaded(signal): Fires when the game is done loading.
PreLoaded(signal): Fires slightly earlier than Loaded (useful for cutscenes).
--]]
Default Handler
----- Services -----
local ReplicatedStorage = game:GetService("ReplicatedStorage")
----- Variables -----
local SwiftLoader = require(script.Parent)
local Assets = ReplicatedStorage:WaitForChild("Assets")
----- Code -----
--Assets
local LoaderAssets = {
[1] = {"UI Assets", script.Parent:WaitForChild("LoadingGui"):GetDescendants()},
[2] = {"Cutscene Assets", workspace:WaitForChild("Cutscenes"):GetDescendants()},
[3] = {"Sounds", Assets:WaitForChild("Sounds"):GetDescendants()},
[4] = {"Animations", Assets:WaitForChild("Animations"):GetDescendants()},
[5] = {"Effects", Assets:WaitForChild("Effects"):GetDescendants()}
}
--Properties
local LoaderProperties = {
--Screen Components
IconEnabled = true,
BarEnabled = true,
LabelEnabled = true,
SkipEnabled = true,
--Component Settings
AnimatedIcon = true,
AnimatedLabel = true,
AnimatedSkip = true,
SkipIndex = 3,
--Sounds
LoadingSound = true,
SkippedSound = true,
LoadedSound = true,
--Disable CoreGui
CoreGui = {
"All"
}
}
--Init
SwiftLoader:Init(LoaderAssets, LoaderProperties)
Wait To Trigger Main Menu Example
--Wait for game to load
if not SwiftLoader.IsLoaded then
SwiftLoader.PreLoaded:Wait()
end
Download
SwiftLoader 1.0.0 (35.9 KB)
SwiftLoader 1.0.1 (36.0 KB)
Bug Fixes
1.0.1 - 12/17/23:
- CoreGui will now retry forever until it succeeds on being disabled.
- Label transition displays the previous text as opposed to the new one on both labels.
- The content in the assets table in the example handler script is slightly different now as I was editing on a different place, but the properties and all of that should still be the same (you’ll want to change it to load the appropiate assets in your game).
I wouldn’t have made this thing if I hadn’t come across Lyxo, so regardless if this thing I made is worse or not I’d like to thank you for the awesome resouce, and I wish everyone reading this a merry christmas and a happy new year!
Thanks for enhancing lyxo! I don’t have much faith to this product, cause it’s been months since I last updated this.
Well, sometimes it works and sometimes it don’t but most of the time it does, so I added a pcall to protect the script from interruption caused by errors. CoreGui is in restricted place that’s why it may throw some various errors.
OH my goodness, this is truly great, I love everything about it.