Can parallel be used here?

There needs to be more than 1 actor for this to work.

Also, instead of doing this:

for i = 1, 1000 do
	task.synchronize()
	something.Value = i
	task.desynchronize()
end

You should do this:

local dict = {}

for i = 1, 1000 do
	dict[something] = i
end

task.synchronize()

for object, value in dict do
	object.Value = value
end

Since using task.synchronize every loop will hurt performance:

oh yeah, forgot to update on this but I’ve updated the parallel sided function to this:
image

1 Like

began using your module, my thing is server-sided so it always errors because that LocalScript always tries to require the module, which is in ServerScriptStorage

Oh alright, good, apologies if you posted it earlier, I didn’t see it.

So, I looked into the issue, and it’s not the local script. The issue is on line 155 of the main module

the not is missing, causing it to error every time…

I must have updated it without noticing it somehow. But the version I use in my own game was correct, so I must have corrected the issue without updating the module…

Anyway, I updated the test place, which was broken in studio (but not in roblox because apparently I didn’t publish the change), and the model (although that one was not updated and was still working…?)

I don’t even remember what is the change I did to it lol
It seems like I only changed the error message, which I messed up

model still errors

Oh, what are you sending to the parallel function?

Shared tables have limitations:

If you are trying to send a string value or another object, you’ll have to either send its name, or not send it, and write the values to the string value using the table returned by :Work()
But as I said before, that value (assuming you are still using it) is probably the bottleneck in your script

Parallel function (module)

Serial function (script)

image

Seems like it should work,
Could you send what here is?

Also, the order of the elements in the table returned by :Work() is the same as the order the work has been scheduled with :ScheduleWork(), so you would probably be able to avoid sending doneID (sending less stuff also improves performance, by reducing the overhead)

image
(the thing that is inserted to arrayLinked is “here”)

It still doesn’t work?
Everything should be a number or string

right before line 185, can you put print(MergedTable) and send me what it prints?

The error clearly states that an instance was sent through :ScheduleWork() (and later a shared table), and sure enough, when I send an instance, I get the same error
image

The shardTable 100% has no instances in it, as i had that error before, but after my fix, it was resolved.

The only error rn is with the client, where the ClientScript tries to require the script, but can’t because it is in serverscriptservice

The client script doesn’t require the module, it requires the module script in which you put the parallel function
Actually that could be an issue if the local script is able to run inside ServerScriptService (it has RunContext set to client so maybe)
I did try putting the module inside ServerScriptService and using it. I did not run into any issues. Can you send a screenshot of the error please?


The required module doesn’t even have problems, and it shouldn’t be overworked.
image

Oh, this means that the loaded:Work() was called a second time before the previous loaded:Work() returned a value. I don’t see how your code would cause that to happen

Did you update the module after I found the issue on line 155 earlier? The issue caused that same error to appear (when it shouldn’t)

another error

Yep, I am using the latest version rn

(also you should add a line in code that prints a warning at launch when the module isn’t using the latest version)

Still got the problem, any solution?

nvm, i didn’t look at the worker template folder

Still can’t solve the issue, is there possibly an error in your module?