Improve nil errors to communicate replication caveats

There are various errors when attempting to use a nil value such as “Attempt to index nil value” or “x is not a member of y”. This has caused confusion among new developers when it happens for an object that does exist, but hasn’t replicated to the client yet. When throwing these clientside, we should add an addendum to the error that says “Has the object replicated yet?” or “Did you mean to use WaitForChild?” (maybe not a good idea because slapping WaitForChild everywhere you get a nil error is bad).

In any case, we’re not providing enough information in these errors to communicate that there’s potentially a replication race condition, as opposed to the object not existing (ever).

4 Likes

Perhaps an additional error/warning/info could be printed if an object with the same name was added in the next X seconds. Another option might be to have robloxdev articles on how to debug each of the most common errors and these could be linked in those error messages.

3 Likes

Yeah, I made a suggestion for that here, and it would do wonders for not just these kinds of errors, but all of them. Having detailed explanations of what each error means and how to resolve would be extremely helpful.