Function command doesn't work

Function command doesn't work - Black Screen With Code

I'm trying to make a datapack and a I have a function and when I call it normally within code or Minecraft it works fine and if I run the command execute as @e[tag=robot] if block ~ ~-1 ~ air run function robot:simulate_gravity in the code it doesn't work but inside Minecraft when I call it from the chat it does work.

Any ideas why?

Pictures about "Function command doesn't work"

Function command doesn't work - Close Up Photo of Computer Codes
Function command doesn't work - Smiling African American waitress wearing casual t shirt and apron standing at counter in cozy coffee shop with female customer while serving hot drink and looking at each other
Function command doesn't work - Focused young businesswoman working remotely at home

Why command block is not working?

You may find that the commands you are trying to have the command block execute are not working. This may be due to the certain limitations the block has on what commands it can run successfully. Command Blocks will execute commands with an OP level 2 permissions.

How do you run a function in Minecraft?

How to Enter the Command
  • Open the Chat Window. The easiest way to run a command in Minecraft is within the chat window.
  • Type the Command. In this example, we will run the function called give_diamond.mcfunction in Minecraft Java Edition (PC/Mac) 1.12 with the following command: /function digminecraft:give_diamond.

  • Minecraft Tutorial: How to Make Functions and Datapacks

    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: Antonio Batinić, Markus Spiske, Andrea Piacquadio, Vlada Karpovich