What does it say? If it's giving you the error you don't have the permission, then you are in fact NOT op. How to turn on KeepInventory
- Ensure you're opped. If you are, when doing the /gamerule command NO error message should appear.
- If you are opped, do /gamerule keepInventory true
Capitals are important. All gamerules are case sensitive. Ensure that 'keep' is all lowercase, but that 'Inventory' remains with an uppercase i.
If it still does not work, send images of the error message you receive. IF you enable keepInventory and there is no error, but it just doesn't work, try restarting your server and trying again.