Building Interactive Logic Trees Using Sliders

I am working on a project where I am trying to implement a decision tree with different endpoints on a single page.
For this I use a slider and display on the next slides only the option that was selected on the previous slide.
With more than 40 questions my project becomes very confusing, especially because I have to create more interactions for each question.
Is there a better way to show the follow-up question and hide all other content when an answer choice is selected?
I am looking forward to feedback