local HttpService = game:GetService("HttpService") -- Configuration local CENTERATORIGIN…
- User
local HttpService = game:GetService("HttpService")
-- Configuration local CENTER_AT_ORIGIN = true -- Set this to false if you don't want to center the structures
-- Road color mapping local ROAD_COLORS = { motorway = Color3.fromRGB(250, 158, 37), trunk = Color3.fromRGB(255, 195, 69), primary = Color3.fromRGB(255, 216, 97), secondary = Color3.fromRGB(255, 255, 179), tertiary = Color3.fromRGB(255, 255, 255), residential = Color3.fromRGB(223, 223, 223), unclassified = Color3.fromRGB(191, 191, 191), default = Color3.fromRGB(168, 168, 168) }
-- Terrain color and height mapping local TERRAIN_COLORS = { water = { color = Color3.fromRGB(0, 0, 255), height = 0 }, grass = { color = Color3.fromRGB(0, 255, 0), height = 0 }, forest = { color = Color3.fromRGB(34, 139, 34), height = 0 }, residential = { color = Color3.fromRGB(223, 223, 223), height = 0 }, }
-- Function to fetch data from Overpass Turbo API local function fetchOverpassData(lat, lon, radius) local query = string.format([[ [out:json]; ( way["building"]"height"; way"highway"; way"natural"~"water|wood"; way"landuse"; ); out geom; ]], radius, lat, lon, radius, lat, lon, radius, lat, lon, radius, lat, lon)
local url = "https://overpass-api.de/api/interpreter" local response = HttpService:PostAsync(url, query) return HttpService:JSONDecode(response)end
-- Function to create a wall between two points local function createWall(point1, point2, height, parent) local wall = Instance.new("Part") wall.Anchored = true wall.Material = Enum.Material.Concrete wall.Color = Color3.new(0.8, 0.8, 0.8)
local distance = (point1 - point2).Magnitude wall.Size = Vector3.new(0.5, height, distance) local midpoint = (point1 + point2) / 2 local direction = (point2 - point1).Unit local rightVector = Vector3.new(-direction.Z, 0, direction.X) wall.CFrame = CFrame.fromMatrix(midpoint + Vector3.new(0, height/2, 0), rightVector, Vector3.new(0, 1, 0), -direction) wall.Parent = parentend
-- Function to sanitize attribute names local function sanitizeAttributeName(name) -- Replace any non-alphanumeric character with underscore local sanitized = name:gsub("[^%w]", "_")
-- Ensure the name starts with a letter if sanitized:match("^%d") then sanitized = "a_" .. sanitized end return sanitizedend
-- Function to safely set attributes local function safeSetAttribute(instance, key, value) local sanitizedKey = sanitizeAttributeName(key) -- Convert value to string if it's not a number or boolean if type(value) ~= "number" and type(value) ~= "boolean" then value = tostring(value) end instance:SetAttribute(sanitizedKey, value) end
- Assistant