Server can't detect player's character when PlayerRemoving

So I’m making a survival game, I made a system where survivor’s tool that they are carrying, drops whenever they left the game

it works like, if server detects a player left, if survivor carrying a item/tool in their backpack it drops, then removes the tool

but what if was player holding the item/tool in their hand? For this I need to detect player character but it does not work, backpack works fine but player character part doesnt works

script:

EDIT: I SOLVED IT NOW!

That’s because the player’s Character is destroyed before PlayerRemoving fires. You could make use of the Player.CharacterRemoving event and update held tools when they die.

2 Likes

Like what @12345koip said, the Character is removed before the player is. Therefore, the Character instance would be nil. Player.CharacterRemoving is probably your best bet.

Thingy

(Evidence if you want. The difference is about 0.00027871131896972656 seconds if you were wondering)

1 Like