PreloadService - Customizable way to load assets via ContentProvider [v2]

download-icont money-free-icon-font discord-free-icon-font

Hey!
This is PreloadService. A very simple, easy insert loading module with a powerful control panel.

Why PreloadService?

- Secure

The Admin Panel is checked for being in exploiter’s StarterGui, not to mention wont work without server recognition of that player being an admin

- Safe + tested!

PS Has been tested in mass use cases, so it’s safe to use in multi thousand/million player games worry free!
image

- Easy to use + learn

PS Has an easy to use interface, and an easy setup, making it super easy to put into existing loading screens, or new!

- Comes with free UI

Comes with professional modern UI for loading screens, completely free, light or dark.

- Minimal Memory + Performance toll

All code has been optimized to run fast and smooth, without taking any time, or memory.

- Highly custom

With Theme packs, Light/Dark UI, and all being made in Studio rather than PhotoShop, you can customize your copy easy!

I'm interested!

Great! This will be split up into a few easy steps.

🔧 Getting Started + Install

Firstly, thank you!

Now, you can get the module here.

Once that’s installed, you should have a :scroll: ServerScript!
Put that into ServerScriptService.
Now, expand the script.
Double Click Admins (ServerScriptService/PreloadService/Admins(ModuleScript))
In that script; there should be a table. It will look like this

local module = {}
module.Admins = {
	--Fill with IDs
	133017837, --darkpixlz
    -1, --studio default player
}
return module

Inside of that table remove me and -1 if you wish.
Now, put Your UserID

dont know your UserID? Click here!
  1. Go to https://roblox.com
  2. Go to your profile
  3. Look at the top link bar
  4. Your UserID is the numbers after “profile”, without the /.
    image

Paste it in, and then add a comma (,), or semicolon (;)
You can add as many IDs as you like. These are admins, and will be given access to the Admin Panel.
The module is now installed, and you can move on to the next step!

📜 Documentation + Code

Welcome to the next step!

This will be what’s required, then below will be the entire API.

To get started with your loading screen, type this in a new script;

--LocalScript, in StarterGui maybe?
local PS = require(game.ReplicatedStorage:WaitForChild("PreloadService")) --The module auto-injects into RS after loading.
PS.Load("Game" --[[You're loading the game.]], "Default" --[[Use the supplied UI. Can be "Custom, will get into that later]], nil--[[Custom UI will be nil, or none, because you're using my default UI.]], "Key"--[[Will be explained later]])

That will pop up with a new Loading Screen as soon as the player joins the game, and the script gets created.

Custom UI

To have a Custom Loading UI frame, you may have it be however you want. But, with no modifications, you must have;

  • A TextLabel named LoadingText
  • A Frame names “Bar”
  • Inside of Bar, put a frame named “Progress”, and color it different.
    You now are ready to insert it!
--Script from earlier
local PS = require(game.ReplicatedStorage:WaitForChild("PreloadService")) --The module auto-injects into RS after loading.
PS.Load("Game" --[[You're loading the game.]], "Custom" --[[Now custom!]], script.UI --[[The frame now exists!]], "Key"--[[Will be explained later]])

Going back to that code, change it to that.
Script.UI is the location of the Frame. Tweens are done by the module by default.
Now, when you join the game, instead of my UI, yours will appear, and be tweened!

Now, the first parameter. It’s a string if you want to load the game. Otherwise, it must be a table!
Example code:

local PS = require(game.ReplicatedStorage:WaitForChild("PreloadService"))

PS.Load({script.Part}, "Default", nil, "Key")

--//Or\\--

local Table = {
    script.Part
}
PS.Load(Table,"Default",nil, "Key")

Key parameter

This is also the place I’m going to explain the .Completed event.

With this code, you can tell when a specified thing has finished loading.

NOTE: ONLY AVAILABLE ON CLIENT

local PS = require(game:GetService("ReplicatedStorage"):WaitForChild("PreloadService"))
PS.Load("Game", "Default", nil, "InitialGameLoadingKey"--[[Now, it linked!]])

--No key
PS.Completed.OnClientEvent:Connect(function(time)
print("An Asset loaded in "..time.." seconds!")
end)

--With Keys
PS.Completed.OnClientEvent:Connect(function(time, Key)
    if Key == "InitialGameLoadingKey" then
        print("The game loaded in "..time.." seconds!") --Now, it will only print if the game loads because it's a specific event!
    end
end)

Firing Modules

You can also fire modules with PS!
The current code is Module.Fire. To change it,
Go to the PS Module.
Press Ctrl/Command + G
Type 256
Change the function call to whatever you want, and add parameters!
This is some code.


PS.FireModule(script.Module) --Loads the module, then fires it

That’s all a simple user needs to know. On to the next step when you’re ready!


📜Full API

–BETA–


📹 Media

Here you can find videos and screenshots of the module.
Open me! (UPDATED 7/15/22)


🙂 Admin Panel

Woah! It’s the big feature of 2.0!
Yep, a full blown Admin Panel!
Overboard? Haha. heh. ha.
After over a month, it’s ready!
Currently, the keybind is F2, you can change it in MainHandler for the time being.
Enough babbling, let’s get into it.
This is your Homescreen.

From it, you can get all required info about the game in general, at a quick glimpse.
Notice the bar at the bottom?
if you didn’t then you’re blind
What every button does:

  1. Expand: Expand the buttons upward [DISABLED]
  2. Players: See the players in every server, and then load items for them, or kick them [BETA]
  3. History: See all loaded items from your server
  4. Home: Brings you home
  5. Times: See how long assets are taking [DISABLED]
  6. Modules: See what modules are being loaded, and fired
  7. Info + settings: What description do you want??

Now, more detailed;

  1. Expand:
    Opens the expanded button view

  2. Players [AKA: Player Management, PlayerManagement, PlrMgmt]

NOTE: THIS IS DISABLED IN STUDIO!
When you join, it will look something like this;

Nothing in it.
If you aren’t in Studio, and you click "Load Servers, there will be servers that fill the list.


Clicking “Manage” will bring up this frame.

Please note this feature is in development and will not be working as of right now.

  1. History

Self-explanatory. It fills up with slots, as players load items.

  1. Home

Get a quick at-a-glance look of stats.

  1. Times

View how long it’s taking for assets to load, filtered logs for that asset, and then averages.

  1. Modules

View module’s being fired by PS, counts, and more.

  1. Settings and info

View detailed info about the panel, check for updates, and change settings (They will save in the future, not in 2.0. Please wait for 2.1! Change settings in:
PreloadService(serverscript)/PreloadService(modulescript)/Settings


FAQ:

Q: Help! My event isn’t firing!
A: Make sure you spelt everything right, and it’s OnClientEvent. It cant be OnServerEvent!

Q: Can I load things after the initial loading of the game!
A: Yes, you can!

Q: Bruh this sucks
A: Please leave feedback here! I want to improve this module to be helpful to everybody, as much as possible.

Q: I really like this! How can I support you!
A: Donating, (the start of the topic), Liking this post, and giving me feedback

Q: Should I credit you?
A: It’s not required, as this is open sourced, but I would like to see it if you want. Tag me on Twitter with your game for a RT or like on it! I love to see games using my resources. But, it’s 100% not required.
Q: There’s a button that doesn’t work!
A: Right now, the More (up arrow) button, and the Times button does nothing. They will be working in a soon version.
Q: Why is there no donation buttons in Menu?
A: I never set them up, they will come in a soon release

Really. Thank you so much!

I cant believe all of the support I get for this module. It really means so much to me, that really anybody cares. 2.0 alone has taken 1 month, and more of testing, coding, and UI. That said, enjoy this module!

How can I contact you?

My Discord is Pixlz#1337, my DevForum + Roblox messages are ALWAYS open, and my Twitter is @darkpixlz.

I found a bug!

Please report it to me! My socials are above.

I wanna suggest a feature!

I’m always open to them! Contact me letting me know


Links

Discord Server
Roblox Module
Donate

Would you use this?
  • Yes!
  • No!

0 voters

Are you going to use this?
  • Yes!
  • No!

0 voters


Open source Notice

Uses ButtonAnimations by @Qinrir (GUI Ripple Effect)
Open/Close Animation by @6Marchy4
Server finding framework by @kylerzong
Icons by FlatIcon + Google (transitioning 100% to FlatIcon in 2.1)
All UI + Code by DarkPixlz, 2022

49 Likes

how exactly does this module load assets “faster”? i’m curious to see the process behind this whole thing

2 Likes

It’s not special, it’s an easy way to load assets, in a fast way. The time it takes depends purely on the size of the asset, and Roblox’s server ping.
I did try to keep it simple, and clean, to cut down on the time it takes.

1 Like

oh, so in a way, i guess it can be taken as an easy-setup loading GUI or something?
if that’s the case, then i would definitely use it, i’m not super good at scripting yet :sweat_smile:

1 Like

Yeah lol, because it allows for custom UI, and loading past the initial loading, if you are spawning a new asset in and need it to load. Thanks for using it!

1 Like

awesome, no problem! i’m sure that this module will help a lot of others, not just me

1 Like

v1.0.1 released!
What’s new?

  • Added socials
  • Removed unneeded prints
  • Linked this topic
  • Added a scam warning in comment
2 Likes

Ah ContentProvider… the little service that could but is often forgotten.

I used to use this service all the time in development, because even though it’s not actually making anything faster it can certainly make it feel faster by prioritizing loading things that improve the user experience.

My personal recommendation would be to stick to preloading assets just before your user needs to see them that way they’re ready when you need them. We’re talking seconds before in most cases. The way that the engine loads things is they’re loaded as needed. What you’re essentially doing with ContentProvider’s Preload is fetching them just a little bit in advance so that when you are ready to use the assets, they’re (hopefully) already loaded which make the experience feel much smoother for your users.

Nice work!

14 Likes

Thanks for the review!

Pretty cool to think a Roblox admin would be replying to my tiny loading module.
But then again, thanks for the review! Yeah, the ContentProvider is pretty forgotten… yet useful for stuff like this!

my cousin said for you to tell jparty i said hi, so there i guess :slight_smile:

Would you send the source code in code block cuz I’m on mobile right now?
Also it seems kind of useful

1 Like

You know your model is good when a Roblox Admin comes here are compliments you on it. Great job @DarkPixlz ! This looks really useful. I’ll be sure to try it when I can.

1 Like

Sure. Once I launch Studio, I will DM it to you.

1 Like

image
Send me a DM

Ok

1 Like

v1.0.2 Released!

What’s new?

  • Settings! More to come. Access through PreloadingService/Settings
  • Version checking! Thanks to @Forummer for this one!
  • Bar on the loading screen should no longer freak out.
  • Cleaned up the code.

Known bugs:

  • Despite my fixes, the bar might still freak out.
  • Game loading screen doesn’t extend fully.
  • You might not be able to load custom assets right now. [PRIORITY]

Update your module if needed!

And also, thanks for all the positive feedback and reviews on this! It really does mean a lot to me, and I will try to improve on everything you guys suggest :wink:

1 Like

fake!!
edited!
okay well, have a good one

Something I will say is really funny is that the only model bots have taken so far is the version checker loll



Once again, thanks to all the actual people using the module! You dont need to credit me in game, it is appreciated though.

1 Like

v1.1.0 coming soon!

With Light Mode default UI, Fixes, More settings, and more!

Error img

local PS = require(game.ReplicatedStorage.PreloadService)
PS.Load("Game", "Default", nil)

That is the entire file and it is placed in StarterPlayerScripts on a fresh place.

I will look into it now. Thanks for the report!