Great framework! Recently started using this and practicing creating projects with it!
1 Like
-- Services
local CollectionService = game:GetService("CollectionService")
local Rep = game:GetService("ReplicatedStorage")
local SS = game:GetService("ServerStorage")
local SSS = game:GetService("ServerScriptService")
local RS = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local TS = game:GetService("TweenService")
local Players = game:GetService("Players")
-- Important Variables and Modules
local Framework = require(Rep.Framework)
local modules = {}
local moduleCount = 0
local allLoaded = false
for _, mod in script:GetChildren() do
if mod:IsA("ModuleScript") then
local r = require(mod)
modules[mod.Name] = r
moduleCount += 1
Framework.Initialize(script[mod.Name])
print(script[mod.Name])
print("Client Firework Framework - Loaded module: ", mod.Name)
end
end
while not allLoaded do
allLoaded = true
for _, mod in pairs(modules) do
if not Framework.Modules[mod] then
allLoaded = false
warn("Waiting for module to be loaded: ", mod.Name)
Framework.Initialize(script[mod.Name])
break
end
end
task.wait(1)
end
Framework.WaitForLoaded()
if Framework.IsLoaded then
warn("Client Firework Framework - Initialization complete. Modules loaded: ", moduleCount)
if workspace.Not and workspace.Not.Prox then
workspace.Not.Prox.Triggered:Connect(function()
local Notify = Framework.Get("Notifications")
Notify.CreateNotification("Hoi", Color3.fromRGB(255, 255, 255), "MessageBound")
end)
else
warn("womp womp")
end
end
I noticed that specifically one module on my client loader most times doesn’t initialize? I’m not sure if I’m doing something wrong, but it doesn’t register it.
Framework.Initialize is intended to be used with multiple modules at once. If you want to register them sequentially, I would recommend Framework.RegisterRuntime instead.
Fixed the issue, turns out the allLoaded = false
was creating sort of an infinite loop even though it was initialized!