Someones already given you a great example, so I’ll give you a quick explanation.
Essentially what you do is you write a transpiler, which is a translator for code to translate one language into another. In this case, your language is blocks which you want to convert into lua code. It can be quite a bit of work depending on how smart you do it, and there’s several methodologies.
Depending on the use case, the proper way to do it differs a little. Most simply and the way transpilation usually works is you would code the blocks in such a way that they have a string representation of some lua code associated with them, and then add that all together in order to get a string that can be run by loadstring.
A more game like implementation would be to create a sort of block object which everything can inherit from, this block object then has a function that can be run and inside that function is whatever relevant lua code you need to execute for that blocks behavior. If you choose this approach I’d recommend not trying to make it overly OOP like where you have a bunch of inheritance going on and objects get nested several inheritance levels deep.
To have success with this method, you need to think about what’s at the core of most programming. What are we working with? And how you can represent these things with blocks. For example variables, conditions, functions, data types.
I’d say it’s easier to get started with the second method, but much much harder to do it well. The first method is more akin to how compilers and transpilers are actually written, and not too difficult once you understand these things.
EDIT: Just noticed that the above plugin is discontinued and priced at 100000 robux, heres a link to another one BlockLua | The blazingly fast visual scripting plugin for Roblox. Code with blocks, like in Scratch!