Skip to content

How to create a claim button (faucet)

This guide shows you how to set up a button in your bot that changes a user's balance. As an example, we will use a button called Claim that will increase a user's balance by 1 each time they press it.


What will we do?

When a user presses the button:

  1. Their balance will increase by 1.
  2. They will receive a message confirming the change and showing their new balance.

Prerequisites

  1. Premium subscription: These settings require the use of actions, a feature exclusive to the premium subscription in VisualMaker.
  2. Required actions:
    • Change variable: Allows you to save and modify data in variables. In this case, we will increment the balance variable.
    • Send message: To send a message to the user.

Steps to configure the balance change

1. Enter edit mode and select the button

  1. Go to your bot and press 🛠 Edit.
  2. Select the button you want to configure, in this case, Claim. Or create it if you haven’t done so yet.
  3. Press Actions 🌟 to enter the actions menu.

2. Add the action to change the balance

  1. Add an action of type Change variable.
  2. Press Configure 🛠 to set it up.
  3. Press 💠 Select variable 💠 and enter the name of the variable (in this case, balance).
  4. Press 🔺 Increment 🔺 to increase the value of the variable.
  5. Enter 1 to increase the balance by 1.

    If you want to decrease the balance, enter a negative number, such as -1.


3. Send a message to the user

  1. Create another action of type Send message.
  2. Press Configure 🛠 and save the message the user will receive.

    • Example message:
      ✅ Your balance has increased by 1.
      
      💰 You now have a total of {balance} coins.
      
      (Use {balance} to display the current value of the variable balance to the user).

4. Activate the actions

  1. Go back to the button's actions list.
  2. Ensure that both actions (change variable and send message) are active.

Done!

When a user presses the Claim button, their balance will increase by 1 and they will see a message like this:

Example of balance change


More tips

  • Use "Increment" to add or subtract values:

    The 🔺 Increment 🔺 option is used to increase or decrease the variable's value. In this guide, we used it to add 1, but you could also subtract using negative numbers like -5. It's useful for dynamically updating balances.

  • Use "Set" for fixed values:

    If you need to assign a specific value to a variable, choose the 💢 Set 💢 option instead of 🔺 Increment 🔺. For example, if you want the balance to always be 100 when the button is pressed, use this option and enter 100.

  • Update another user's balance:

    If you need to change the balance of another user (not the one pressing the button), you can enable the 👤 To other user 👤 option when configuring the Change variable action. You just need to enter the ID or @username of the other user.