ReplicatedFirst loads before instances get created therefore causing nil errors

For some reason replicatedfirst scripts run before ANY instance is created therefore causing nil error and making my entire game unplayable (this is due to the intro being required)
image
Will WaitForChild fix this?
This also applies to services.

1 Like

Yeah, you’re going to have to use WaitForChild. Also here’s a tip: don’t use WaitForChild on the server unless it’s for body parts inside of characters just being added into the game.

Tried it…
image

1 Like

Yeah, if you get that, it means the thing you’re looking for just isn’t there…

But it clearly exists!
image

Try game.workspace instead of just workspace

1 Like

If you have to absolutely use ReplicatedFirst, try to avoid interacting with the DataModel outside of the container and Services as much as possible. WaitForChild can become a code smell quick.

In your case, you should have your background sound inside ReplicatedFirst and directly index from it there. Since all instances inside ReplicatedFirst are guaranteed to be there, there is no need to artificially wait.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.