hello I’m having problems with a cave system game for my friend.
I’m not sure how I would go about a system that will create like air pockets with blocks around it
yes, I’ve heard about noise but I’ve never used anything nor can I find anything that helps with this
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
i’ve looked for a forum for this and couldn’t find it or well I did but they aren’t close to what I’m trying to do I know air and stone but I’m unsure on how to make it create a air pocket with blocks around it
if someone could forward a forum that talks about this would be great or give me a good idea on how to do this
this script is a script I found but it creates a entire cave I need just air pockets how could I change it to fit that? and I don’t understand this script very well (i think)
from what I understand this creates a cave on a seed and noise and picks if the block being placed should be air or stone
Have you tried changing the script at all?
yes I have and well I’m not very good at scripting or math or really anything with this Its all very new to me so I changed some things and that was it.
local size = Vector3.new(35, 35, 35)
local scale = script.cavePart.Size.X
local threshold = 0
local seed = Random.new():NextInteger(0, 1)
local frequency = 1/16
function density(p:Vector3):number
return math.noise(
p.X * frequency,
p.Y * frequency,
p.Z * frequency
)
end
for x = 1, size.X do
for y = 1, size.Y do
if y%10 == 0 then task.wait() end
for z = 1, size.Z do
local d = density(Vector3.new(x + seed, y, z))
if d < threshold then continue end
local block = script.cavePart:Clone()
block.CFrame = script.cavePart.CFrame * CFrame.new(x * scale, y * scale, z * scale)
block.Parent = workspace
end
end
end