local RS = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Folder = RS:WaitForChild("D6Items")
script.Parent.Activated:Connect(function()
local Tools = Folder:GetChildren()
local ToolsTable = Tools
local chosenTools = {}
repeat
local selectedIndex = math.random(1, #ToolsTable)
table.insert(chosenTools, ToolsTable[selectedIndex].Name)
table.remove(ToolsTable, selectedIndex)
until #chosenTools >= 1
local plr = Players:GetPlayerFromCharacter(script.Parent.Parent)
for i,v in pairs(chosenTools) do
Folder:FindFirstChild(v):Clone().Parent = plr.Backpack
end
end)
local RS = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Folder = RS:WaitForChild("D6Items")
script.Parent.Activated:Connect(function()
local Tools = Folder:GetChildren()
local ToolsTable = {}
local chosenTools = {}
for Index, Tool in ipairs(Tools) do
if Tool:IsA("Tool") then
table.insert(ToolsInTable, Tool)
end
end
repeat
local selectedIndex = math.random(1, #ToolsTable)
table.insert(chosenTools, ToolsTable[selectedIndex].Name)
table.remove(ToolsTable, selectedIndex)
until #chosenTools >= 1
local plr = Players:GetPlayerFromCharacter(script.Parent.Parent)
for i,v in ipairs(chosenTools) do
Folder:FindFirstChild(v):Clone().Parent = plr.Backpack
end
end)