# Multiplayer AFK player deleted

**URL:** <https://forum.makecode.com/t/multiplayer-afk-player-deleted/42491>\
**Category:** Help\
**Tags:** game\
**Created:** [March 4, 2026, 6:28pm UTC](https://forum.makecode.com/t/multiplayer-afk-player-deleted/42491 "2026-03-04T18:28:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chendrix](https://avatars.discourse-cdn.com/v4/letter/c/6bbea6/32.png) [@chendrix](https://forum.makecode.com/u/chendrix)\
**Post date:** [March 4, 2026, 6:28pm UTC](https://forum.makecode.com/t/multiplayer-afk-player-deleted/42491/1 "2026-03-04T18:28:04Z")

</div>

I have a student who is trying to make a multiplayer game, but if only 2 of the 4 players are active, the other 2 players will be deleted. Below is a screenshot of what we tried for the code. This deleted the 2 players that were actually playing the game, not the unconnected players. Any ideas?

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/0/f/0f53c59b6dda5eaeaeae43634b6219faf602b5fe.png)

---

<div class="post-metadata">

**Author:** ![jwunderl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jwunderl/32/5308_2.png) [@jwunderl](https://forum.makecode.com/u/jwunderl)\
**Post date:** [March 4, 2026, 6:38pm UTC](https://forum.makecode.com/t/multiplayer-afk-player-deleted/42491/2 "2026-03-04T18:38:20Z")

</div>

P1, P3, and P4 are swapped here

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/0/0/005d5031d348fda6fd063f6798c04057a67e0cdd.png)

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [March 4, 2026, 6:47pm UTC](https://forum.makecode.com/t/multiplayer-afk-player-deleted/42491/3 "2026-03-04T18:47:41Z")

</div>

instead of deleting them if they’re inactive, have you considered using the “on player connected” event instead? that event will fire whenever a player first gives input (or connects to the game if using online multiplayer) and you could create the sprite inside of that event rather than destroying it when they stop moving.

if you’re set on having a “dead man’s switch” in your game though, I would do something like this:

> **[dead-mans-switch](https://arcade.makecode.com/60821-79854-59018-45474)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

(note that this example uses the multiplayer extension, which i think you’ll find makes working with four players way easier)

or, if the intention is just to make it so that once they’ve done any input then they are no longer at risk of being deleted, i’d set a boolean for each player instead of keeping track of the last input time like so:

> **[safe-after-any-input](https://arcade.makecode.com/00052-21380-42247-97445)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![chendrix](https://avatars.discourse-cdn.com/v4/letter/c/6bbea6/32.png) [@chendrix](https://forum.makecode.com/u/chendrix)\
**Post date:** [March 4, 2026, 6:48pm UTC](https://forum.makecode.com/t/multiplayer-afk-player-deleted/42491/4 "2026-03-04T18:48:22Z")

</div>

ah good catch. I will have him try swapping that.

---

<div class="post-metadata">

**Author:** ![mcodez](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mcodez/32/30743_2.png) [@mcodez](https://forum.makecode.com/u/mcodez)\
**Post date:** [March 4, 2026, 11:18pm UTC](https://forum.makecode.com/t/multiplayer-afk-player-deleted/42491/5 "2026-03-04T23:18:41Z")

</div>

It would be cool to add sprites saying use character or something like that like some arcade games  
[this being insert for the other round]  
 ![Insert Coin, the arcade documentary worth feeding all your quarters into - Ars Technica](https://cdn.arstechnica.net/wp-content/uploads/2020/03/InsertCoin-11.jpg)
