I'm using a for loop to apply to all parts in a model. Also, I'd like to ask how to determine if a part is continuing to touch the part.
COMMUNITY QUESTION
How do I determine the part that was touched in a touched event?
1 answer
To have a Touched event trigger, you need to have the part that got touched. E.G
game.Workspace.Part.Touched:connect()
But, for Touched events, it has a parameter that is by default, whatever triggered the event, so:
game.Workspace.Part.Touched:connect(function(h)
if h.Parent:FindFirstChild("Humanoid") then
h:remove()
end
end)
TouchEnded is another event, which is fired once the part stops being touched, so:
local touching = false
script.Parent.Touched:connect(function()
touching = true
end)
script.Parent.TouchEnded:connect(function()
touching = false
end)
http://wiki.roblox.com/index.php?title=API:Class/BasePart/Touched
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Well... No way to determine the original part? I'm using a for loop to apply the function to all the parts in a model.
The original part?