You can’t change the source of a script from any normal script, localscript, or modulescript because it doesn’t have high enough permissions. It may work in a plugin if that is what you’re looking for. If not then like said above you could use loadstring or some other sort of sandbox. See below.