I have a script which is trying to detect what the tools name is so that not everything can touch it (E.G) A Players arm.
This does not appear to work however, if I touch the part with a tool that matches it, it prints and doesn’t match it.
Advice is appreciated.
if script.Parent.Parts.Body.EPad.Touched:Connect(function(hit)
if hit.Name == "Oyster Card" then
-- code if matches
else
print ("not an oyster card")
end
hit would be the part that caused the Touched event to happen, so you most likely need to do hit.Parent.Name and not hit.Name, since then name of hit would most likely be Handle or the names of other parts inside of the tool
Also why is there an if before the Touched event declaration?