local iron = game.ReplicatedStorage.IronOre
local stone = game.ReplicatedStorage.StoneOre
local ores = 0
function RandomGen()
while ores <= 20 do
local newmodel = iron:Clone()
local newmodel2 = stone:Clone()
newmodel:MoveTo(Vector3.new(math.random(-247, 248), 2.52, math.random(-249, 249)))
ores = ores + 1
wait (.3)
end
end
I am not very good with scripting but I'm trying to make it so that a ore will randomly spawn somewhere within the map.

6 comments
Is there a way I can make them not spawn on top of each other?
Yes. Instead of using MoveTo, use SetPrimaryPartCFrame. Because CFrame allows objects to clip eachother. Just make sure you have the PrimaryPart set.
I am not quite sure how to do that... Sorry for being a noob.
Just look up whatever you don't understand on the wiki, for example, http://wiki.roblox.com/index.php?title=API:Class/Model/SetPrimaryPartCFrame
That wiki page doesn't make any sense to me.
You can ask a question about specifically what you don't understand