Here’s the script. I’d like to mention as well, that it does not appear to be the script itself, this error generally occurs when the client makes a change to studio over a certain load. For instance, I’m generating terrain with the following script, which works fine up until I generate a certain amount (unknown), similar to how Lito was trying to add a large map to the workspace. It seems to be client change based as other people in the team create were seemingly unaffected and were only able to see bits and pieces of the changes I made. However, soon following the error messages studio will drop in frame rate dramatically and then proceed to promptly crash.
EDIT: The reason this script is wrapped in a pcall function was an attempt to thwart the, at the time, unknown error, this still caused the bad allocation error to occur but without specificity to where the error was being returned from, the error is normally reported at the first line of the while loop. The error will also occur if you try to run any other code through the command bar after the initial error is returned.
local timesthrough = 0
local Origin = CFrame.new(0,0,0)
local movedirection = 1
while wait(0.1) do
local Region = Region3.new(workspace.RegionParts.Part1.Position,workspace.RegionParts.Part2.Position)
Region = Region:ExpandToGrid(4)
local p = Instance.new("Part",workspace.OceanFloors)
p.Name = "Floor"
p.Material = Enum.Material.Sand
p.Anchored = true
p.Size = Vector3.new(1000,5,1000)
p.CFrame = Origin * CFrame.new(500,0,500)
p.TopSurface = Enum.SurfaceType.Smooth
p.BottomSurface = Enum.SurfaceType.Smooth
p.BrickColor = BrickColor.new("Cool yellow")
if math.fmod(timesthrough,15) == 0 and timesthrough ~= 0 then
Origin = Origin * CFrame.new(0,0,1000)
movedirection = movedirection * -1
Origin = Origin * CFrame.new(movedirection *1000,0,0)
timesthrough = timesthrough + 1
if workspace.Stop.Value == true or timesthrough == 226 then