How to teleport a player upwards every two seconds? [duplicate]
I want to make a setup with command blocks that will, if you hold a specific item, elevate you 100 blocks. For example, when you hold an ender pearl named "Sky Orb", you would be teleported 100 blocks up each couple of seconds. I already have the necessary commands:
/scoreboard objectives add Holding dummy
/scoreboard players set @a Holding 0
/scoreboard players set @a Holding 1 {SelectedItem:{id:"minecraft:ender_pearl",tag:{display:{Name:"Sky Orb"}}}}
/tp @a[score_Holding_min=1] ~ ~100 ~
Basically, the main problem is the delay. You should only be teleported every 2 seconds or so. Does anyone know a setup for this?
(I'm using the 1.9 snapshots)
Best Answer
I've also found an answer myself which I find a little easier than the answers I've recieved until now. I've used the following 3 commands:
/scoreboard players add @a Holding 1 {SelectedItem:{id:"minecraft:ender_pearl",tag:{display:{Name:"Sky Orb"}}}}
/execute @a[score_Holding_min=40] ~ ~ ~ /scoreboard players set @p Holding 0
/tp @a[score_Holding=1] ~ ~100 ~
The first command adds 20 points to your score each second, the second command resets that score once a score of 40 has been reached, and the last command teleports you if you have a score of 1.
You can change the amount of blocks you get teleported up by changing the "100" in the last command and you can change the delay by changing the "40" in the second command. Each 20 ticks gives a 1 second delay.
Pictures about "How to teleport a player upwards every two seconds? [duplicate]"
![How to teleport a player upwards every two seconds? [duplicate] - Two Fit Young Men Walking Along Volleyball Net on Sandy Beach How to teleport a player upwards every two seconds? [duplicate] - Two Fit Young Men Walking Along Volleyball Net on Sandy Beach](/assets/images/how_to_teleport_a_player_upwards_every_two_seconds_duplicate_1.jpeg)
![How to teleport a player upwards every two seconds? [duplicate] - Two Beach Volleyball Giving Fist Bump Gesture How to teleport a player upwards every two seconds? [duplicate] - Two Beach Volleyball Giving Fist Bump Gesture](/assets/images/how_to_teleport_a_player_upwards_every_two_seconds_duplicate_2.jpeg)
![How to teleport a player upwards every two seconds? [duplicate] - Person in White Nike Soccer Shoes Standing on Black Floor How to teleport a player upwards every two seconds? [duplicate] - Person in White Nike Soccer Shoes Standing on Black Floor](/assets/images/how_to_teleport_a_player_upwards_every_two_seconds_duplicate_3.jpeg)
The 312 Bugs in Geometry Dash (2.113)
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Pixabay, RODNAE Productions, RODNAE Productions, cottonbro
