RPG can mean different things, so there are many ways to make an RPG cyoa.
Thinking about how you want the storygame to play will determine how you want to code it.
A storygame isn't a videogame, and so just clicking a button to 'attack' and watch the enemy HP go down is often very dull.
Look at these two storygames:
Both have the RPG tag, and both have stats (and both are good!). Yet the way you'd make each one is different!
Here's another good example:
Here: Help & Info, focus on the Advanced Editor and Scripting articles.
Under properties, below 'Editor Features', click '[change editor features]' and set everything to the most advanced. Then just mess around in this storygame trying to create systems and put into action the things the articles talked about.
An RPG is about more than just the 'game'. Without some sort of compelling story the systems serve no purpose.
This doesn't mean you have to go full-blown epic fantasy about stopping some ancient evil. The story can be light, or about what the reader creates for themselves based on what happens, but this only works if the system is complicated enough to support it (and creating a complicated system that is good is a lot harder than it sounds).
The story can also inform you about what the system should be.
A small RPG is much easier to write and you can learn a lot from doing it (both in regard to scripting and story writing).
How will the RPG work? Is it like Delve!? More like The Price of Freedom? Something entirely different? Think about it!
If you are trying to do something and can't figure it out, ask. Someone might be able to help. That said, it should be obvious that spamming questions and so having someone write your entire RPG system is probably not going to work!
Getting feedback early once you have the system built and something that happens might be good, in case your system has some major flaws you overlooked. Revising an entire system when you have half the story written would be a massive pain (so consider planning more than usual).
Learn the basics of variables and scripting, and figure out how you want to style your RPG.
That'll inform how you'll go about solving the problems that arise (i.e. how should you code "I want to deal damage to the enemy when I attack", there are many ways, but the best way will depend on the surrounding context).
Planning more might also be helpful, since when writing an RPG, revising the system is more difficult than just revising the text.