This has genuinely caused me so much confusion, I do not know why this is happening, I do not know why using the print function magically fixes this. Using the wait function, task.wait or wait still wouldn’t fix the issue.
for _, Server in pairs(Assets.Servers:GetChildren()) do
print(Server,Server:FindFirstChildWhichIsA("ModuleScript"))
local Module = require(Server:FindFirstChildWhichIsA("ModuleScript"))
for Key, Value in pairs(Module) do
Server:SetAttribute(Key, Value)
end
end
If I were to comment this line:
print(Server,Server:FindFirstChildWhichIsA("ModuleScript"))
It would result in this error and if not commented it would run fine.
Attempted to call require with invalid argument(s). - Server - Servor:45
Stack Begin - Studio
Script 'ServerScriptService.Main.Servor', Line 45 - Studio - Servor:45
Stack End
As far as I know, my knowledge cannot answer this which is why I’m seeking help from more intelligent users. Thanks.
I have no idea. Maybe a delay??
For real though, this happens to me a lot as well, to the extent that sometimes I feel like scripting is like parenting in the sense that if you just leave your kids alone to do what they want, they’ll probably end up doing some whack stuff.
Forgot to add this but adding a wait function still won’t fix this issue but still thanks for the help.
1 Like
what are the contents of the getchildren and do all of the children have a module script?
So far I only have one child with a ModuleScript in it, I think this can explain and give more context about it.
Okay, I figured out, I had the same code in an another script, simply stupid me. Still I want to thank for the help.
1 Like
Have you tried playing with the thought of making the ModuleScript a local variable?
ModuleScript = Server:FindFirstChildWhichIsA(“ModuleScript”)
or
ModuleScript = Server:WaitForChild(“ModuleScript”)
or
ModuleScript = Server.ModuleScript
or just ignore above and try:
local Module = require(Server.ModuleScript)