How do I make a player equip a tool after its unequipped?

I am trying to make a player reequip a tool that was unequipped, like in Bad Business when the character climbs an object. How would I do that? How would I know the player’s previous tool?

This what I tried this but it did nothing

local contextActionservice = game:GetService("ContextActionService")
local plr = game.Players.LocalPlayer
local Character = plr.Character or plr.CharacterAdded:Wait()
local Hum = Character:WaitForChild("Humanoid")

contextActionservice.LocalToolUnequipped:Connect(function(weapon1)
	print(weapon1)
	wait(.2)
	hum:EquipTool(weapon1)
end)

I tried to see if the game would print the tools name, but it did nothing.

local plr = game.Players.LocalPlayer
local Character = plr.Character or plr.CharacterAdded:Wait()
local Hum = Character:WaitForChild("Humanoid")

plr.Backpack.ChildRemoved:Connect(function(Child)
	print(Child)
	wait(.2)
	hum:EquipTool(Child)
end)

Or, with your climbing mechanics, you could use plr.Character:FindFirstChildWhichIsA(“Tool”) and then store that tool.

Your original script works perfectly fine, it’s just that you have a typo with ‘hum’. You just need to fix the capitalization.

2 Likes