JustDogYT Posted April 14, 2021 Posted April 14, 2021 (edited) I am trying to make a skript that gives a random player in a region a certain amount of money. This is my code so far command moneyDrop <number>: trigger: if "%region at player%" contains "golddrop": set {random} to a random element out of all players add %arg-1% to {random} player I am not sure whats wrong i am new to skript. Edited April 14, 2021 by 1Dog_ Grammer
CoolProgrammer Posted April 14, 2021 Posted April 14, 2021 1 hour ago, 1Dog_ said: I am trying to make a skript that gives a random player in a region a certain amount of money. This is my code so far command moneyDrop <number>: trigger: if "%region at player%" contains "golddrop": set {random} to a random element out of all players add %arg-1% to {random} player I am not sure whats wrong i am new to skript. This is probably what you tried to do: command moneyDrop <number>: trigger: if "%region at player%" contains "golddrop": set {_random} to a random element out of all players add arg-1 to balance of {_random} Here are the thing which were wrong with your code: -> If you want to access variables directly within a trigger or event, use local variables. Local variables are not permanent and are only available with-in the trigger or event. A local variable starts with an underscore. E.g. {_hello}, {_variable}, etc. -> You do not use % in add %arg-1% to... sign to represent variables or values within skript syntax. Just type it out as such: add arg-1 to... Anyways, happy learning, enjoy! Hello there! If you're reading this, hope you're having a wonderful day! Feel free to contact me via Discord (CoolProgrammer#1920) for any help. My DMs are always open for help. You can also message via. forum messages for help. Also, don't hesitate to leave a like on my post if I helped you in any way.
CoolProgrammer Posted April 14, 2021 Posted April 14, 2021 2 hours ago, 1Dog_ said: Thanks so much!!! No problem, anytime. Hello there! If you're reading this, hope you're having a wonderful day! Feel free to contact me via Discord (CoolProgrammer#1920) for any help. My DMs are always open for help. You can also message via. forum messages for help. Also, don't hesitate to leave a like on my post if I helped you in any way.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now