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

How do I set a "If" condition to detect when a member is not a valid member of something?

If a part is not a valid member of workspace for example, how would I set the "If" condition for it to then do something when it detects that?

1 answer

✓ Accepted answer
part = workspace:WaitForChild("Part")

if not part then

end

or you could also do this

if not workspace:FindFirstChild("Part") then

end

2 comments

0

Roblox errors if you attempt to index a nonexistent object directly. In the first code segment you would also need to use FindFirstChild()

0

sorry

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