Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to edit others script source with other script?

Asked by 7 years ago

So i saw a video on loleris twitter about weapon animation Creator 3 he created and it exported an module script with table like this : return{Here is supposed to be Cframe data}, basically it's a table containing Cframe data, animation data etc, but how he did it i tried with loadstring with loadstringenabled = true and i can't seem to edit others script source code with other script, can any 1 give me small example code, how to edit others script source please?I searched wiki and there was article about it, but i guess its outdated and does't work that way anymore. I will be using the same method for my own animation plugin,and i heard plugin's have no problem using loadstring?

1 answer

Log in to vote
1
Answered by 7 years ago
Edited 7 years ago

Plugins have different permissions and are able to access a scripts source . A normal script cannot access the scripts source.

This is because the it is a ProtectedString. For normal script you can use loadstring that would take string and run it, the scripts source code does not change rather you are just executing the code passed to it.

As you are using a plugin you are able to access a scripts source code, e.g:-

-- example only
local function mkModule(name, par, source)
      local tmp = Instance.new('ModuleScript', par)
      tmp.Name = name
      tmp.Source = source
end

-- run example
mkModule('test', game.Workspace, 'print("test")')

I hope this helps.

Ad

Answer this question