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 9 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.

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!

3 answers

Log in to vote
0
Answered by
Usering 135
9 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 — 9y
Ad
Log in to vote
0
Answered by 9 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.

        if Picture.Name=="Pic" then
            print("You touched the picture!")
            Picture:Destroy()
            sp:Destroy()
        else
            print("You touched something!")
        end
Log in to vote
0
Answered by 9 years ago

if thats the ful script u have to define pic

add this at the top

Pic = script.Parent

Answer this question