#Problems w/ detecting when a player closes a barrel with scoreboard linking system

1 messages · Page 1 of 1 (latest)

supple wagon
#

if i wanted to run something when a barrel block is closed with the method i'm using, it would work properly only when there's one block. ```execute as @e[tag=block.placed,type=armor_stand] as @s at @s unless block ~ ~ ~ minecraft:barrel[open=true]{CustomName:'"Block"'} as @a at @s as @e[tag=block.placed,type=armor_stand] if score @s block.ui.index = @p block.ui.index run say DEBUG TEST

solid aspenBOT
#
Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

🙇 After a while, hit the Summon Helpers button to ping the helper team. They'll be happy to help you

✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve

thick token
#

I had a stroke reading all those selectors

#

Could you explain a bit more about your setup?

supple wagon
#

sorry

#

I'm using cloudwolf's linking entities with scoreboards to link a custom barrel gui block at player using datapacks

#

what i want to do is reset the id score of the player when they close a gui block

#

right now i have it as a say command for easy debug testing

kindred ridgeBOT
#
⚙️Custom Gui

The guide is too long for Discord, please follow this link to get to the Guide.

thick token
#

You should find what you're searching for in the advanced gui guide

supple wagon
#

yes, but the problem is that i want to reset the score for the player that just closed the block

#

the command in the guide is running at/as the armor stand

#

it might be possible to just run the scoreboard linking check when it detects a closed gui block

thick token
#

I don't understand the problem

#

How do you check the state of the block?

supple wagon
#

i've got the finding the block state part down (with your help) now the thing is i want to detect which player closed it and run something as the player

thick token
thick token
#

this way you find the player with the same id

supple wagon
#

oh what

#

i don't understand how you find the player from that

#

oh wait you meant line 3

#

im stupid

thick token
#

You execute the command from the entity that checks the barrel state.
From that position, you run the next part as every player.
With that, you check if the player's id is the same as the nearest armor_stand/item_display/... limited to 1 entity, which is the one that checks the parrels state.

#

then you execute whatever. because of the id checking, the context is already transferred to the player (but not the position)

supple wagon
#

thank you for teaching me this

#

it works now :3

thick token
#

👍