Hello, I am a programmer working on a system for my new game. One thing I have been stuck on is “How can I remove a players gun/tool after they kill someone?”
From what I have got, I need to use something called Tags(?), but I am unaware what they are and I can’t find a good devforum article on them. Does anyone know how I could accomplish this?
I don’t think you would have to use “tags”. The tags they’re referring to is likely CollectionService.
You could just destroy the tool which is inside of the character when they die. Use the Humanoid.Died event. You should also check if it’s in their backpack, if it is, then destroy it.
I’m assuming what they meant by Tags isn’t related to the collectionservice, which is useful but just for other stuff.
The way I’d personally go about this is have your gun add a tag to the player that they damage. Just a string value or instance value that you can use to refer to the player that damaged the player. Then, use the Humanoid.Died() function and check if there’s a tag there. If there is, you can then use that tag to determine the player that killed them, and remove that player’s gun. It’s also pretty important that you make sure to update the tag if its already there instead of making a new one every time there’s damage done, which would cause needless lag.