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