Hello! So I have a module script inside of a part and I want to move or copy it into Replicated Storage when it is touched. Is this possible and how can I achieve it?
2 Likes
I don’t understand the position of the Module script.
Usually module scripts are placed under
ReplicatedStorage (for client and server access) or ServerScriptService. (only server access)
Can you please explain the reasoning behind needing to copy the script from workspace to ReplicatedStorage?
Anyways this is how you would do that:

-- Script
script.Parent.Touched:Connect(function(hit)
if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
script.Parent.ModuleScript:Clone().Parent = game.ReplicatedStorage
end
end)



1 Like
Basically I am trying to make a trigger cutscene so I moved the Module script into a part. Then I can move the script into ReplicatedStoarage and it will run after the part has been touched and the cutscene will play.
I am new to scripting so I am probably getting this wrong lol ![]()
1 Like
You’re pretty close, but I believe this would be more effective:
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local clone = script.Parent.ModuleScript:Clone()
clone.Parent = game.ReplicatedStorage
end
end)
Nice job, though.
1 Like
Thanks! You guys have been very helpful! : D
1 Like
