Inserting a .rbxl file through a script

How could I insert a .rbxl file’s plaintext into a Roblox place through a script? I searched the deforum but couldn’t find anything about this.

Do you mean inserting .rbxl (model, script, etc) to Roblox?

If it was
Try dragging the file into the Roblox Studio

Yes, but I mean like through a script. Like when a player clicks a certain button, a plugin inserts a .rbxl file?

Can you specify what is the plugin?

It’s a package manager plugin I’m making.

I’ve never done something like this but maybe this is what you are looking for?

̶h̶t̶t̶p̶s̶:̶/̶/̶c̶r̶e̶a̶t̶e̶.̶r̶o̶b̶l̶o̶x̶.̶c̶o̶m̶/̶d̶o̶c̶s̶/̶r̶e̶f̶e̶r̶e̶n̶c̶e̶/̶e̶n̶g̶i̶n̶e̶/̶c̶l̶a̶s̶s̶e̶s̶/̶F̶i̶l̶e̶

All of the methods say they are accessible via plugin so it might work.
̶I̶t̶’̶s̶ ̶m̶o̶r̶e̶ ̶t̶h̶a̶n̶ ̶l̶i̶k̶e̶l̶y̶ ̶t̶h̶o̶u̶g̶h̶ ̶t̶h̶a̶t̶ ̶y̶o̶u̶’̶d̶ ̶h̶a̶v̶e̶ ̶t̶o̶ ̶u̶s̶e̶ ̶h̶t̶t̶p̶ ̶r̶e̶q̶u̶e̶s̶t̶s̶ ̶f̶r̶o̶m̶ ̶a̶ ̶s̶e̶r̶v̶e̶r̶ ̶o̶f̶ ̶s̶o̶m̶e̶ ̶k̶i̶n̶d̶ ̶t̶o̶ ̶l̶o̶a̶d̶ ̶f̶i̶l̶e̶s̶.̶

EDIT: Upon further inspection File seems to be class for already imported files.
I think this is what you are looking for.

I found something like this while looking for resources, however it prompts the creator to select a file from their computer, and doesn’t seem to have a way to run it.

you could try reading the raw binary data of the file

How would I run that though?

Character limit

File:GetBinaryContents

I’ve already looked at that, that wasn’t my question. File:GetBinaryContents returns a string, but I want to add the string of the .rbxl file into the game, similar to how dropping a .rbxl file into studio would work.

well you’d have to make your own rbxl reader in lua which is quite a hard task but i dont know if this is answering your question properly

Never mind, found this, which should work.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.