How to make a player specific back to hub item

I'm making a server-like world with mimigames that currently relies on "back to hub" pressure plates, but i would like to have a system like they have on most servers were you can drop a item and it will send you back to hub but i cant figure out a way to do it.


Unfortunately, in Bedrock Edition, this is not possible, as complex NBT tags don't exist. Even if it would be possible, then you would need command blocks for every player in the server.

But in Java Edition, this is possible:

Repeat command block, always active

/execute at @a[nbt={SelectedItem:{id:"minecraft:nether_star"}}] run tp @s 0 64 0

Replace coords 0 64 0 with your wanted coordinates, and minecraft:nether_star for your wanted item. This checks if a player is holding a nether star, and if so, it teleports that person to the hub. I hope this helps.