✓ Accepted answer
No.
workspace.Part8 would be a Part, an Instance. false is not an instance, so they cannot be equal.
The first (only) parameter to a Touched event is which part touched it. We can compare this parameter to workspace.Part8 to make sure it is workspace.Part8 triggering the Touch event:
function Touched(partTouching)
if partTouching ~= workspace.Part8 then
return;
end
end
I would say that in general it would probably be better to organize it like this instead, because it's easier to see at a glance what is going on:
function Touched(partTouching)
if partTouching == workspace.Part8 then
end
end
But both versions work.
Instead of comparing workspace.Part8 and partTouching, you could just check the Name of partTouching:
if partTouching.Name == "Part8" then
This doesn't act the same, since there could be more than one Part8 but it may be sufficient. It's also useful if there are several parts which you want to accept and workspace.Part8 isn't the only one.
1 comment
Thank you! I named it Part8 so it would be unlike other parts, so it would be the only one of its kind. I suck at scripting, so thank you for helping me!