Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I do this with a tool?

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

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

1 comment

0

Pic is a part. And that is the full script...

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

This discussion is preserved as it was. New answers, comments, and votes are closed.