1
COMMAND BLOCKS
K so I need help with command blocks. Version 1.13.2
I'm making a minecraft shop (clearly) and don't know how to use /execute for it. /testfor doesn't work, its not a valid command. I'm trying to use /give @p (to give the player the item) and /clear @p (to take the currency that my eco realm uses) and YES, command blocks are on!
I'm making a minecraft shop (clearly) and don't know how to use /execute for it. /testfor doesn't work, its not a valid command. I'm trying to use /give @p (to give the player the item) and /clear @p (to take the currency that my eco realm uses) and YES, command blocks are on!
Create an account or sign in to comment.
3
Ok, I recently discovered that /testfor doesn't seem to be a fully-fledged command, it's more like a sub command for execute. (I think /execute testfor works). I must recommend the Official Minecraft Wiki for all matters of commands/redstone/basically everything in Minecraft. Lol, I just saw the comment below me, much better!
1.13 has changed the command syntax, and I can say its for the better, but no one likes change.
To clarify, /testfor is now "/execute as" or "/execute if entity"
and /testforblock is now /execute if block
Now to begin
Lets just say you made a currency system called "money"
/scoreboard objectives add money dummy
and a person gets 500 money
/scoreboard players add @s money 500
(The @s means the person executing it, which means you. Send it to @a if you have to)
If you want to detect someone having more than 200 money to buy something, then use the new execute command
/execute as @p[scores={money=200..}] run command
The 2 dots next to 200 is important otherwise you only detect the exact value.
In the run command part you give the person the item using the @s selector (otherwise it gives it to another person)
To take the money away, do /scoreboard players remove @p 200
And the 200 moneys will be gone.
Ask if you have any enquiries
To clarify, /testfor is now "/execute as" or "/execute if entity"
and /testforblock is now /execute if block
Now to begin
Lets just say you made a currency system called "money"
/scoreboard objectives add money dummy
and a person gets 500 money
/scoreboard players add @s money 500
(The @s means the person executing it, which means you. Send it to @a if you have to)
If you want to detect someone having more than 200 money to buy something, then use the new execute command
/execute as @p[scores={money=200..}] run command
The 2 dots next to 200 is important otherwise you only detect the exact value.
In the run command part you give the person the item using the @s selector (otherwise it gives it to another person)
To take the money away, do /scoreboard players remove @p 200
And the 200 moneys will be gone.
Ask if you have any enquiries
Also the reason /give and /clear don't work because if a player triggers the command block without sufficient funds, they will still obtain the item