Gather materials: 4 string, 1 slimeball, 3 iron ingots
Craft a lead in a crafting table
Place 4 string in the pattern: top row 2 strings, middle row 1 string left and 1 string right, bottom row 1 string in the center
Place 1 slimeball in the center of the middle row
Place 3 iron ingots in a straight line across the bottom row
Take the lead from the output slot
Use the lead by right-clicking a mob to attach it
Detach by right-clicking the mob again or breaking the lead connection by moving away while holding the lead
