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?
✓ ANSWER ACCEPTED
How do I set a "If" condition to detect when a member is not a valid member of something?
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
This discussion is preserved as it was. New answers, comments, and votes are closed.

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