Creating a Sphere Using Noise

Currently I’m working on a game, I’m trying to make a randomly generated sphere as a planet. I’m running into a problem where my planet making script is generating Minecraft terain instead of a planet like structure

I made Minecraft terain on purpose but I could not make it into a planet like structure.

This is my Code -

-------------------------------------------------------------------------- Varibels
local Player = game.Players.LocalPlayer

local usi = game:GetService(“UserInputService”)

local RunService = game:GetService(“RunService”)

local CurrentSeed = Instance.new(“IntValue”, Player)

CurrentSeed.Value = 0

CurrentSeed.Name = “Seed”

mapxsize = 100

mapysize = 61

mapzsize = 100

noisescale = 40

amp = 24

psize = 3

-------------------------------------------------------------------------- Makeing of the Map

local function MakeMap ()


-------------------------------------------------------------------------- Has Custom Seed

for x=0,mapxsize do
	
for z=0,mapzsize do
		
for y=0,mapysize do
			
if CurrentSeed.Value == 0 then
	
seed = math.random(-1000000, 1000000)
	
wait()	
		
CurrentSeed.Value = seed

end

xnoise = math.noise(-y/noisescale,z/noisescale, CurrentSeed.Value) *amp
			
ynoise = math.noise(-x/noisescale,z/noisescale, CurrentSeed.Value) *amp
			
znoise = math.noise(-x/noisescale,y/noisescale, CurrentSeed.Value) *amp

-------------------------------------------------------------------------- Part Settings

density = xnoise+ynoise+znoise+y
			
if density < 20 and density > 15 then
				
part = Instance.new("Part",workspace.TerainFolder)
				
part.Anchored = true
				
part.Size = Vector3.new(psize,psize,psize)
				
part.CFrame = CFrame.new(x*psize,y*psize,z*psize)
				
part.Material = Enum.Material.SmoothPlastic				

-------------------------------------------------------------------------- Part.Materials, colors

– Water

if part.Position.Y >5 and part.Position.Y <30 then
					
part.BrickColor = BrickColor.new("Deep blue")

–Grass

else

if part.Position.y >29 and part.Position.Y <31 then
						
part.BrickColor = BrickColor.new("Light yellow")						

else

if part.Position.Y <4 then
							
part.BrickColor = BrickColor.new("Quill grey")													

else

if part.Position.Y >31 and part.Position.Y <65 then
						
part.BrickColor = BrickColor.new("Slime green")						

else

if part.Position.Y >64 and part.Position.Y <78 then
									
part.BrickColor = BrickColor.new("Medium stone grey")									

else

if part.Position.Y >77 then
										
part.BrickColor = BrickColor.new("Lily white")										

end

end

end

end

end

end

end

end

end
wait()
end

wait(0.5)

CurrentSeed.Value = 0

end

usi.InputBegan:Connect(function(Key)

if Key.KeyCode == Enum.KeyCode.G then

MakeMap()	

end

end)

usi.InputBegan:Connect(function(Key)

if Key.KeyCode == Enum.KeyCode.G then

	workspace.TerainFolder:ClearAllChildren()		

end

end)

I’m a new dev so my code is not amazing

Check this out