Basically I'm making a building system but I don't want players to be able to place parts near each other. (hard to explain here but that's the premise). My idea was to loop through all the parts that're placed, do some mathy stuff to see how close the part is, and if its closer than 10 studs it wouldn't allow the player. It seems very inefficient and possibly could cause lag if loads of parts are placed down. This is all happening from a LocalScript by the way. Anyone else have a better method of how I would do this?
So what you do is minus the Vector3 of first part then the Vector3 of second part then use .magnitude to get the distance from them i think it is in studs.
Make a variable for part1 and part2
local distance = (part1.Position - part2.Position).magnitude print(distance )
part1.Postion
returns that parts Vector3