My Question I generated a cave system with perlin noise, but I cant figure out how to make the generated blocks minable with a pickaxe. If anyone can help me that would be epic!
Sidenotes
Btw I know how to do it by inserting a script into each block but that would cause immense amounts of lag!
IMGUR Link
Generation Script -Generation.lua-
local mxs = 32
local mys = 128
local mzs = 32
local seed = math.random(0,1000000)
local ns = 20
local amp = 25
local ores = {'Coal','Iron','Silver','Sulfur'}
local colors = {Color3.new(0, 0, 0),Color3.new(0.72549, 0.72549, 0.72549),Color3.new(0.368627, 0.368627, 0.552941),Color3.new(1, 1, 0.498039)}
local deepness = {500,450,425,475}
local hp = {10,15,20,5}
local prices = {15,20,70,130}
--
for x = 0,mxs do
for z = 0,mzs do
for y = 0,mys do
local xnoise = math.noise(y/ns,z/ns)*amp
local ynoise = math.noise(x/ns,z/ns)*amp
local znoise = math.noise(x/ns,y/ns)*amp
--
local density = xnoise + ynoise + znoise
if density < 15 then
local randomOre = math.random(1,20)
if randomOre == 10 then
local chance = math.random(1,#ores)
part = Instance.new('Part',workspace.Terrain)
part.Name = chance
part.CFrame = CFrame.new(x*4,y*4,z*4)
local name = tonumber(part.Name)
if deepness[name] < part.Position.Y then part:Destroy() end
e = Instance.new('IntValue',part)
e.Name = hp[chance]
e.Value = hp[chance]
part.Color = colors[chance]
part.Anchored = true
part.Size = Vector3.new(4,4,4)
part.Material = Enum.Material.Neon
else
part = Instance.new('Part',workspace.Terrain)
e = Instance.new('IntValue',part)
e.Name = 'Health'
e.Value = 5
part.Color = Color3.fromRGB(200, 200, 200)
part.Anchored = true
part.Size = Vector3.new(4,4,4)
part.CFrame = CFrame.new(x*4,y*4,z*4)
part.Name = e.Value
part.Material = Enum.Material.Slate
if part.Position.Y < 400 then
local rndm = math.random(1,3)
if rndm == 2 then
part.Color = Color3.fromRGB(150, 150, 150)
e.Value = 50
part.Name = e.Value
end
end
if part.Position.Y < 300 then
local rndm = math.random(1,3)
if rndm == 2 then
part.Color = Color3.fromRGB(125, 125, 125)
e.Value = 500
part.Name = e.Value
end
end
if part.Position.Y < 200 then
local rndm = math.random(1,3)
if rndm == 2 then
part.Color = Color3.fromRGB(118, 118, 118)
e.Value = 550
part.Name = e.Value
end
end
if part.Position.Y < 100 then
local rndm = math.random(1,3)
if rndm == 2 then
part.Color = Color3.fromRGB(77, 77, 77)
e.Value = 600
part.Name = e.Value
end
end
if part.Position.Y < 50 then
local rndm = math.random(1,3)
if rndm == 2 then
part.Color = Color3.fromRGB(84, 84, 84)
e.Value = 850
part.Name = e.Value
end
end
end
end
end
end
end
script.Disabled = true

2 comments
maybe u could do it like how massacre miners did, only load the blocks when its needed like when the player is there. otherwise dont
How could I do this?