Hello, I need help with this script that is made to go in a tool and when that tool touches somthing it checks its name and if its name is "Pic" then delete it. It dose nothing when I touch a part named "Pic" with it.
function OnTouched(Picture) Print("You touched something!") if Picture.Name == "Pic" then Print("You touched the picture!") Picture:Destroy() script.Parent:Destroy() end end Pic.Touched:connect(OnTouched)
Thanks!
Could you give us the full script? For example, we need to know what 'Pic' is equal to.
Pic is not supposed to be used at line 9, you use script.Parent there if you put the script inside the handle of the tool. Also you should make put the print("You touched something") inside the if statement like this.
if Picture.Name=="Pic" then print("You touched the picture!") Picture:Destroy() sp:Destroy() else print("You touched something!") end
if thats the ful script u have to define pic
add this at the top
Pic = script.Parent