Import Package
About 383 wordsAbout 1 min
2026-01-24
Importing a package into your code is done in two main steps:
- Importing the RbxPI API into the target script.
- Importing the desired package using this API.
API Import
The RbxPI API import mechanism has been designed to be simple, intuitive, and accessible to all developers. It allows for a quick start, regardless of experience level.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RbxPI = ReplicatedStorage:WaitForChild("RbxPI")
local API = require(RbxPI.API)Single-line import
In order to limit code clutter, it is possible to use a more compact form of import, as illustrated below:
local API = require(game:GetService("ReplicatedStorage"):WaitForChild("RbxPI").API)Warning
Excessive code reduction can harm optimization and reliability. The method presented above constitutes the most reliable approach.
Package Import
To import a package directly into your script, simply call the variable interacting with the API in your code and specify the name of the desired package.
local VersionRbxPI = API.version
print(VersionRbxPI)Code Structure
If you installed RbxPI via Rojo & GitHub or rbxmanager, you should obtain a structure similar to the following:
src
ReplicatedStorage
RbxPI
API.luau
ServerScriptService
script.server.luau
script2.server.luau
default.project.json
-- RbxPI API Content-- Importing the RbxPI API
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RbxPI = ReplicatedStorage:WaitForChild("RbxPI")
local API = require(RbxPI.API)
-- Importing the Package
local VersionRbxPI = API.version
print(VersionRbxPI)-- Single-line RbxPI API import
local RbxPI = require(game:GetService("ReplicatedStorage"):WaitForChild("RbxPI").API)
-- Importing the Package
local VersionRbxPI = RbxPI.version
print(VersionRbxPI){
"name": "your-project-name",
"tree": {
"$className": "DataModel",
"ReplicatedStorage": {
"$className": "ReplicatedStorage",
"$path": "src/ReplicatedStorage/"
},
"ServerScriptService": {
"$className": "ServerScriptService",
"$path": "src/ServerScriptService/"
}
}
}If you installed RbxPI via Roblox Studio, you should obtain a slightly lighter structure:
ReplicatedStorage
RbxPI
API
ServerScriptService
script
script2
-- RbxPI API Content-- Importing the RbxPI API
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RbxPI = ReplicatedStorage:WaitForChild("RbxPI")
local API = require(RbxPI.API)
-- Importing the Package
local VersionRbxPI = API.version
print(VersionRbxPI)-- Single-line RbxPI API import
local RbxPI = require(game:GetService("ReplicatedStorage"):WaitForChild("RbxPI").API)
-- Importing the Package
local VersionRbxPI = RbxPI.version
print(VersionRbxPI)