Waterpipe placing system

Hey hey, was wondering if anyone knew the best way to go about a pipe placing system. Its for a puzzle game for a school project and was wondering how to start on it. For now i have a grid placement system where i can place down prefabs.

Followed this tutorial:

The stuff i wanna make right now is that there is a starting pipe where water would come out off, when there is a pipe attached to it that is facing the correct way (entrance of the placed pipe is at the exit of the starting pipe) water should flow through it and go toward the exit of that pipe and so on. anyone got any ideas on what stuff i should be looking for or either a tutorial as well.