How can I teleport players to start if they touch these blocks? [duplicate]

How can I teleport players to start if they touch these blocks? [duplicate] - Athletes Running on Track and Field Oval in Grayscale Photography

I'm making a flying map where players are not allowed to touch grass, quartz, or leaves. If they do, I need them to be teleported to the start. How can I do that? By the way, this is 15w47c map.



Best Answer

Try this:

execute @a ~ ~ ~ detect ~ ~-1 ~ minecraft:grass -1 tp @a[c=1] <x> <y> <z>

That checks if the player is on top of a grass block. Just change the relative coordinates (the ~ ~-1 ~) in order to check above, right, etc. And, obviously, change minecraft:grass to whatever block you want to check. If you have issues with the relative coords, check them out here.




Pictures about "How can I teleport players to start if they touch these blocks? [duplicate]"

How can I teleport players to start if they touch these blocks? [duplicate] - A Referee and Hockey Players on an Ice Rink
How can I teleport players to start if they touch these blocks? [duplicate] - Hairless aged ethnic male in casual outfit touching bag while sitting against mesh fence with beer can
How can I teleport players to start if they touch these blocks? [duplicate] - Back view of African American teenage football player sitting on field ground and holding grid of gate while preparing to start play football match



How do you teleport to a player with a block?

Type this command in when having the command block GUI open /teleport @p <x> <y> <z> . Then, activate the command block with redstone (including buttons, levers, and pressure plates), and they will be sent to their destination. The player can set up multiple different teleports.

What is the cheat to teleport?

You can teleport to any location as long as you have its coordinates. To do it, type your command like this: /tp X Y Z. So for example, if you're trying to teleport to the location 70, 70, 70, you'll type: /tp 70 70 70.

How do you teleport to all players?

Try the /spreadplayers command, which spreads entities in a random area. The syntax is /spreadplayers <x> <z> <spreadDistance> <maxRange> <respectTeams> <player \u2026> In your case, you might want to try something like /spreadplayers ~ ~ 0 10000 false @a[r=5,c=1] .



How To Detect When A Player Is Standing On A Block In Minecraft || Insta Kill Or Launch Pad




More answers regarding how can I teleport players to start if they touch these blocks? [duplicate]

Answer 2

The OnGround byte tag specifies whether or not the player is on the ground. You can assign a score based on its value and target the player based on that score:

/scoreboard objectives add OnGround dummy

/scoreboard players set @a OnGround 1 {OnGround:1b}
/scoreboard players set @a OnGround 0 {OnGround:0b}

/tp @a[score_OnGround_min=1] X Y Z

Another method is to detect whether there is air at the player's current feet position, but keep in mind that this method is flawed when it comes to players standing on non-full blocks such as slabs:

/scoreboard players set @a OnGround 1
/execute @a ~ ~ ~ detect ~ ~ ~ minecraft:air 0 scoreboard players set @a[c=1] OnGround 0

For 15w47c+, you can use the "tags" feature to avoid having to use scoreboard objectives:

/scoreboard players tag @a[tag=!OnGround] add OnGround {OnGround:1b}
/scoreboard players tag @a[tag=OnGround] remove OnGround {OnGround:0b}

/tp @a[tag=OnGround] X Y Z

Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Pixabay, Tony Schnagl, Nicola Barts, RF._.studio