So i've been looking all over the internet for this to no avail. So basically i'm trying to make a localscript with a preset source instead of editing it.
I tried multiple methods that didn't work and always gave out the same lacking permission error.
Please if someone has a method on how to do that i beg you tell me how you do it because i really need it right now.
Thanks in advance.
Hey! I recently dealt with this problem myself, and i got a solution! So what you want to do, from what I can tell, is create a script that has already got the code, so it can happen in game! What I would recommend you do is create the script/localscript in 'ReplicatedStorage', and then access it by referencing it in another script for the part.
For example if you want to create a new part and put the script inside of it you would do
local Script = game.ReplicatedStorage.script:clone() local part = instance.new("Part") Script.parent.parent = part
And that would put a copy of the script into the new part!
im not entirely sure but it has to do something with loadasset you can use this to load things like models or something into your studio or game if you want to know more about this go here:
link: https://developer.roblox.com/en-us/api-reference/function/InsertService/LoadAsset
Unfortunately, a script's source can only be indexed via the command bar and plugins. I suppose you could create a local plugin that creates a script and sets the source for you. A tutorial on how to make plugins can be found here.
If you have any further questions, shoot me a DM on Discord, @artblart#3386 and I'd be happy to answer.
Edit: spelling