Hey! I’m making a leaderstats creator plugin.
How do I use Script.Source? Basically just
Script.Source = print("Hello World")
or
Script.Source = local var1 = "idk" print(var1)
?
If I do that, it will be underlined red.
Thank you!
Hey! I’m making a leaderstats creator plugin.
How do I use Script.Source? Basically just
Script.Source = print("Hello World")
or
Script.Source = local var1 = "idk" print(var1)
?
If I do that, it will be underlined red.
Thank you!
From this website:
This item is protected. Attempting to use it in a Script
or LocalScript
will cause an error.
^, I’m making a plugin, not a script.
Ok, but isn’t a plugin just a script if i’m not mistaken?
Script.Source takes a String:
Script.Source = "print(\"Hello World\")"
Script.Source takes a string, the code like this “print(‘hello’)”
Yes it is, but you can access Script.Source when publishing the script as a plugin.
Access .Source of other scripts, and of it self, I suppose.
what you can do instead is:
Script.Source = 'print("Hello World")'
so every time you want the script to have a string in it you don’t have to write: \"
but you can just write "
So it’s basically like loadstring()?
Not really, you can change a script with it.
It’s often used by plugins, for example:
local newScript = Instance.new("Script")
newScript.Source = 'print("New script!")'
newScript.Parent = game:GetService("ServerScriptService")
would insert a script that has print("New script!")
in it into ServerScriptService.
You cannot change a script’s source, only plugins and the command bar can do that.
You’ll receive the following error if you attempt it:
The current identity (2) cannot Source (lacking permission 1)
Another note is that you can’t even read the source (only plugins and the command bar can do that as well).