how do I get blocks to teleport in minecraft [closed]

Solution 1:

Blocks are static and cannot be teleported as entities. This means that you will have to manually animate the gate using /fill, /setblock and/or /clone. Take a look at this tutorial on how to animate builds:

.

For the minecart detection, you can detect the minecart at some specific coordinates where the rails go:

/execute if entity @e[type=minecart,x=,y=,z=,distance=..1] run <trigger_animation>

fill in the coordinates and replace "trigger_animation" with how you want to trigger your animation (the classic way is to /setblock a redstone block).