I have a localscript that is inside a player's character. When the player's character dies its supposed to print("Died"), unequip the tool it is holding and fire a remote event. However what happens is that when the character dies, it says attempt to call a nil value. Could someone tell me why it says this?
local plr = game.Players.LocalPlayer
local char = plr.Character
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Attack = ReplicatedStorage:WaitForChild("StarterToolsOnDeath")
if char.Humanoid.Died:Connect() then
print("Died")
game.ReplicatedStorage:FindFirstChild("StarterToolsOnDeath"):FireServer(char)
char.Humanoid:UnequipTools()
end

2 comments
the error simply means the function does not have an argument. in this case, you didn't connect your function.
either do what @EnzoTDZ_YT said in the answer, or remove the :connect() in line 8