Lua takes care of multiple source accessing for you?

I was wondering if I had to create a buffer system for my project as I had values that could be accessed at any moment many times, so I tested out creating this script:

local valueGiven = 0
local intvalue = script.Parent:WaitForChild("Value")

for i = 1,100,1 do
	local newValue = math.random(1,100)
	intvalue.Value += newValue
	valueGiven += newValue

print ("I gave "..tostring(valueGiven))

then duplicating the script several times so all the scripts edit the same IntValue at the same time with random values. (You could add up the prints to see that the IntValue results in the same result).

My question is: Does Roblox handle accessing the same data at the same time for you from multiple threads? Or was this just a case of a perfect environment since nothing else is going on and it’s being tested on Studio?

1 Like

Right now there is no multi threading for scripts, so you don’t have to worry about race conditions due to multi threading.

1 Like

Ahh thanks a lot it saves the extra work to manage that sort of data management and I couldn’t find the resource

1 Like