You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I wanna make a map border to my game or a falloff map
-
What is the issue? I am making a survival game with procedural terrain but the borders of the map looks weird
-
What solutions have you tried so far? I tried to search everywhere the falloff map but what I found is in C# and I don’t understand anything of C#
here is my terrain I wnna make a good border for it
here is my code
the code can be a little bad because im kinda new in roblox
local RunService = game:GetService("RunService")
local Terrain = workspace.Terrain
local Chances = script.Parent.Chances
local Max = script.Parent.Max
local MAX_OF_ROCKS = Max.MAX_OF_ROCKS
local MAX_OF_GROUND_ITEMS = Max.MAX_OF_GROUND_ITEMS
local SPAWNED_ROCKS = 0
local SPAWNED_GROUND_ITEMS = 0
local function GenerateTrees(Part)
local Chance = math.random(0, Chances.CHANCE_OF_TREES.Value)
local Type = math.random(1, 2)
if Part.Position.Y > -20 then
if Chance == 0 then
local Y = nil
if Type == 1 then
Y = 16
else if Type == 2 then
Y = 15.5
end
end
local A = game.ServerStorage.Models.Trees["Tree0" .. Type]:Clone()
A.Position = Vector3.new(Part.Position.X, Part.Position.Y + Y, Part.Position.Z)
A.Parent = workspace.GameGenerated.Trees
end
end
end
local function GenerateRocks(Part)
local Chance = math.random(0, Chances.CHANCE_OF_ROCKS.Value)
local Type = math.random(1, 1)
if Part.Position.Y >= -18 then
if Chance == 0 then
if SPAWNED_ROCKS < MAX_OF_ROCKS.Value then
SPAWNED_ROCKS = SPAWNED_ROCKS + 1
local Touched = false
local A = game.ServerStorage.Models.Rocks["BigRock0" .. Type]:Clone()
A.Position = Vector3.new(Part.Position.X, Part.Position.Y + 13, Part.Position.Z)
A.Parent = workspace.GameGenerated.Rocks
A.Anchored = false
end
end
end
end
local function GenerateWater()
local A = Instance.new("Part")
A.Name = "GeneratedWater"
A.Parent = workspace.GameGenerated.Water
A.Size = Vector3.new(2048, 151.705, 2048)
A.Position = Vector3.new(814, -92.212, 814)
A.Anchored = true
A.CanCollide = false
A.Transparency = 0.7
A.Reflectance = 1
A.Color = Color3.fromRGB(10, 195, 231)
A.Material = "Sand"
A.TopSurface = "Smooth"
end
local function SpawnGroundItems(Y)
local Chance = math.random(0, Chances.CHANCE_OF_GROUND_ITEMS.Value)
local Items = {"Stick", "Rock01"}
local ItemSelected = Items[math.random(1, #Items)]
if Chance == 0 then
if SPAWNED_GROUND_ITEMS < MAX_OF_GROUND_ITEMS.Value then
local X = math.random(74.007, 1350.594)
local Z = math.random(54.614, 1322.585)
SPAWNED_GROUND_ITEMS = SPAWNED_GROUND_ITEMS + 1
local A = game.ServerStorage.Models.Misc:WaitForChild(ItemSelected):Clone()
A.Position = Vector3.new(X, Y + 15, Z)
A.Parent = workspace.GameGenerated.GroundItems
A.Orientation = Vector3.new(90, math.random(-180,180), 0)
A.Anchored = false
end
end
end
local function GenerateTerrain()
local X = 300
local Z = 300
local MX = -15
local MZ = 43.875
local SpawnPartX = math.random(1, 200)
local SpawnPartZ = math.random(1, 200)
local Seed = math.random(1000000)
local Grid = {}
for x = 1, X do
Grid[x] = {}
for z = 1, Z do
Grid[x][z] = math.noise(Seed, x/25, z/25) * 60
local yPos = Grid[x][z]
local Part = Instance.new("Part")
Part.Name = "GeneratedPart"
Part.Anchored = true
Part.Position = Vector3.new(x*5, yPos, z*5)
Part.Size = Vector3.new(5, math.random(8,12), 5)
Part.Color = Color3.fromRGB(53, 55, 62)
Part.CanCollide = false
Part.Transparency = 1
Part.Parent = workspace.GameGenerated.Terrain.Terrain
if x == SpawnPartX then
if z == SpawnPartZ then
local Spawn = Instance.new("SpawnLocation")
Spawn.Parent = workspace.GameGenerated.Spawns
Spawn.Size = Vector3.new(5,1,5)
Spawn.Position = Vector3.new(Part.Position.X, Part.Position.Y + 40, Part.Position.Z)
Spawn.CanCollide = false
Spawn.Anchored = true
Spawn.Transparency = 1
if RunService:IsStudio() then
workspace.WorkTable.TestPlate:MoveTo(Vector3.new(Spawn.Position.X, Spawn.Position.Y - 3, Spawn.Position.Z))
else
workspace.WorkTable.TestPlate:Destroy()
end
end
end
if yPos > -20 then
Terrain:FillBlock(Part.CFrame, Part.Size, "Grass")
else if yPos <= -20 then
Terrain:FillBlock(Part.CFrame, Part.Size, "Sand")
end
end
SpawnGroundItems(Part.Position.Y)
GenerateTrees(Part)
GenerateRocks(Part)
end
end
end
GenerateWater()
GenerateTerrain()
wait(5)
workspace.GameGenerated.Scripts.Generation.Generated.Value = true