How can I give a player all the tools in a folder

so i have this script here and currently it only gives the player one of the items in the folder or multiple if i decide to but what i want to do is to make it so the script gives all of the tools and their is over 100+ tools in the folder so i’m wondering if there is a way i can make it so it gives all the tools in the folder?

here is the script

game:GetService('Players').PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(Message)
		if string.sub(Message, 1,11)  == "/e all" and whitelist[Player.Name] then
			local all = game.ServerStorage.ClassSkills:Clone() -- this is the line line of code i want to give all 
			all.Parent = Player.Backpack
		elseif string.sub(Message, 1,11)  == "/e meat" and whitelist[Player.Name] then 
			local M = game.ServerStorage.Meat:Clone()
			M.Parent = Player.Backpack
		end
	end)
end)
``

Put them in the StarterPack folder.

But if you want a chat command that gives all the tools then:

local players = game:GetService("Players");

players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(message)
		if message:lower() == "/getTools" then
			for _, tool in pairs(folder:GetChildren()) do
				tool:clone().Parent = player.Backpack;
			end
		end
	end)
end)

use a for loop to iterate through all the tools and just parent them to the player’s backpack. something like this. I am assuming ClassSkills is a folder that has tools in it.

for i, tool in pairs(game.ServerStorage.ClassSkills:GetChildren()) do
   ClonedTool =  tool:Clone()
   ClonedTool.Parent = Player.Backpack
end
1 Like