local part = game.Workspace.Provinces[script.selectedProvinceVal.Value.Name]
local border_lands = 0
for i, v in(part:GetTouchingParts()) do
if(v.Parent.Name == "SeaPartsF") then
print("province is bordering a sea part")
else
if(v.province_owner.Value == game.ReplicatedStorage.Values.FactionFolder.FactionInfo.NationName.Value) then
border_lands = border_lands + 1
end
end
end
so this here is the code, the only issue is, all the stuff it touches are meshes and all of the rest are unions, is there a way to use GetTouchingParts for meshes/unions?
Are your all your parts anchored? Correct me if i’m wrong but I think “touching” is handled by physics. Both parts cannot be anchored to find anything “touching”. Here’s a video of what I mean:
At least ONE item has to be controlled by physics and not anchored.
It may be because you aren’t getting the touching parts of a part, but rather a string. Correct me if I’m wrong:
local part = game.Workspace.Provinces[script.selectedProvinceVal.Value.Name]
--- ^ Name is a string
part:GetTouchingParts()
-- ^ part is still a string
I’m confused what the issue is. It seems like it’s working how it’s supposed to. Can you expand on your issue a bit more? A video of the problem also might help.
You should use GetPartsInPart() instead of GetTouchingParts(). GetTouchingParts() seems to rely on Roblox’s physics, just like the Touched event.
With GetPartsInPart you can whitelist/blacklist any part you’d like using RaycastParams.
Did you check if the parts that are supposed to be detected by GetTouchingParts() have CanCollide on? It checks if there’s any part physically touching another part, unlike GetPartsInPart checks for geometry and doesn’t care about CanCollide.