How can I copy a script into multiple objects?

I would like to make it possible for one script to copy another script into multiple objects.

local KiS = game.ServerStorage.tran.KiS:Clone()
local Children = game.ReplicatedStorage.ShopTools:GetChildren()

		for i = 1, #Children do
			KiS.Parent = Children[i]
		end

That was my first approach / attempt that unfortunately did not work.
Unfortunately, I no longer know what to do and would appreciate an answer.

Move your KiS variable into your for loop – this will clone the script for each child you’re wanting to copy it into

local Children = game.ReplicatedStorage.ShopTools:GetChildren()

		for i = 1, #Children do
			local KiS = game.ServerStorage.tran.KiS:Clone()
			KiS.Parent = Children[i]
		end
2 Likes

Thank you very much it worked! :slight_smile:

1 Like