This is what i have:
if part.ForceField == false then
The code dosen't seem to work sometimes, hopefully someone could help.
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.
if part:FindFirstChild("ForceField") then -- Do something if the force field IS found end if not part:FindFirstChild("ForceField") then -- Do something if the force field is NOT found end