Hello!
What do you want to achieve?, Basically what I am trying to do is to make randomized rock spawning on my map.
What is the issue? The issue is that I have some decorations on my map and I don’t want any rocks in those areas. ( the red areas mean not to generate rocks in it)
–after I run the game
So how would I generate rocks outside of those red areas?
local Rocks = {
["StarterRocks"] = {
["FirstRocks"] = {
-- ["Position"] = {-479.141,-304.237,2.29,-156.5,143.3},
["Position"] = {90,305,-30,-120,172},
["Size"] = {7,10,5,10,3,8},
["Orientation"] = {0,360}
},
["FirstRocks2"] = {
-- ["Position"] = {-479.141,-304.237,2.29,-156.5,143.3},
["Position"] = {90,305,-30,-120,172},
["Size"] = {9,13,8,13,6,9},
["Orientation"] = {0,360}
},
["FirstRocks3"] = {
-- ["Position"] = {-479.141,-304.237,2.29,-156.5,143.3},
["Position"] = {90,305,-30,-120,172},
["Size"] = {14,17,10,15,9,12},
["Orientation"] = {0,360}
}
}
}
--left upper -304.019, 2.289, -156.861
--right buttom -479.141, 2.289, 143.5.
local serverStorage = game:GetService("ServerStorage")
local starterBarrier = {}
for i,v in pairs(workspace.NoRocksHere.starter_map_barriers:GetChildren()) do
table.insert(starterBarrier,v)
end
for i=0,15,1 do
for _,y in pairs(serverStorage:WaitForChild("Rocks"):GetChildren()) do
for i,v in pairs(y:GetChildren()) do
local v = v:Clone()
local rockhitbox = v.RockHitbox
local Table = Rocks[y.Name][v.Name]
local Postion = Vector3.new(math.random(Table.Position[1],Table.Position[2]), Table.Position[3],math.random(Table.Position[4],Table.Position[5]))
local Size = Vector3.new(math.random(Table.Size[1],Table.Size[2]), math.random(Table.Size[3],Table.Size[4]), math.random(Table.Size[5],Table.Size[6]))
local Orientation = Vector3.new(0, math.random(Table.Position[1],Table.Orientation[2]), 0)
v.Parent = workspace:WaitForChild("Rocks")
v.Position = Postion
v.Size = Size
v.Orientation = Orientation
rockhitbox.Position = Postion
rockhitbox.Size = Size + Vector3.new(2,2,2)
rockhitbox.Orientation = Orientation
end
end
end