Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

When doing :Destroy on a tool it breaks. How do I fix this?

Let's say I wanna delete a tool when I unequip my tool.

tool = script.Parent
tool.Unequipped:Connect(function()
tool:Destroy()
end)

See that would work in most cases because is my other game it works but in my new game it doesn't. In output an orange/yellow message appears:

** Something unexpectedly tried to set the parent of Tool to NULL while trying to set the parent of Tool. Current parent is Backpack. **

I've also tried more options like deleting it from Backpack via :FindFirstChild but that sends the same message too.

Please help me.

1 answer

✓ Accepted answer

this means it's happening in the exact same tick, to fix this simply add a wait() before destroying it.

1 comment

0

Thank you so much.

This discussion is preserved as it was. New answers, comments, and votes are closed.