Folder doesn't exist in workspace, but yet it does

Ok right so I wrote this script that checks for a folder in workspace, works 100% for me on my own place, but when I gave it to my client it gave him the error that the folder doesn’t exist.

I don’t know if this is some sort of bug or an issue on his end but everything is pointing to it being a bug.
Error:
https://gyazo.com/b30122af14766be5dafd0f84e10b25c3

Workspace:
https://gyazo.com/ce67ae01d0a0306da0411581ebb3888f

This is likely because you try to access the folder on the client before it has been replicated from the server. Instead of using Workspace.Houses, you can instead use Workspace:WaitForChild(“Houses”), this will wait until it is replicated.

https://www.robloxdev.com/api-reference/function/Instance/WaitForChild

2 Likes

Strange, this has never been an issue of mine. But then the place this is in is pretty big so it could just take it a while for it all to replicate

Since the switch to ‘Accurate Play Solo’, this will probably occur more often, since the server data-model has to replicate everything to the client realistically. It’s good that you ran into this issue, since now you will be able to fix it in a way that will work in a real server!

It’s strange, before I ship it of to the client I usually check it on a test server and on this it worked. I think its due to the size of his place and how much is needed to replicate

There’s no problem with always using WaitForChild() just to be safe, but in terms of when it’s actually needed there’re only a few cases as pointed out in this thread: When to wait for replication to the client