I want these buildings to always be in a different spot so they dont collide, but I don’t know how.
(dont mind highlights roblox issue)
for i,v in pairs(GameBase:SurroundingHexIn(GameBase:GetTilePos(TileMesh))) do
local sTileData = GameBase:GetTile(v)
local TileBody = GameBase:GetTileMesh(v)
local TileBodyBuildings = #TileBody:GetChildren()
if TileBodyBuildings == 5 then return end
for i = 1,math.random(2,4) do
local buildings = MiniBuildingFolder:GetChildren()
local RandomBuilding = buildings[math.random(1, #buildings)]:Clone()
if sTileData:GetAttribute("Building") then return end
RandomBuilding.Parent = TileBody
RandomBuilding:SetPrimaryPartCFrame(
CFrame.new(TileBody.Position + Vector3.new(math.random(0.5,1), TypeData[sTileData:GetAttribute("type")].Size/2 * TileScale, math.random(0,1))))
end
end
code
