I have this model cannon which has a script called 'Main'.
The Main script has this function
local movement = (function() local mvnt = script.Parent.Movement:Clone() script.Parent.Movement:Destroy() return mvnt end)();
and The Movement script it's referring to is alongside it in the model
Apparently what the 'Main' script does is it somehow fetches a copy of the code via return and then removes the actual script that stored that code. As if the Movement script actually still exists but is nowhere to be found, and no it hasn't moved it to ServerScriptStorage either and I don't see any part of that function moving it anywhere except destroying the original copy/script.
Then I made an test with a script inside a brick that uses CFrame to make the brick rotate on a loop.
Then I used the Main script and converted it to:
local spinning = (function() local spin = script.Parent.Spin:Clone() script.Parent.Spin:Destroy() return spin end)();
It's structured the same as the original model and in theory it should just duplicate a working and executable "Invisible" copy of the original code by return.
So what I don't get is why it's not working. There are no errors, but the brick isn't spinning.
Does it have something to do with the (); on the end?
You may want to parent the replicated items..
mvnt.Parent = game.Workspace
and
spin.Parent = game.Workspace