Help with code source

Hello, I am having problems with this code right here.

local t = script.Parent.Text

while true do
	wait(0.1)
	workspace.Part.Script.Source = t
end

There is a textbox for players to type code into, but it says:

The current identity (2) cannot Source (lacking permission 1)  -  Client - LocalScript:5

I don’t get the permission part.

Okay, I have tested it in a serverscript same result.

I believe using .source with a local script and applying it to another script which is server-sided will result in lacked permission.

If I believe so, this might have to called from a server script. As a local script cannot change the source code of a server script, if this were true, all of our games would easily be hacked.

You cannot change any serverscript’s source code from a localscript

https://developer.roblox.com/en-us/api-reference/property/Script/Source

Script.Source can not be used in scripts or local scripts, only the command bar and plugins.

Is there any way to change the source code through script?

Only through a plugin or the command bar

While the game is running and not in studio, I don’t believe it is possible, but why would you even need to do that?

I am making a game where you can code parts. It’s meant for the people on mobile.

You can use loadstring(). But it only works on server scripts.
You have to enable it under ServerScriptService

local string = [[
local x = 6
local y = 9
print(x + y)
]]

local code = loadstring(string)
code() -- 15

from the example, I loadstring-ed the string, and it returned a function so I called the function.

I’m not even sure why it’s a SSS property, especially considering it enables the loadstring() global function for all server scripts (regardless of their location).

local f = loadstring("print('Hello world!')")
f()