Ad
Log in to vote
0

How can i reduce brick lag from a terrain gen script?

Asked by
NexeusX 122
1 year ago
Edited 1 year ago

I made my own terrain generation script after a couple hours of testing, and it generates 3x3 bricks randomly...my problem is that i want the map to be pretty big but the amount of bricks causes major lag is there a solution to fix the lag?

Here is the script, but there are StringValues in the script itself.

DataBase = {}
table.insert(DataBase, script.Material_1.Value)
table.insert(DataBase, script.Material_2.Value)
table.insert(DataBase, script.Material_3.Value)
table.insert(DataBase, script.Material_4.Value)
table.insert(DataBase, script.Material_5.Value)
table.insert(DataBase, script.Material_6.Value)
NumBers1 = script.Parent.Name * 6
total = 60 - NumBers1

for i = -3,3, .1 do
  for j = -3,3, .1 do
    wait()
    y = math.log (1) * (i^1 + j^1) - 1
    choose = (DataBase[math.random(1,6)])
    nex = game.Lighting.Terrain:FindFirstChild(choose)
    p = nex:clone()
    p.CFrame = CFrame.new(Vector3.new(60*i, total*y, 60*j))
    p.Anchored = true
    p.BottomSurface = "Smooth"
    p.TopSurface = "Smooth"
    p.Parent = game.Workspace
  end
end

0
Can you post the script. kingdom5 3059 — 1y
0
i posted it NexeusX 122 — 1y

Answer this question



Ad