Is there a way to make a tool that you're holding unequip when you die?
local Players = game:GetService("Players")
local ContextActionService = game:GetService("ContextActionService")
local localPlayer = Players.LocalPlayer
game:GetService('Players').PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character:WaitForChild("Humanoid").Died:Connect(function()
if localPlayer.Character then
local humanoid = localPlayer.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid:UnequipTools()
print(player.Name .. " has died!")
end
end
end

4 comments
If the player dies. that makes them un-equip the tool. (since the tool doesn't function when the player dies)
Alright. So what's the problem here?
What i'm trying to do is that if a player dies, the tool that they're holding un-equips automatically.
What you're telling me is that when a player dies, their tool is un-equipped. But then you're saying you're trying to make them unequip a tool when they die, which already happens?