Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I tried to make a script that spawns 50 ores in an area, but they are overlapping each other?

Asked by 4 years ago
Edited 4 years ago
max = 50
amount = 0


while wait do
x = math.random(288,380)
y = 20.5
z = math.random(-387,-277)
    if amount ~= max then
        local part = Instance.new("Part")
        part.Parent = script.Parent
                part.Name = "Iron"
        part.Anchored = true
        part.Position = Vector3.new(x,y,z)
        amount = amount + 1
        wait(10)
    if amount == max then
        script.Parent.Iron:remove()
        amount = amount - 1
        wait(10)
        end
    end
end

Answer this question