(Please forgive my horrible avatar, this is only an alt account . I was afraid this site was used for phishing.) Let's say I have a block that starts a function when it's touched. How can I get the block that touched it? I think I know, but I haven't tried this yet. If it works, I will close this question. Do I just add the variable name of the touching part in the () argument of the function?
Part = ???? --this is what part will fire the function when it is touched Part.Touched:connect(function(PartHit) -- The "PartHit" is the part that hit the part you put in "Part", it doesnt have to be named "PartHit" it can be anything else --and put what ever you want it to do here end)
Yes! Using the TouchedEvent, you can get the part that touches an object!
script.Parent.Touched:connect(function(hit) print(hit.Name.." touched me!") end)