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

Is there a property to complete ignore a part in a touched function?

I have this statement inside a touched function:

if hit.Name ~= "Ball" then print(hit.Name) return end

So basically when hit.Name ~= "Ball" then the script ends, which states I have a problem. That is because the hit is detecting other parts, such as the baseplate.

However, I want my touched function to completely ignore all other parts, so that "Ball" is the only part detectable, without any other parts interfering.

Is this something to do with collision groups?

1 answer

✓ Accepted answer

If I understood well then this is the solution:

if hit.Name == "Ball" then
print("Ball touched")
else
print("Something else touched")
end

Very simple if statement.

1 comment

0

Sorry I worded my question very badly but I found it was due to a debounce in the script. Thanks for your help.

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