Thanks for the help, you are a legend
So, does this take one tool from the folder, or all the tools from the folder, sorry if this is a stupid question
I got this
local players = game:GetService(“Players”)
local length = 60
local PlrsAlive = {}
players.PlayerAdded:Connect(function(plr)
plr:LoadCharacter()
end)
while true do
repeat wait(1) until players.NumPlayers >= 2
wait(30)
local Maps = game:GetService("ServerStorage").Maps:GetChildren()
local ChosenMap = Maps[math.random(1,#Maps)]
map = ChosenMap:Clone()
map.Parent = workspace
local spawns = map:FindFirstChild("Spawns"):GetChildren()
for i, player in pairs(players:GetChildren()) do
if player.character then
char = player.character
char:FindFirstChild("HumanoidRootPart").CFrame = spawns[i].CFrame + Vector3.new(0,10,0)
local tag = Instance.new("BoolValue",char)
tag.Name = "PlayerAlive"
table.insert(PlrsAlive, player)
end
end
if game:GetService('ServerStorage'):FindFirstChild('YOUR_HOLDING_FOLDERS', true):FindFirstChild(plr.Name) then
local folder = game:GetService('ServerStorage'):FindFirstChild('YOUR_HOLDING_FOLDERS', true):FindFirstChild(plr.Name)
if folder:FindFirstChildOfClass('Tool') then
folder:FindFirstChildOfClass('Tool'):Destroy()
local tool_clone = ('HOWEVER YOU PARENT YOUR TOOLS'):Clone().Parent == folder
end
else
local player_folder = Instance.new('Folder').Parent == game:GetService('ServerStorage'):FindFirstChild('YOUR_HOLDING_FOLDERS', true)
local tool_clone = ('HOWEVER YOU PARENT YOUR TOOLS'):Clone().Parent == player_folder
end;
--// Then this is how you would give the players their tools in game
for _, player in pairs(game:GetService('Players'):GetPlayers()) do --// Getting each of the players
if player:IsA('Player') then --// Making sure each player instance is actually a player
for _, folder in pairs(game:GetService('ServerStorage'):FindFirstChild('YOUR_TOOL_HOLDING_FOLDERS', true):GetChildren()) do --// Get all of the folders, replace the second string with your folder
if folder:IsA('Folder') then --// Making sure that folder is a folder
if string.lower(tostring(folder.Name)) == string.lower(tostring(player.Name)) then --// Converting both player name and folder name to lowercase and checking if they are the same
for _, tool in pairs(folder:GetChildren()) do --// Getting each tool in the folder
if tool:IsA('Tool') then --// Making sure that the tool is a tool
if player:FindFirstChild('Backpack', false) then --// Finding the players backpack
local tool_clone = tool:Clone().Parent == player:FindFirstChild('Backpack', false) --// Cloning the tool and setting the parent to the players backpack
end;
end;
end;
end;
end;
end;
end;
end;
for i = 0, length do
wait(1)
for x, player in pairs(players:GetChildren()) do
if player then
if player.Character then
if not player.Character:FindFirstChild("PlayerAlive") then
table.remove(PlrsAlive, x)
end
end
else
table.remove(PlrsAlive, x)
end
end
if #PlrsAlive < 2 then break end
end
for i, player in pairs(players:GetChildren()) do
for i, tool in pairs(player.Backpack:GetChildren()) do
tool:Destroy()
end
if player.Character:FindFirstChild("PlayerAlive") then
player.Character:FindFirstChild("PlayerAlive"):Destroy()
end
player:LoadCharacter()
end
map:Destroy()
end
is this correct
i just pasted it in to see if its correct