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

How do i make OnTouch?

Ok ive tried this

OnTouch(game.workspace.part)
         game.workspace.part:remove()
end

I've seen pepole use connect before, But i dont understand what that does This was months ago, I edited it to explain! OnTouch(game.workspace.part) Was my attempt to think there was already a function called OnTouch i just use it and put where the part is. game.workspace.part:remove() removes that part when someone touches it.

2 answers

✓ Accepted answer
function Hello()
local Part =Workspace.Part
Part:Destroy()
end
script.Parent.Touched:connect(Hello)

Let me explain this for you.. When The event " Touched" has been activated by anything that has touched it the connect method will run the function and Therefore the part will be deleted.

5 comments

0

ty ;)

0

now i can create my doors [aauto doors]

0

If you need any Help message me on roblox for my skype

0

i dont have skype :c

0

Im Trying to make a Debounce, Hope it works well c:

Part is like a table, and it has variables inside of it whose values affect how it interacts with the game world. Some of these values are functions and events, like Touched. Part.Touched is triggered whenever it is touched, and when you connect it to a function, the function is triggered whenever the part is touched.

Part.Touched:connect(function(hit)
	print(hit.." touched the part")
end)

1 comment

0

I wish i could accept both ;-;

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