The bone burying works. And that part looks okay. If inventory contains bones, bury them , else blah blah.
edit. My mistake. The other “if” else if, if. Part.
the bones just aren’t rs2objects they are ground items. Also consider &&getMap.canReach so you aren’t spamming bones that are on the other side of the fence.