It doesn't work because you're comparing an object
to a boolean
, which will always be false. An object is never going to be false, though they are truthy
(not false or nil).
Using the :FindFirstChild()
function you can do this. It will return nil
if the child wasn't found.
1 | if part:FindFirstChild( "ForceField" ) then |
5 | if not part:FindFirstChild( "ForceField" ) then |
Hopefully this answered your question, and if it did, then don't forget to hit that accept button. If you have any more questions, then feel free to leave them down in the comments.