Solved Skript not working!

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.
Feb 25, 2017
21
1
0
Hey so im currently working on a mobcoin skript. Where coins (sunflowers) can be exchanged for currency and then used in a shop. However everything works except when coins are transferred they are not added onto the balance:

a96e347a483d24e9b0c64feef1709c55.png
 
1. You're trying to add a text to a number. Putting "%%" around the expression parses it as a text, so you can't treat it like a number which you can do math with. That's like saying `add "3ab" to "12"`, it doesn't mean anything.
2. Why store the number of sunflowers in {_mobcoins} if you're not going to reuse it when it makes sense? The code should look like this:

code_language.skript:
if arg 1 is "transfer":
    set {_mobcoins} to number of sunflower in player's inventory
    add {_mobcoins} to {coins.%arg-2%}
    remove {_mobcoins} of sunflower from player's inventory
    send "&6You just got &c%{_mobcoins}% Coins!" to the command sender
 
1. You're trying to add a text to a number. Putting "%%" around the expression parses it as a text, so you can't treat it like a number which you can do math with. That's like saying `add "3ab" to "12"`, it doesn't mean anything.
2. Why store the number of sunflowers in {_mobcoins} if you're not going to reuse it when it makes sense? The code should look like this:

code_language.skript:
if arg 1 is "transfer":
    set {_mobcoins} to number of sunflower in player's inventory
    add {_mobcoins} to {coins.%arg-2%}
    remove {_mobcoins} of sunflower from player's inventory
    send "&6You just got &c%{_mobcoins}% Coins!" to the command sender
Thanks
 
Status
Not open for further replies.