I'm going to assume RecipeGUI isn't inside PlayerGui before the gun is equipped. That's probably where the error is coming from. Also, I would just keep RecipeGUI in PlayerGui at all times and just enable it when the tool is equipped:
01 | local player = game.Players.LocalPlayer |
02 | local gui = player.PlayerGui.RecipeGUI |
06 | script.Parent.Equipped:connect( function (mouse) |
10 | script.Parent.Unequipped:connect( function (mouse) |
If this helped, please accept the answer :). If not, then comment what's not working and I'll try to help you.