How can I remove a tool from the player’s backpack?

Hello devs ! Am actually trying to remove all tools at the start of a round but that not working.

Someone can help me?

Script here :

local intermission = 25
local roundLength = 150

local inRound = game.ReplicatedStorage.InRound
local staus = game.ReplicatedStorage.Status

inRound.Changed:Connect(function()

	if inRound.Value == false then

		for i, plr in pairs(game.Players:GetChildren()) do

			local char = plr.Character
			local humanRoot = char:WaitForChild("HumanoidRootPart")

			humanRoot.CFrame = game.Workspace.lobbySpawn.CFrame
			
			
			
			game.Workspace.Legendary_Chest.Union:Destroy()
			game.Workspace.Legendary_Chest.Part:Destroy()
			game.Workspace.Legendary_Chest.Logo:Destroy()
			game.Workspace.Legendary_Chest.Open:Destroy()
			
			game.Workspace.Rare_Chest.Union:Destroy()
			game.Workspace.Rare_Chest.Part:Destroy()
			game.Workspace.Rare_Chest.Logo:Destroy()
			game.Workspace.Rare_Chest.Open:Destroy()
			
			game.Workspace.Epic_Chest.Union:Destroy()
			game.Workspace.Epic_Chest.Part:Destroy()
			game.Workspace.Epic_Chest.Logo:Destroy()
			game.Workspace.Epic_Chest.Open:Destroy()
			
			game.Workspace.Common_Chest.Union:Destroy()
			game.Workspace.Common_Chest.Part:Destroy()
			game.Workspace.Common_Chest.Logo:Destroy()
			game.Workspace.Common_Chest.Open:Destroy()

		end	
	end	
end)
	
local function round()
	while true do
		
		
		
		local requiredPlayers = 2

		repeat
			wait(1)
			staus.Value = " ".. requiredPlayers.." players needed to play."

		until #game.Players:GetChildren() >= requiredPlayers
		
		inRound.Value = false		

		for i = intermission, 0, -1 do

			staus.Value = "Game will start in "..i.." seconds"

			wait(1)
			
			
			
			
		end
		
		game.ReplicatedStorage.Boxs.Common:Clone().Parent = workspace
		game.ReplicatedStorage.Boxs.Epic:Clone().Parent = workspace
		game.ReplicatedStorage.Boxs.Legendary:Clone().Parent = workspace
		game.ReplicatedStorage.Boxs.Rare:Clone().Parent = workspace
		
		inRound.Value = true		
		
		
		
		wait(3)
		
		
		
		for i = roundLength, 0, -1 do

			wait(1)
			
			
			
			staus.Value = "Game will end in "..i.." seconds"
			
			
			
			local playing = {}
			
			
			for i, plr in pairs(game.Players:GetChildren()) do
				
				

				if plr.Team.Name == "Playing" then
					
					table.insert(playing, plr.Name)
					print("inserted player")
					
					
					
				end	
			end
			
			
			
			if #playing == 0 then
				staus.Value = "Everyone Has Died"
				wait(3)
				break
			en	
		end
	end
end
spawn(round)

-Tnks for your help.

1 Like
Player.Backpack.ToolName:Destroy()

Also you should be using task.wait.

3 Likes

the problem with your script is that it only targets one tool “specific name” I would like to remove everyone’s tools .

1 Like

You didn’t specify more than one, but you can just use Player.Backpack:ClearAllChildren() then.

Nvm, I only read the title.

1 Like

The script to check player is this ? :

local Players = game:GetService("Players")
1 Like

Not sure what you’re asking, but this is what I meant:

local intermission = 25
local roundLength = 150

local inRound = game.ReplicatedStorage.InRound
local staus = game.ReplicatedStorage.Status

inRound:GetPropertyChangedSignal('Value'):Connect(function()

	if not inRound.Value then

		for i, plr in pairs(game.Players:GetChildren()) do
			pcall(function()
				plr.Backpack:ClearAllChildren()
				local char = plr.Character
				local humanRoot = char:WaitForChild("HumanoidRootPart")

				humanRoot.CFrame = game.Workspace.lobbySpawn.CFrame

				game.Workspace.Legendary_Chest.Union:Destroy()
				game.Workspace.Legendary_Chest.Part:Destroy()
				game.Workspace.Legendary_Chest.Logo:Destroy()
				game.Workspace.Legendary_Chest.Open:Destroy()

				game.Workspace.Rare_Chest.Union:Destroy()
				game.Workspace.Rare_Chest.Part:Destroy()
				game.Workspace.Rare_Chest.Logo:Destroy()
				game.Workspace.Rare_Chest.Open:Destroy()

				game.Workspace.Epic_Chest.Union:Destroy()
				game.Workspace.Epic_Chest.Part:Destroy()
				game.Workspace.Epic_Chest.Logo:Destroy()
				game.Workspace.Epic_Chest.Open:Destroy()

				game.Workspace.Common_Chest.Union:Destroy()
				game.Workspace.Common_Chest.Part:Destroy()
				game.Workspace.Common_Chest.Logo:Destroy()
				game.Workspace.Common_Chest.Open:Destroy()
			end)
		end	
	end	
end)

local function round()
	while true do

		local requiredPlayers = 2

		repeat
			task.wait(1)
			staus.Value = " ".. requiredPlayers.." players needed to play."

		until #game.Players:GetChildren() >= requiredPlayers

		inRound.Value = false		

		for i = intermission, 0, -1 do

		end
		staus.Value = "Game will start in "..i.." seconds"

		task.wait(1)

	end

	game.ReplicatedStorage.Boxs.Common:Clone().Parent = workspace
	game.ReplicatedStorage.Boxs.Epic:Clone().Parent = workspace
	game.ReplicatedStorage.Boxs.Legendary:Clone().Parent = workspace
	game.ReplicatedStorage.Boxs.Rare:Clone().Parent = workspace

	inRound.Value = true		

	task.wait(3)



	for i = roundLength, 0, -1 do

		task.wait(1)



		staus.Value = "Game will end in "..i.." seconds"



		local playing = {}


		for i, plr in pairs(game.Players:GetChildren()) do



			if plr.Team.Name == "Playing" then

				table.insert(playing, plr.Name)
				print("inserted player")



			end	
		end



		if #playing == 0 then
			staus.Value = "Everyone Has Died"
			task.wait(3)
			break
			en	
		end
	end
end
spawn(round)

(Also not that it really matters, but you have a lot of empty line spacing.)

1 Like