In this guide I will be showing you how to create a bank system where players can deposit whatever amount of money they want, or withdraw it, again, choosing the amount each time. This does require a fair understanding of blocks and properties, but other than that it is pretty easy to understand.
(This is for just the deposit system. The withdrawal system is basically the same thing with a few changes (which I will show). With the exception of the Inventory Item Manager and Properties, you will need double the rest to make both the deposit and withdrawal system)
1x Inventory Item Manager
1x Item Granter
First, place down an inventory item manager managing your currency (in my case, cash). Then, create a property named Money. Make sure it is a number property, and set the scope to player. Now make the inventory item manager update the Money property. This will just make it so the Money property is always tracking the amount of money the player has.
Place down another property, and name it Bank Money. This is the property that will store all of the player’s money that’s in the bank. Make it a number property, and set the scope to player.
Alright, now we will get started with the Deposit system. Place down yet another property (last one I promise), and name it Deposit/Withdrawal Amount. Again, make it a number property, and set the scope to player. This will store the amount that the player wants to deposit/withdraw.
Place down some text, and 4 buttons underneath it. The text should show 0. We will come back to the text to put some blocks in later.
Next, make the buttons display different number amounts. Three should be positive, one should be negative. It depends on your game for what these numbers should be, but in my game you get a decent amount of money, so I made the button amounts +50, +100, +500, and -100. These are the buttons the player presses to adjust the overall number (which will be displayed on the text) until it gets to the amount of money they wish to deposit.
As for the settings of the buttons, this is what one of them looks like:
The only thing that should change from button to button is the Button Message, and the Channel it’s Transmitting on.
This is what the overall setup should look like so far:
The three buttons at the top are +50, +100, and +500, while the bottom one is the -100, in case they accidentally made their number too high and wanted to bring it down.
Alright, now make sure each button is transmitting on a different channel, preferably with the number in the channel (so you can distinguish them). Now back to the text, where we will make 4 different blocks, one for each button. This is what the blocks should look like:
That was for the +100 button.
Here’s the block for the -100 button.
Hopefully you can see what it’s doing, but if you pressed the +100 button, it would add 100 to the Deposit/Withdrawal property, and then updating the text so the player can see the change. This way the player can use the buttons to tweak the number until it is at the amount they wish to deposit.
Ok, now place one more button off to the side, and place a text above it. All you have to do for the text is make it say “Done”. This creates the Done Button, the button players press when they’ve reached the number they wish to deposit into their bank account.
Great, now place down an item granter, and wire the button to the item granter. Button pressed → Run Wire Pulse Block. Make the item granter grant your currency (in my case cash), and create a block On wire pulse.
This is what the block should look like:
Ok, let’s go through what is happening here. First, the block checks that you really do have enough money to deposit. If you do, it adds your deposit amount to your bank money. Then, it takes away that amount of money from you. After that, it resets the Deposit/Withdraw Amount property, and finally sends on channel Deposit Complete.
Ok, now place down two notification devices. Make one send when receiving on “Deposit Complete”, and the other receive on “Not enough money”, the channel that sends if you don’t have enough money.
This is what I made the messages look like for each:
Deposit complete notification:
Not enough money notification:
These notifications just alert the player if A, their deposit was successful, or B, if they don’t have enough money to deposit that amount. If they don’t have enough money, they can just adjust the amount on the text until it is a valid number.
Oh, and one more thing, add one more block to the text that shows the deposit amount.
That one. Make the block activate when receiving on “Deposit Complete”, and make it look like this:
Just as simple as that, this resets the text when the deposit has been completed.
And real quick, the withdrawal system is the same except with some minor changes, if you want to see each of the changes, click here:
Withdraw System Changes
Instead of making the button amounts +50, +100, +500, -100, I made them -50, -100, -500, +100. Just flip them around.
Yes, you have to create whole new blocks for each of the new withdrawal buttons, and this is what it should look like.
Yup, again you just flip it. Instead of adding them, you subtract them from the Deposit/Withdrawal Property.
Item Granter changes:
That is what the block should look like.
“Withdrawal complete” notification:
“Not enough bank money” notification:
And that is it for the deposit/withdrawal system! Now your players can deposit their money, and withdraw it from the bank. I hope this guide helped, and if it did a would be appreciated. Have fun!
- 0/10 or
- 1/10 or
- 2/10 or
- 3/10 or
- 4/10 or
- 5/10 or
- 6/10 or
- 7/10 or
- 8/10 or
- 9/10 or
- 10/10 or
- 11/10 or