#Setting up Towny Balance Requirement

1 messages · Page 1 of 1 (latest)

split nexus
#

Hello, I'm currently trying to set up a menu which allows players to purchase things using their towns balance from Towny.

Just not really sure how to properly check the value of a towns balance, the placheholder I have is spitting out the towns balance, but for some reason it just says it's denied even when a towns balance meets this requirement

  'TownBonusChunks':
    material: GOLDEN_SHOVEL
    slot: 12
    priority: 1
    model_data: 10299
    display_name: '&6&l&lExtra Claims'
    lore:
      - '&8Perk'
      - '&7⭑⭑⭑⭑⭑'
      - '&5&oApplies the perk: Extra Claims'
      - '&5&oPermanently!'
      - ' '
      - '&5&oCosts: &e&l2000&e&l¥ &r&eYen'
    click_commands:
    - '[console] townyadmin town %townyadvanced_town_unformatted% withdraw 2000'
    - '[console] townyadmin town %townyadvanced_town_unformatted% giveboughtblocks 1'
    - '[message] &7[&a&l!&7]&a You bought an extra claim block for 2000 Yen'
    - '[console] av User %player_name% ForceReward Firework'
    - '[close]'
    click_requirement:
      requirements:
        money: # This requirement will check if the player has $2000 and if they don't, it won't allow them to click this item.
          type: javascript
          expression: '%townyadvanced_town_balance_unformatted% < 2000'
          deny_commands:
          - '[message] %townyadvanced_town_balance_unformatted%'
          - '[message]&cYour town doesn''t have enough money!'
          - '[close]'

Any help would be appreciated ❤️

#

it's prnting the town balance as 4980, but it still says it doesn't have enough even though that number is clearly over 2000

signal mauve
#

your javascript seems backwards, making sure the balance is under 2000

#

but also you should avoid javascript and instead use comparator type

split nexus
#

This works perfectly ❤️