Doing everything but cloning tools into backpack

The title is what the problem is. This was working before and now its broken for some reason. I have a script that handles my game rounds but it doesn’t clone the tools inside the players folders. I checked and the players have tools in their folders but it’s not being cloned into the backpack.

The cloning action is next to Wait(3)
Script:


local function round()	
	while true do
		repeat
			wait(1)
			Status.Value = "Missing Two Players ):"	
		until #game.Players:GetChildren() >= 2
		InRound.Value = false
		for i = Interval, 0, -1 do
			Status.Value = "Starting in: "..i
			wait(1)
		end
		InRound.Value = true
		BlueCount = {}
		RedCount = {}
		wait(3)
		for _, plr in pairs(game.Players:GetChildren()) do
			if plr:FindFirstChild("Inventory") and plr.Team == game.Teams.Runner then
				for i,tool in pairs(plr:FindFirstChild("Inventory"):GetChildren()) do
					if tool:IsA("Tool") then
						tool.Parent = plr.Backpack
						plr:FindFirstChild("ToolSave")[tool.Name].Value = false
					end
				end
			end
			if plr:FindFirstChild("KillerInventory") and plr.Team == game.Teams.Killer then
				for i,tool in pairs(plr:FindFirstChild("KillerInventory"):GetChildren()) do
					if tool:IsA("Tool") then
						tool.Parent = plr.Backpack
						plr:FindFirstChild("ToolSave")[tool.Name].Value = false
					end
				end
			end
		end
		for i = RoundTime, 0, -1 do
			wait(1)
			local t = TFM:Convert(i, "Default", true)
			Status.Value = "Game will end in "..t.." "
			--local playing = {}
			RemainderBlue = {}
			RemainderRed = {}
			for _, plr in pairs(game.Players:GetChildren()) do
				if plr.Team == Blue then
					if i == RoundTime then
						table.insert(BlueCount,plr.Name)
					end
					table.insert(RemainderBlue,plr.Name)
				elseif plr.Team == Red then
					if i == RoundTime then
						table.insert(RedCount,plr.Name)
					end
					table.insert(RemainderRed, plr.Name)
				end	
			end
			
			if #RemainderRed == 0 and i == 0 then
				wait(1)
				for i,players in pairs(game:GetService("Players"):GetChildren()) do
					players.Character.Humanoid.Health = 0
					if players.Team == game.Teams.Runner or players.Team == game.Teams.Killer then
						players.leaderstats.Bolts.Value += 25
						players.leaderstats.Exp.Value += 25
					end
				end
				wait(2)
				Status.Value = "Both Teams Lost!"
				break
				
			elseif #RemainderRed == 0 or i == 0 then
				wait(1)
				for i,players in pairs(game:GetService("Players"):GetChildren()) do
					players.Character.Humanoid.Health = 0
					if players.Team == game.Teams.Runner then
						players.leaderstats.Bolts.Value += 25
						players.leaderstats.Exp.Value += 25
					end
				end
				wait(2)
				Status.Value = "The Runners Have Won!"
				break
			elseif #RemainderBlue == 0 then
				wait(1)
				for i,players in pairs(game:GetService("Players"):GetChildren()) do
					players.Character.Humanoid.Health = 0
					if players.Team == game.Teams.Killer and #Players:GetChildren() > 1 then
						players.leaderstats.Bolts.Value += 50
						players.leaderstats.Exp.Value += 75
					end
				end
				wait(2)
				Status.Value = "The Killer Has Won!"
				break
			end
		end
		for i, plr in pairs(game.Players:GetChildren()) do
			if plr.Character:FindFirstChild("Bear Trap") or plr.Backpack:FindFirstChild("Bear Trap") then
				if plr.Backpack:FindFirstChild("Bear Trap") then
					plr.Backpack:FindFirstChild("Bear Trap").Parent = plr.Inventory
				end
				if plr.Character:FindFirstChild("Bear Trap") then
					plr.Character:FindFirstChild("Bear Trap").Parent = plr.Inventory
				end
			else
				plr.ToolSave["Bear Trap"].Value = false
			end
		end
		wait(2)
		ReplicatedService.GameEvents.RoundEnd:FireAllClients(BlueCount,RemainderBlue,RedCount,RemainderRed)
		if workspace:FindFirstChild("Music") then
			workspace:FindFirstChild("Music").SoundId = "rbxassetid://11470082105";
		end
		for i,v in pairs(workspace:GetChildren()) do
			if v.Name == "BearTrap" then
				v:Destroy()
			end
		end
		wait(6)
	end
end

spawn(round)

I think you can do this :

local function round()	
	while true do
		repeat
			wait(1)
			Status.Value = "Missing Two Players ):"	
		until #game.Players:GetChildren() >= 2
		InRound.Value = false
		for i = Interval, 0, -1 do
			Status.Value = "Starting in: "..i
			wait(1)
		end
		InRound.Value = true
		BlueCount = {}
		RedCount = {}
		wait(3)
		for _, plr in pairs(game.Players:GetChildren()) do
			if plr:FindFirstChild("Inventory") and plr.Team == game.Teams.Runner then
				for i,tool in pairs(plr:FindFirstChild("Inventory"):GetChildren()) do
					if tool:IsA("Tool") then
                        local ClonedTool = tool:Clone()
						ClonedTool.Parent = plr.Backpack
						plr:FindFirstChild("ToolSave")[tool.Name].Value = false
					end
				end
			end
			if plr:FindFirstChild("KillerInventory") and plr.Team == game.Teams.Killer then
				for i,tool in pairs(plr:FindFirstChild("KillerInventory"):GetChildren()) do
					if tool:IsA("Tool") then
						tool.Parent = plr.Backpack
						plr:FindFirstChild("ToolSave")[tool.Name].Value = false
					end
				end
			end
		end
		for i = RoundTime, 0, -1 do
			wait(1)
			local t = TFM:Convert(i, "Default", true)
			Status.Value = "Game will end in "..t.." "
			--local playing = {}
			RemainderBlue = {}
			RemainderRed = {}
			for _, plr in pairs(game.Players:GetChildren()) do
				if plr.Team == Blue then
					if i == RoundTime then
						table.insert(BlueCount,plr.Name)
					end
					table.insert(RemainderBlue,plr.Name)
				elseif plr.Team == Red then
					if i == RoundTime then
						table.insert(RedCount,plr.Name)
					end
					table.insert(RemainderRed, plr.Name)
				end	
			end
			
			if #RemainderRed == 0 and i == 0 then
				wait(1)
				for i,players in pairs(game:GetService("Players"):GetChildren()) do
					players.Character.Humanoid.Health = 0
					if players.Team == game.Teams.Runner or players.Team == game.Teams.Killer then
						players.leaderstats.Bolts.Value += 25
						players.leaderstats.Exp.Value += 25
					end
				end
				wait(2)
				Status.Value = "Both Teams Lost!"
				break
				
			elseif #RemainderRed == 0 or i == 0 then
				wait(1)
				for i,players in pairs(game:GetService("Players"):GetChildren()) do
					players.Character.Humanoid.Health = 0
					if players.Team == game.Teams.Runner then
						players.leaderstats.Bolts.Value += 25
						players.leaderstats.Exp.Value += 25
					end
				end
				wait(2)
				Status.Value = "The Runners Have Won!"
				break
			elseif #RemainderBlue == 0 then
				wait(1)
				for i,players in pairs(game:GetService("Players"):GetChildren()) do
					players.Character.Humanoid.Health = 0
					if players.Team == game.Teams.Killer and #Players:GetChildren() > 1 then
						players.leaderstats.Bolts.Value += 50
						players.leaderstats.Exp.Value += 75
					end
				end
				wait(2)
				Status.Value = "The Killer Has Won!"
				break
			end
		end
		for i, plr in pairs(game.Players:GetChildren()) do
			if plr.Character:FindFirstChild("Bear Trap") or plr.Backpack:FindFirstChild("Bear Trap") then
				if plr.Backpack:FindFirstChild("Bear Trap") then
					plr.Backpack:FindFirstChild("Bear Trap").Parent = plr.Inventory
				end
				if plr.Character:FindFirstChild("Bear Trap") then
					plr.Character:FindFirstChild("Bear Trap").Parent = plr.Inventory
				end
			else
				plr.ToolSave["Bear Trap"].Value = false
			end
		end
		wait(2)
		ReplicatedService.GameEvents.RoundEnd:FireAllClients(BlueCount,RemainderBlue,RedCount,RemainderRed)
		if workspace:FindFirstChild("Music") then
			workspace:FindFirstChild("Music").SoundId = "rbxassetid://11470082105";
		end
		for i,v in pairs(workspace:GetChildren()) do
			if v.Name == "BearTrap" then
				v:Destroy()
			end
		end
		wait(6)
	end
end

spawn(round)

If I clone the tool it will stack when the player buys it again. So I can’t do that.

1 Like

You can set a variable that say if the player have already buy it !

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.