I’m trying to improve my web swinging system. I have a targeting system using :Dot() to find out what part is the closest part to the player for the web to attach to. Here’s a little run down of how it works:
The script uses run service and uses a for i, v loop to loop through all the attachment points in the map. If it’s in the :Dot() range, it adds that part to the table and the part’s index in the table depends on how far it was from the player. The closer the part, the higher the index. Then it picks the first item in that table.
The system is good, but not great. It detects parts through walls and through other buildings, and also I don’t want it to detect parts under the player’s character, only above them. I was thinking of using raycasting to fix this. I know how to use raycasting, but I don’t know how I can do this efficiently. Can anyone please help me on how I can achieve this?