How do I make an item disappear after using it?

@develofied Read this message (the one i replied to) .name is depracated .Name isn’t

Could you show the new script?

Just so you’re aware tool instances cannot fire the .Touched events of other BasePart instances, their handles (which are BaseParts) however can.

image

this script is in the door.

The script is within the handle I believe

Use .Name not .name it should work dude

plr.Backpack not player.Backpack.

player is underlined in blue indicating that it hasn’t been declared & initilialized.

2 Likes

robloxapp-20220311-1118007.wmv (2.5 MB)

Does your script contain a virus by the way? That last line (comment) looks familiar.

Which line looks familiar to you?

Last synced and the remainder of that line. Click on that line and press the “End” key on your keyboard.

It is not a virus. Anyways can someone tell me why the door is not disappearing anymore?

My bad. Place back your original script.Parent:Destroy() in both of the events.
Don’t delete the new code I told you to put in though

What new code did you want me to put in?

You replaced code here

Instead of replace, I should’ve told you to add.

You can ignore my statements. Just place script.Parent:Destroy() back where it originally was. (Don’t delete anything)

So place the parts you wanted me to add under the script.Parent:Destroy()?

You don’t currently HAVE a script.Parent:Destroy() anymore.
Nevermind… I’ll write the script for you to paste.

In the current door script, I have this
image

script.Parent.Touched:Connect(function(hit)
   if hit.Parent.Name == "White Key" then
      script.Parent.TouchInterest:Destroy()
      script.Parent.ClickDetector:Destroy()
      script.Parent:Unlock:Play()
      script.Parent.Parent.Lock.Anchored = false
      wait(0.84)
      hit.Parent:Destroy()
      script.Parent:Destroy()
   end
end)
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
   if plr.Backpack:FindFirstChild("White Key") then
      script.Parent.TouchInterest:Destroy()
      script.Parent.ClickDetector:Destroy()
      script.Parent:Unlock:Play()
      script.Parent.Parent.Lock.Anchored = false
      wait(0.84)
      plr.Backpack["White Key"]:Destroy()
      script.Parent:Destroy()
   end
end)

That should work, test it out

No… Wait… Move script.Parent:Destroy() down one line.

It should be the last line before the two ends