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
end
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?