"Property BasePart.CFrame is not safe to write in parallel"

Hi,

So Earlier when I was optimizing some functions to run using Parrellel Lua, I was thinking that I can try to use for a mesh that would orbit the player, which is the code here:

local clock = os.clock() -- should I be using tick()?

-- these math functions may be incorrectly used as I was moving them around
-- the x, y, and z axis to get the desired effect.
local x = math.cos(clock) * 2
local z = math.sin(clock) * 2

local eq = CFrame.new(x, 2, z)
					
mesh.CFrame = Character.Head.CFrame * eq

But when running in Parallel using ConnectParallel , It gave me the error in the Topic Name, Why is this the case?

Would I need to use task.synchronize() for this purpose?

Edit: This is my first time actually trying to do Parallel Lua, so I may not exactly understand some things

Because it’s not a threadsafe property. Use this guide in the roblox docs:

And the explanation for the concept behind thread safety:

1 Like

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