Okay; so I'm working on a strategy game revolved around territorial control, and upon a player's join, a capital will be created for them, if it doesn't already exist... now, given that the capital spawns, it's supposed to check if any 'Fog of War' parts intersect with the territory itself, if so, destroy them... I've even tried printing the name of the connected parts, and it merely prints the player's capital.
local function createCapital(player)
if checkMap() == true and game.Workspace:FindFirstChild(player.Name .. "'s Capital") == nil then
local capital = Instance.new("Part", game.Workspace);
capital.Name = player.Name .. "'s Capital";
capital.BrickColor = BrickColor.new(player.TeamColor.Name);
capital.FormFactor = Enum.FormFactor.Custom;
capital.Size = Vector3.new(1, 0.25, 1);
capital.Anchored = true;
capital.Material = Enum.Material.Slate;
local territory = selectTerritory(game.Workspace:FindFirstChild("Map"));
territory:WaitForChild("Fog of War"):Destroy();
territory.BrickColor = capital.BrickColor;
capital.CFrame = CFrame.new(territory.Position) * CFrame.new(0, 0.25, 0);
local mesh = Instance.new("CylinderMesh", capital);
local capitalized = Instance.new("BoolValue", territory);
capitalized.Name = "Capitalized";
capitalized.Value = true;
wait(1);
for _, connected in next, territory:GetTouchingParts() do
if connected.Name == "Fog of War" then
connected:Destroy();
end
end
end
end

2 comments
Of course! I forgot to make them collidable! I'll take a look at Region3 too, thank you!
No problem :)