So I want to make a pretty road generator, but sometimes the roads overlap. In order to prevent that I added a hitbox part to each road model with a script that detects if the hitbox detects another hitbox part. If the hitbox part detects another hitbox part, the road model gets destroyed.
For some reason, the hitbox part doesn’t detect being touched by other hitbox parts and the script doesn’t work
As you can see some roads still overlap and it looks bad. The hitboxes do detect if they touch decorations like those rocks on the right.
WorldRoot is the game instance. Raycasts also use the WorldRoot.
Example of this function:
local road = game.Workspace.Road
local partsInRoad = game:GetPartsInPart(road)
print(partsInRoad) --//This prints a table with all the parts in the instance