1

Execute for players at y-dy (SOLVED)

SortaSnowy 5/2/19 8:28 am
909
5/2/2019 11:59 pm
So I'm trying to execute a tp command when a player falls below y5 and above y0, but all the other inquiries I've seen online are outdated and I'm not great at getting execute commands to work properly, rip. Any suggestions?

note: I'm using a command block to run the command
Posted by
SortaSnowy
Level 28 : Expert Artist
7

  Have something to say?

JoinSign in

6

kebe3
05/02/2019 10:30 am
Level 2 : Apprentice Network
You do something like:

execute at @a as @p[y=0,distance=..5] run CMD
2
SortaSnowy
05/02/2019 8:19 pm
Level 28 : Expert Artist
works! ty :)
1
resistance_is_futile
05/02/2019 9:23 am
Level 60 : High Grandmaster System
the selector should be about this:
  execute as @e[type=player,y=0..5] at @s run #command that shall be executed
1
SortaSnowy
05/02/2019 9:36 am
Level 28 : Expert Artist
y=0..5 gives invalid doubles error, the rest works apart from that though
1
resistance_is_futile
05/02/2019 9:46 am
Level 60 : High Grandmaster System
I made something similar, but i used a workaround:
scoreboard players set @s y_pos 0
execute store result score @s y_pos run data get entity @s Pos[1]
execute if score @s y_pos matches 0..5 run #whatever you want to run

this should work definetl.y
1
SortaSnowy
05/02/2019 10:21 am
Level 28 : Expert Artist
history
how did you set this up? I can't seem to get it to work either :/
1

Welcome