How Can I Make This Code Make Islands Like Skyven?

I Want to make this code generate islands like skyven, this is my current code but i need it to make floating islands



function Generation.GenerateIsland(X,Z,Grid)
	for x = 1, X do
		Grid[x] = {}
		
		for z = 1, Z do
			Grid[x][z] = math.noise(x/10,z/10) * 15
		end
	end
	
	for x = 1, X do
		for z = 1, Z do
			local Y = Grid[x][z]			
			local Part = Instance.new("Part")
			Part.Anchored = true
			Part.Parent = workspace.Generated
			Part.Size = Vector3.new(math.random(5,20),30,math.random(5,20))
			Part.Material = Enum.Material.SmoothPlastic
			Part.Position = Vector3.new(x+Part.Size.X * 5,Y,z+Part.Size.Z * 5)
			Part.BrickColor = BrickColor.new("Medium stone grey")
			Part.TopSurface = Enum.SurfaceType.Smooth
			Part.BottomSurface = Enum.SurfaceType.Smooth
			
			local Grass = Instance.new("Part")
			Grass.Anchored = true
			Grass.Position = Vector3.new(x+Part.Size.X* 5,(Part.Position.Y + Part.Size.Y) - 14.9,z+Part.Size.Z * 5)
			Grass.Parent = workspace.Generated
			Grass.Size = Vector3.new(Part.Size.X,0.2,Part.Size.Z)
			Grass.Material = Enum.Material.SmoothPlastic
			Grass.BrickColor = BrickColor.new("Forest green")
			Grass.TopSurface = Enum.SurfaceType.Smooth
			Grass.BottomSurface = Enum.SurfaceType.Smooth
		end
	end
end

return Generation```
1 Like

Heres what they look like in skyven btw

1 Like

I know this doesn’t quite answer your question, but it is an alternative. How about instead of literally creating an island in a script, you have pre made island pieces that can be randomly selected and positions to put together a unique island every time (or change it so it’s the same every time).

I hope this makes sense and give you another idea.

1 Like

Modified the code to add a new layer

	for x = 1, X do
		Grid[x] = {}
		
		for z = 1, Z do
			Grid[x][z] = math.noise(x/10,z/10) * 15
		end
	end
	
	for x = 1, X do
		for z = 1, Z do
			local Y = Grid[x][z]			
			local Dirt = Instance.new("Part")
			Dirt.Anchored = true
			Dirt.Parent = workspace.Generated
			Dirt.Size = Vector3.new(math.random(5,20),30,math.random(5,20))
			Dirt.Material = Enum.Material.SmoothPlastic
			Dirt.Position = Vector3.new(x+Dirt.Size.X * 5,Y,z+Dirt.Size.Z * 5)
			Dirt.BrickColor = BrickColor.new("Medium brown")
			Dirt.TopSurface = Enum.SurfaceType.Smooth
			Dirt.BottomSurface = Enum.SurfaceType.Smooth
			
			local Grass = Instance.new("Part")
			Grass.Anchored = true
			Grass.Position = Vector3.new(x+Dirt.Size.X* 5,(Dirt.Position.Y + Dirt.Size.Y) - 14.9,z+Dirt.Size.Z * 5)
			Grass.Parent = workspace.Generated
			Grass.Size = Vector3.new(Dirt.Size.X,0.2,Dirt.Size.Z)
			Grass.Material = Enum.Material.SmoothPlastic
			Grass.BrickColor = BrickColor.new("Forest green")
			Grass.TopSurface = Enum.SurfaceType.Smooth
			Grass.BottomSurface = Enum.SurfaceType.Smooth
			
			local Stone = Instance.new("Part")
			Stone.Anchored = true
			Stone.Position = Vector3.new(x+Dirt.Size.X* 5,(Dirt.Position.Y - Dirt.Size.Y),z+Dirt.Size.Z * 5)
			Stone.Parent = workspace.Generated
			Stone.Size = Vector3.new(Dirt.Size.X,30,Dirt.Size.Z)
			Stone.Material = Enum.Material.SmoothPlastic
			Stone.BrickColor = BrickColor.new("Medium stone grey")
			Stone.TopSurface = Enum.SurfaceType.Smooth
			Stone.BottomSurface = Enum.SurfaceType.Smooth
		end
	end
end
1 Like

I dont know how to position the pieces

1 Like

Sorry, I’m currently not on my pc but I’ll try to explain the best of my abilities. You can have a folder of multiple island pieces in server storage or replicated storage (idk if you want it server or client sided. From there you would clone the pieces and parent them to workspace (or probably a folder in workspace it keep it organized). About setting the position randomly, I’d recommended looking about the dev forum or documentation page, maybe even tutorials. Here’s a helpful link:

Or this post: Is there a way to change models position

1 Like

Does positioning models via :PivotTo() work for you?

1 Like

Ill just do this 30 30 30 30 30

1 Like

You should always use :PivotTo when moving a model.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.