So, basically i want to delete from the backpack a tool when its unequipped, but i cant find the way to check if the tool was unequipped.
I tried this but doesn’t seems to work
while true do
if Tool.Equipped == false then
Tool:Destroy()
print("Tool unequiped")
break
else
task.wait(0.3)
print("Not unequipped")
end
end
Any thoughts?
Use the event Tool.Unequipped
.
Tool.Unequipped:Connect(function()
-- Unequipped code here
Tool:Destroy()
end)
Also, your Tool.Equipped
event needs to be in this format too. There’s also no need for a while loop here. Or any, for this matter.
1 Like
Doesnt seem to work: “Something unexpectedly tried to set the parent of Tool to NULL while trying to set the parent of BoxInTool. Current parent is Backpack.”
you should try putting a task.wait() before the Tool:destroy, maybe that will work.
2 Likes
It is basically saying, It’s getting Destroyed while it’s being parented to Can we see your code?
It worked by putting the task.wait before destroy, thanks!