1

How do I teleport players when they standing on a block?

Satben's Avatar Satben4/29/22 6:31 am
5/2/2022 4:18 pm
xokz's Avatar xokz
Well, I have been searching for 2 days, but still no result.

Is there any command that I can teleport players when they stand on a block ( location )

like this
/tp @p[​minecraft:light_gray_wool at x=0,y=12,z=0] -69 10 69

Please Help

VERSION:JAVA 1.18.2
Posted by Satben's Avatar
Satben
Level 22 : Expert Architect
2

Create an account or sign in to comment.

14

1
05/02/2022 10:21 am
Level 42 : Master Lad
fatcat109_
fatcat109_'s Avatar
Pressure plate
1
05/01/2022 4:52 pm
Level 1 : New System
Tim355
Tim355's Avatar
Ok you can do something like this: execute positioned x y z if entity @p[​distance=..0.4] run tp @p -69 10 69
Replace x y z with the location where you want to be checking for the player. (Btw make it always active repeat)
1
05/01/2022 12:24 pm
Level 4 : Apprentice Miner
Kirito_Datteri
Kirito_Datteri's Avatar
In an command block: tp @p 0 12 0 and you place the command block on the specific block down a pressuire plate
1
04/30/2022 2:41 am
Level 22 : Expert Architect
Satben
Satben's Avatar
Well, Basically my question its not on special block, its on the located block, cuz my floor is all light gray wool, so that mean I will get teleported wherever I at, I want is if player standing on the located block, and not specific block, thanks

Example: execute if players on minecraft:light_gray_wool run tp @p -454 33 93 90 0 | X
execute if players on -487 33 107 run tp @p -454 33 93 90 0 | O
2
04/30/2022 1:30 pm
Level 52 : Grandmaster Robot
xokz
xokz's Avatar
Satben, dont use storms example, it is inefficient and likely overcomplicated for what you want to do, no offense storm. Using 3 @e selectors in 1 line is not good.


FOR EXECUTING IF PLAYER IS STANDING ON A CERTAIN TYPE OF BLOCK:
execute as @a at @s if block ~ ~-0.1 ~ minecraft:light_gray_wool run tp @s -69 10 69


FOR EXECUTING IF THE PLAYER IS AT A CERTAIN COORDINATE:
execute as @a at @s if entity @s[​x=-487,y=33,z=107] run tp @s -454 33 93 90 0
1
05/02/2022 10:18 am
Level 22 : Expert Architect
Satben
Satben's Avatar
k, Thanks, but what about the distance?
1
05/02/2022 4:18 pm
Level 52 : Grandmaster Robot
xokz
xokz's Avatar
what do you mean?
2
04/29/2022 6:33 pm
Level 4 : Apprentice Dragon
StormDragon_64
StormDragon_64's Avatar
Here is some code I used for my datapack but you will want to edit it a bit.
execute as @e at @e if block ~ ~ ~ minecraft:dirt_path run effect give @e[type=#faster_paths:ridable,distance=..0.3] minecraft:speed 1 0 true
1
04/29/2022 6:36 pm
Level 4 : Apprentice Dragon
StormDragon_64
StormDragon_64's Avatar
I have a tag for anything that the player can ride, so you might want to switch that to type=player and also you will want to have it as if block ~ ~-1 ~ minecraft:light_gray_wool instead and also replace effect with tp.
1
04/29/2022 6:38 pm
Level 4 : Apprentice Dragon
StormDragon_64
StormDragon_64's Avatar
Oh wait, I just realized that you already have coords for the block, use those instead and make sure it is the coords of the block not you, so if you are standing at y=12 while on the block, then you will want the coords for the block to be 11.
1
04/30/2022 2:27 am
Level 22 : Expert Architect
Satben
Satben's Avatar
Ok, I tested, But...why the command block tp me always whatever where I at?
1
04/30/2022 11:45 am
Level 4 : Apprentice Dragon
StormDragon_64
StormDragon_64's Avatar
Oh I know what you mean now. You didn't really read my last comment before yours. Instead of ~ ~-1 ~ you want the coords of the block you want to be teleported from. Make sure that is the block's coords and not your coords, so if your standing on the block then the y coord will be 1 less than your y coord.
1
04/30/2022 1:04 pm
Level 22 : Expert Architect
Satben
Satben's Avatar
k, thanks
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome