Log in to vote

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

Asked by
NexeusX 124
7 months ago
Edited 7 months ago

I made my own terrain generation script after a couple hours of testing, and it generates 3x3 bricks 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
    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 =*i, total*y, 60*j))
    p.Anchored = true
    p.BottomSurface = "Smooth"
    p.TopSurface = "Smooth"
    p.Parent = game.Workspace

Can you post the script. kingdom5 2784 — 7mo
i posted it NexeusX 124 — 7mo


Looks like you're using an ad blocker.

That's fine...

No, it really is.

Just, I mean, we put a lot of work into this site, you know?

It would be really really appreciated if you would turn off your ad blocker for our website...

We tried really hard to make our ads as unobtrusive as possible.

If you really hate ads, would you consider a $2 donation via Patreon?

Here's the link.

We love you. We hope you love us too.




Now back to your regularly scheduled Scripting Helpers....




Answer this question