Hi! I made a simplified directory system. You can create your own “files”, create new directories, change your current directory, and print your own directory. This probably has no good use, but I just made it for fun.
API
.new
- Creates a new DirectorySystem. Takes 0 arguments.
:cwd
- Returns the current path. Takes 0 arguments.
:cd
- Changes the current path to the specified argument. Errors if the path isn’t found. Takes 1 argument: path
:add
- Adds the specified argument into the current path. Takes 1 argument: data
:tree
- Returns the full directory.
Examples
This will create a new file inside of the “Users” directory.
local directory = require(script.Directory).new()
directory:cd("Users/")
game.Players.ChildAdded:Connect(function(player)
directory:add(player.Name)
print(directory:cwd())
print(directory:tree())
end)
This will create a new file in the “Workspace” directory every time an instance is added into the Workspace.
game.Workspace.ChildAdded:Connect(function(child)
directory:cd("Workspace/")
directory:add(child.Name)
end)
Like I said, this probably isn’t useful, but if you do find a use, let me know. If you like this or don’t, please tell me why. Feel free to leave any feedback.
You can download it here: DirectorySystem.rbxm (1.1 KB)