Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
0te 35
3 years ago

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

Log in to vote
1
Answered by 3 years ago

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.

0
Sorry I worded my question very badly but I found it was due to a debounce in the script. Thanks for your help. 0te 35 — 3y
Ad

Answer this question