When running a command like
execute unless function skills:chances/1in3 run scoreboard players add @s skill_carpentry 1
from inside a function the return value of the tested function is not checked. The command will be executed whether it is 0 or not. Only success is used.
The called function (skills:chances/1in3) is:
return run random roll 0..2
When this command is run in chat, it works as expected and the command is only run if the returned value is 0.
It's not super clear what the issue is here.
return fail
is the intended way to make a function fail for purposes ofif function