How do you check which player has the most of a item?

What the title said.

3 Likes

Relay > Checker?

1 Like

Sorry I meant one item. I just changed the title. Also I don’t think that would work anyway.

Oh, okay.
So you want to check which player has the most of an item (like, let’s say, all players?)

Yes all players. My brain is like switched off for some reason so if the soultion is simple, idk.

^ ?

1 Like

But how would it check which player has the item and then trigger something.

It depends on what action you want to happen to trigger the relay and what action you want to do once the check passes.

Ok here is the gist of want i want to do. A check runs for all players and sees who has the most of a item. Then the player with the most of an item gets switched to specators.

An button triggers the relay but that doesn’t matter much, does it?

You could store the number of an item players have and use Player ID’s to compare them to see who has the most of an item.

Ok gtg got to eat dinner. Be back in 30mins. Sorry

I think getrithekd made a guide on this.

He did??? I checked and I didn’t see one. Also Im back.

2 Likes

Check his voting guide. The basic premise is to check each property if it is greater than a benchmark, and if it is, making it the benchmark and checking a new property.

1 Like

But I just want the game to check which player has the most of an item than get switched to spectators, not a voting system.

Use an inventory item manager to set the item to a player-scoped property. Then, get a global scoped property called “Most of the item”. Also, make a global property called “People checked”. Then, in a trigger’s blocks if the player-scoped property is greater than the global property set the global property to the player-scoped property. Then increment the “People checked” property by one. If “People checked” is the same as the number of people in the game, then check if your player-scoped property is equal to the “Most of the item” property. If it is true, broadcast on “spectator”. Have a team switcher setting someone to spectator when receiving on “spectator”. This should work. If it doesn’t just tell me and I can fix it.

2 Likes

That’s what the block code above does. @getrithekd could probably take your picture relatively quickly.

Can you maybe add a pic of the blocks?

1 Like

I don’t have a picture yet. That was mostly me thinking. I could probably get you a picture tomorrow.

1 Like