Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I do this with a tool?

Asked by 10 years ago

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.

1function OnTouched(Picture)
2    Print("You touched something!")
3if Picture.Name == "Pic" then
4    Print("You touched the picture!")
5    Picture:Destroy()
6    script.Parent:Destroy()
7end
8end
9Pic.Touched:connect(OnTouched)

Thanks!

3 answers

Log in to vote
0
Answered by
Usering 135
10 years ago

Could you give us the full script? For example, we need to know what 'Pic' is equal to.

0
Pic is a part. And that is the full script... Leg0brick 10 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

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.

1if Picture.Name=="Pic" then
2    print("You touched the picture!")
3    Picture:Destroy()
4    sp:Destroy()
5else
6    print("You touched something!")
7end
Log in to vote
0
Answered by 10 years ago

if thats the ful script u have to define pic

add this at the top

Pic = script.Parent

Answer this question