Minecraft – make a system that tests for a specific player at specific coordinates with a specific item

minecraft-commandsminecraft-java-edition

I want to make a system that tests for a specific player at specific coordinates with a specific item? And also how do I get one redstone output out of all the commands at once?
I tried to do /testfor [x=X,y=Y,z=Z,r=R]
And /testfor {Inventory:[{id:"minecraft:slime_ball"}]}
Both work, but I can't test for 1 specific player, I can only check for all the players, I need help please.

Best Answer

you can check all of that in one command like this:

/testfor @p[name=PlayerName,x=X,y=Y,z=Z,r=R] {Inventory:[{id:minecraft:slime_ball}]}