Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would I make generation for my mining game; summoning ore scattered?

Hi, I'm here again wondering how to make some mine generation. I don't know the rest on what to do to make the objects appear. It's meant to be atleast 6 by 6 blocks wide and 10 blocks deep.
To be honest, I have had help with this but not sure what to do next.

Script Is here.


local ores = {"Zinc", "Copper", "Iron"}

for x=1, (2) do
   for Y=1, (2) do
    for Z=1, (2) do
    Block Generation Here = CFrame.new(Vector3.new(X,Y,Z))) --What to Use for the blocks position, scattering ores if possible.
  end
 end
end 

Credits: JackADevil, discord.

1 answer

✓ Accepted answer

You can create a table with all the ores then randomly select an ore from the table and clone it from replicated storage and position it at the Ores you are replacing like this.

local Ores = {"Ore1","Ore2","Ore3","Ore4"}

for i,v in pairs(game.Workspace.Ores:GetChildren()) do
	local OreRandomizer = math.random(1,#Ores)
	local ChosenOre = Ores[OreRandomizer]
	local OreClone = game.ReplicatedStorage.Ore:WaitForChild(ChosenOre):Clone()
	OreClone.Parent = workspace
	OreClone.CFrame = v.CFrame
	v:Destroy()	
end

2 comments

0

You are a legend, thank you so much!

0

Np

This discussion is preserved as it was. New answers, comments, and votes are closed.