modular is an open-source plugin that make scripting way easier by tracking every module and service in your game and suggesting them as an autoComplete option.
Features :
-
Automatically finds and suggest services for you!
-
Automatically requires module scripts! This feature will track every module in your game and as soon as they are created or edited you will be able to find them as an auto-complete option.
Download :
The plugin link : https://create.roblox.com/store/asset/18695860600/modular-v1
Source code here
local ScriptEditorService = game:GetService("ScriptEditorService")
local Modules = {}
local Services = {"AdService", "AnalyticsService", "AssetService", "BadgeService", "ChangeHistoryService", "Chat", "CollectionService", "ContextActionService", "CookiesService", "CoreGui", "CorePackages", "CoreScriptSyncService", "DataStoreService", "Debris", "EventIngestService", "FriendService", "GamepadService", "GamePassService", "Geometry", "GroupService", "GuiService", "HapticService", "HttpRbxApiService", "HttpService", "InsertService", "KeyframeSequenceProvider", "LocalizationService", "LogService", "MarketplaceService", "MessagingService", "NavigationService", "NetworkClient", "NetworkServer", "NotificationService", "PathfindingService", "PhysicsService", "Players", "PointsService", "PolicyService", "ProximityPromptService", "RenderSettings", "ReplicatedStorage", "RobloxScriptSecurity", "TeleportService", "ReplicatedFirst", "RunService", "ScriptContext", "Selection", "ServerScriptService", "ServerStorage", "SocialService", "SoundService", "StarterCharacterScripts", "StarterGui", "StarterPack", "StarterPlayer", "StarterPlayerScripts", "StudioService", "Teams", "TeleportService", "TestService", "TextService", "TweenService", "UserInputService", "UserService", "VRService", "VoiceChatService", "Workspace"}
local Locations = {Workspace = game:GetService("Workspace"),Players = game:GetService("Players"),Lighting = game:GetService("Lighting"),ReplicatedStorage = game:GetService("ReplicatedStorage"),ServerStorage = game:GetService("ServerStorage"),StarterPlayer = game:GetService("StarterPlayer"),StarterCharacterScripts = game:GetService("StarterCharacterScripts"),StarterGui = game:GetService("StarterGui"),StarterPack = game:GetService("StarterPack"), Teams = game:GetService("Teams"),SoundService = game:GetService("SoundService"),Chat = game:GetService("Chat"),ServerScriptService = game:GetService("ServerScriptService"), ReplicatedFirst = game.ReplicatedFirst }
function addModule(module : ModuleScript)
if module == nil then return end
local path = "local "..module.Name.." = require(game."..module:GetFullName()..")"
local function register(request : Request, response : Response)
local temp = nil
for _, item in ipairs(response.items) do
if item.textEdit then
temp = table.clone(item.textEdit.replace)
break
end
end
if not temp then return response end
local item = {
label = module.Name;
detail = "Requires "..module.Name;
kind = Enum.CompletionItemKind.Text;
textEdit = {
newText = path;
replace = temp
}
}
table.insert(response.items, item)
return response
end
local s, e = pcall(function()
ScriptEditorService:RegisterAutocompleteCallback(module.Name, 1, register)
end)
if not s then
ScriptEditorService:DeregisterAutocompleteCallback(module.Name)
ScriptEditorService:RegisterAutocompleteCallback(module.Name, 1, register)
end
end
function addService(service : string)
if service == nil then return end
local path = "local "..service.." = game:GetService('"..service.."')"
local function register(request : Request, response : Response)
local temp = nil
for _, item in ipairs(response.items) do
if item.textEdit then
temp = table.clone(item.textEdit.replace)
break
end
end
if not temp then return response end
local item = {
label = service;
detail = "Requires "..service;
kind = Enum.CompletionItemKind.Module;
textEdit = {
newText = path;
replace = temp
}
}
table.insert(response.items, item)
return response
end
local s, e = pcall(function()
ScriptEditorService:RegisterAutocompleteCallback(service, 1, register)
end)
if not s then
ScriptEditorService:DeregisterAutocompleteCallback(service)
ScriptEditorService:RegisterAutocompleteCallback(service, 1, register)
end
end
function saveModule(module : ModuleScript)
if module:IsA("ModuleScript") and table.find(Modules, module) == nil then
table.insert(Modules, module)
addModule(module)
end
end
function removeModule(module : ModuleScript)
if module:IsA("ModuleScript") and table.find(Modules, module) ~= nil then
table.remove(Modules, table.find(Modules, module))
local s, e = pcall(function()
ScriptEditorService:DeregisterAutocompleteCallback(module.Name)
end)
end
end
for _, service : string in pairs(Services) do
addService(service)
end
for _, location : Folder in pairs(Locations) do
location.DescendantAdded:Connect(function(c)
saveModule(c)
end)
location.DescendantRemoving:Connect(function(c)
removeModule(c)
end)
for _, module in pairs(location:GetDescendants()) do
saveModule(module)
end
end
for _, module in pairs(Modules) do
module:GetPropertyChangedSignal("Name"):Connect(function()
removeModule(module)
addModule(module)
end)
end
Conclusion :
Hopefully you liked this resource, it took a week to get done. Please if you have any feedback let me know in the comments! This module was made by @gianfragolo , big thanks to @RyosWill too!.
IMPORTANT: IF IT DOSEN’T WORK RE-OPEN THE GAME AND CHECK FOR UPDATES!!