Is there a way I can implement a tool remove in my revive feature

Okay so im making a revive feature for my game and im not really sure how i can implement something that removes the tools when the player is downed. so for example a person is downed and they can still pull out a weapon and attack people in a downed state. so is there i way i can make it so you cant equip tools?

game.Players.PlayerAdded:Connect(function(p)
	p.CharacterAdded:Connect(function(c)
		
		local RequiredHealthToBeDowned = 25
		local bleeddamagewhiledown = 0.05
		local resethealthto100ondown = false
		local Canmovewhendown = false
		local downwalkspeed = 3.5
		local Screamingenabledwhiledown = true
		local Needreviveguienabled = true
		
		local humanoid = c:WaitForChild("Humanoid")

		repeat wait()

		until humanoid

		local robloxhealthscript = c:WaitForChild("Health")
		
		local fallid = 
		local fallani = Instance.new("Animation")
		fallani.AnimationId = "http://www.roblox.com/Asset?ID="..fallid
		local fallanimation = humanoid:LoadAnimation(fallani)
		
		
		local downid = 
		local downani = Instance.new("Animation")
		downani.AnimationId = "http://www.roblox.com/Asset?ID="..downid
		local downanimation = humanoid:LoadAnimation(downani)
		

		
		
		local isdown = Instance.new("BoolValue")
		isdown.Value = false
		isdown.Parent = c
		isdown.Name = "isdown"
		
		local isbeingrevived = Instance.new("BoolValue")
		isbeingrevived.Value = false
		isbeingrevived.Parent = c
		isbeingrevived.Name = "isbeingrevived"
		
		
		local gotrevied = Instance.new("BoolValue")
		gotrevied.Value = false
		gotrevied.Parent = c
		gotrevied.Name = "gotrevied"
		
		
		local isdead = Instance.new("BoolValue")
		isdead.Value = false
		isdead.Parent = c
		isdead.Name = "isdead"
		
		local deb = false

		
		
	humanoid:GetPropertyChangedSignal("Health"):Connect(function()
		if humanoid.Health <= RequiredHealthToBeDowned and isdown.Value == false and deb == false then	
			if isdead.Value == false then
				isdown.Value = true
				fallanimation:Play()
					
				if Canmovewhendown == true then
					humanoid.WalkSpeed = downwalkspeed
					humanoid.JumpPower = 0
				else
					humanoid.WalkSpeed = 0
					humanoid.JumpPower = 0						
						
				end
					

				robloxhealthscript.Disabled = true
					
				if resethealthto100ondown == true then
					humanoid.Health = 100
				end
					
					
				local screams = game.ServerStorage:WaitForChild("Screams"):Clone()
				local helpgui = game.StarterGui:WaitForChild("HelpGui"):Clone()
				if Needreviveguienabled == true then
					helpgui.Parent = c.Head
					helpgui.Adornee = c.Head
					helpgui.Enabled = true	
				end


				wait(.5)
				deb = true
				if Screamingenabledwhiledown == true then
					screams.Parent = c.Head
					screams:Play()
				end

					
				
			end
		end
	end)
		
		
		
		isdown.Changed:Connect(function()
			while isdown.Value == true do
				
				wait(0.1)
				
				if deb == true then
					
					
					downanimation:Play()
					
				end
				
				if isbeingrevived.Value == true then
					
				else
					
					humanoid.Health = humanoid.Health - bleeddamagewhiledown
				end
				
				
			end
		end)
		
		
		gotrevied.Changed:Connect(function()
			if gotrevied.Value == true and isdown.Value == true then
				gotrevied.Value = false
				isdown.Value = false
				deb = false
				humanoid.WalkSpeed = 16
				humanoid.JumpPower = 50
				robloxhealthscript.Disabled = false
				if c.Head:FindFirstChild("Screams") then
					c.Head:FindFirstChild("Screams"):Destroy()
				end
				
				if c.Head:FindFirstChild("HelpGui") then
					c.Head:FindFirstChild("HelpGui"):Destroy()
				end
				
				if humanoid.Health < RequiredHealthToBeDowned then
					humanoid.Health = RequiredHealthToBeDowned + 5
				end
				
				if humanoid.Health > RequiredHealthToBeDowned then
					humanoid.Health = humanoid.Health + 5
				end
				
				
			end
		end)
		
		humanoid.Died:Connect(function()
			isdead.Value = true
			
			

			
			if c:FindFirstChild("isdown") then
				c:FindFirstChild("isdown"):Destroy()
			end
			
			if c:FindFirstChild("isbeingrevived") then
				c:FindFirstChild("isbeingrevived"):Destroy()
			end
			
			if c:FindFirstChild("gotrevied") then
				c:FindFirstChild("gotrevied"):Destroy()
			end
			
			wait(0.7)
			
			if c.Head:FindFirstChild("Screams") then
				c.Head:FindFirstChild("Screams"):Destroy()
			end

			if c.Head:FindFirstChild("HelpGui") then
				c.Head:FindFirstChild("HelpGui"):Destroy()
			end
			
			
			
			
		end)
		
		isbeingrevived.Changed:Connect(function()
			if isbeingrevived.Value == true and isdown.Value == true then
				humanoid.WalkSpeed = 0
				humanoid.JumpPower = 0
				
			elseif isbeingrevived.Value == false and isdown.Value == true then
				if Canmovewhendown == true then
					humanoid.WalkSpeed = downwalkspeed
					humanoid.JumpPower = 0
				else
					humanoid.WalkSpeed = 0
					humanoid.JumpPower = 0
					
					
				end
			end
			
		end)
		
		
	end)
end)

All tools that the player has will be in their backpack. If the player has the tool out when they are downed, it will be in their character.
Try to destroy the tools in the backpack, and then destroy tools in their character.

Source I got my info from:

okay, but then how would i implement it so if i were downed i wouldnt be able to equip?

because im kinda not sure on how to work with these kind of things

Either when the tool is added to the character (ancestrychanged event) move it to the backpack, or move everything in the backpack and character to a folder

how can I implement that into my code?

In the tool script just check if the holder is alive or dead, if dead call “UnequipTools()” on the dead holder’s Humanoid instance.

The problem is the revive animation and feature kicks in at a certain health not when you go to 0 health, so then how would the script work then when the player isn’t dead?

When the HealthChanged event fires, check the player’s health at that moment, and if it’s under the “down but not out” limit move the tools to the folder.

So then what would happen if the player gets revived?

Simple, just move the tools in the folder back to the backpack. Maybe a variable could be set for the player’s convenience which holds the name of the tool the player was holding at the time of getting knocked out, and then move that one to the character so it automatically equips.

Ah, alright I see. I’ll try this out right now, thank you!