Why is my tool not destroying?

image

I am trying to edit the default slingshot on roblox to delete itself if the humanoid it is hitting is at 0 health, yet it is not working. Does anyone know why? (I am a fairly new scripter, sorry)

[I am getting error messages like "attempted to index nil with Destroy(), and infinite yeilds on Slingshot]

What I am trying to accomplish is a one off kill tool, so you can only kill one person with the tool then it gets deleted

1 Like

This means that the slingshot is already deleted. You never had to delete it through a script.

It automatically gets deleted when a player dies. You don’t need to do it manually.

Edit: Just wanted to let you guys know. If the player has the tool un-equipped it will be parented to the player’s Backpack. Else if it is equipped it will be parented to the character.

I am talking about when the person using the slingshot kills someone else. The Humanoid being refrenced is the person who is taking damage

I am talking about when the person using the slingshot kills someone else. The Humanoid being refrenced is the person who is taking damage

use humanoid.Parent instead of script.parent.parent

Just wanted to know. Where is the script located?

1 Like

Server script inside the tool. Again, I am refrencing when the player that is taking damage dies, not the tool holder

I am using script.Parent.Parent so it will go past the tool to the parent so i can use WaitForChild

That’s what we’re saying. When the player that is taking damage dies, the tool will get deleted automatically from that player’s character/inventory.

Im sorry looking back I wasnt clear.

What I am trying to accomplish is a one off kill tool, so you can only kill one person with the tool then it gets deleted

1 Like

He is correct. Whoever is holding the tool doesn’t matter. Just let the player die. It will automatically destroy the tool itself if the player dies.

Then you have to look for the player who killed the other player. You might have to modify the default slingshot’s scripts to get what you want.

2 Likes