I have a module script that when required should clone the local script to the specified player.

Here is the module:

local module = {}

function module.log(plr)
	script.LocalScript:Clone().Parent = game.Players[plr].Backpack
end

return module

Followed by what the local script inside the module should do after its parented:

for i,v in pairs(game.Players:GetPlayers()) do
	if v.Name == script.Parent.Parent.Name then
		print("Oh good!")
	end
end

And also the script requiring the module script:

wait(3)

require(game.Workspace.ModuleScript).log("CALEBBEN3")

Any help on this would be amazing. Thanks :)

2 comments

0

Make sure the script is disabled, and enable it after cloning. Or even better, put the script in StarterPlayerScripts, and enable it when necessary.

0

Ok so after its cloned, activate it?