Require in script in ReplicatedFirst hangs infinitely

Hello,

I am so confused because ReplicatedFirst is literally broken.

Screen Shot 2021-07-06 at 5.06.04 PM

print("Hello world!")

Nothing outputs???

Edit: I got it to work again but now requiring causes it to hang infinitely.

local clientHandler = modules:WaitForChild('ClientHandler')

print('ch') -- prints

clientHandler = require(clientHandler) 

print('ok') -- no

Looking at the documentation for it ReplicatedFirst | Roblox Creator Documentation It may be because its the first thing loaded [before logservice?]. Try rendering a GUI on the client and seeing if it displays… if it doesn’t then there is something wrong.

I’m, not a good scripter myself but i don’t think you can use replicated first to print stuff in the output

I doubt it is broken. I think it’s something around that print unable to display to the console? I don’t know. I’m looking into it to see if I can replicate.

I just ran a test and it does work as intended. Perhaps you were using Run and not Play Solo.

delay(3,function()
	print('I LOVE MINECRAFT')
end)

The console just needs some time to load.

Yeah, I had a second script that does that but it didn’t load, restarting the game caused it to fix itself but now it’s getting stuck infinitely on requiring a module script.

Then perhaps parent the module script to the localscript, and try loading it directly… that way it is loaded at the same time as the localscript.

Nothing.

Screen Shot 2021-07-06 at 5.18.57 PM

local clientHandler = script:WaitForChild('ClientHandler')

print('ch')

clientHandler = require(clientHandler)

Is there any output (perhaps any infinite yields?)

Also, printing won’t work because your console may not load fast enough (unless you view the output dock)

1 Like

You shouldn’t need to wait for the child because it already exits as it’s replicated first with the LocalScript. Try calling it directly in the require. Also once again, it may not be that it is yielding, but you may just not get any output due to it being loaded before everything else.

1 Like

Yeah that was the problem, infinite yield but it still wasn’t running at all at first so I have no idea what went wrong.

1 Like

Look into the ClientHandler. I tried to artificially yield the script for 20 seconds and it printed even 20 seconds after. I think something in that code prevents it from continuing.

1 Like