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

Issue with logical operators?

if hit.Name == "Log" and hit.Planks and hit.Mesh == nil then

this line says its incorrect how would I get an if statement to check multiple things?

1 answer

✓ Accepted answer

You could write it like this:

if hit.Name == "Log" --If the hit object's name is "Log"
and hit:FindFirstChild("Planks") --If the hit object has planks
and (not hit:FindFirstChild("Mesh")) then --If the hit object doesn't have a Mesh
	--Do stuff
end

Note: The if statement can be all on one line like this: if hit.Name == "Log" and hit:FindFirstChild("Planks") and (not hit:FindFirstChild("Mesh")) then

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