Unintended raycast behaviour

Good morning/afternoon,

I’m struggling to figure out why this raycast for an NPC script isn’t working as intended. It only works at one angle and I don’t understand why. The raycast also only hits my accessories.

Screenshots:
image

Output:

  22:27:30.732  Initialized NPC Zombie. (Workspace.Zombies.Zombie)  -  Server - NPC:141
  22:27:32.499   ▶ no hit (x194)  -  Server - NPC:98
  22:27:35.957  hit  -  Server - NPC:68
  22:27:35.957  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:35.974  hit  -  Server - NPC:68
  22:27:35.974  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:35.991  hit  -  Server - NPC:68
  22:27:35.991  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:36.008  hit  -  Server - NPC:68
  22:27:36.008  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:36.024  hit  -  Server - NPC:68
  22:27:36.024  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:36.040  hit  -  Server - NPC:68
  22:27:36.041  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:36.057  hit  -  Server - NPC:68
  22:27:36.058  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:36.073  hit  -  Server - NPC:68
  22:27:36.074  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:36.090  hit  -  Server - NPC:68
  22:27:36.091  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:36.108  hit  -  Server - NPC:68
  22:27:36.108  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:36.124   ▶ no hit (x39)  -  Server - NPC:98
  22:27:36.774  hit  -  Server - NPC:68
  22:27:36.774  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:36.790  hit  -  Server - NPC:68
  22:27:36.791  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:36.808  hit  -  Server - NPC:68
  22:27:36.808  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:36.824  hit  -  Server - NPC:68
  22:27:36.824  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:36.841  hit  -  Server - NPC:68
  22:27:36.841  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:36.857  hit  -  Server - NPC:68
  22:27:36.857  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:36.874  hit  -  Server - NPC:68
  22:27:36.874  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:36.891  hit  -  Server - NPC:68
  22:27:36.891  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:36.907  hit  -  Server - NPC:68
  22:27:36.907  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:36.924  hit  -  Server - NPC:68
  22:27:36.924  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:36.940   ▶ no hit (x11)  -  Server - NPC:98
  22:27:37.124  hit  -  Server - NPC:68
  22:27:37.124  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:37.140  hit  -  Server - NPC:68
  22:27:37.140  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:37.158  hit  -  Server - NPC:68
  22:27:37.158  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:37.174  hit  -  Server - NPC:68
  22:27:37.174  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:37.191  hit  -  Server - NPC:68
  22:27:37.191  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:37.207  hit  -  Server - NPC:68
  22:27:37.207  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:37.224  hit  -  Server - NPC:68
  22:27:37.224  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:37.240  hit  -  Server - NPC:68
  22:27:37.240  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:37.258  hit  -  Server - NPC:68
  22:27:37.258  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:37.274  hit  -  Server - NPC:68
  22:27:37.274  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:37.290   ▶ no hit (x45)  -  Server - NPC:98
  22:27:38.041  hit  -  Server - NPC:68
  22:27:38.041  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:38.057  hit  -  Server - NPC:68
  22:27:38.057  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:38.074  hit  -  Server - NPC:68
  22:27:38.074  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:38.091  hit  -  Server - NPC:68
  22:27:38.091  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:38.107  hit  -  Server - NPC:68
  22:27:38.107  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:38.124  hit  -  Server - NPC:68
  22:27:38.125  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:38.141  hit  -  Server - NPC:68
  22:27:38.141  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:38.158  hit  -  Server - NPC:68
  22:27:38.158  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:38.173  hit  -  Server - NPC:68
  22:27:38.174  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:38.191  hit  -  Server - NPC:68
  22:27:38.191  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:38.207  hit  -  Server - NPC:68
  22:27:38.208  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:38.223   ▶ no hit (x174)  -  Server - NPC:98
  22:27:41.124  hit  -  Server - NPC:68
  22:27:41.124  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:41.140  hit  -  Server - NPC:68
  22:27:41.141  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:41.157  hit  -  Server - NPC:68
  22:27:41.157  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:41.173  hit  -  Server - NPC:68
  22:27:41.174  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:41.191  hit  -  Server - NPC:68
  22:27:41.191  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:41.207  hit  -  Server - NPC:68
  22:27:41.208  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:41.224  hit  -  Server - NPC:68
  22:27:41.224  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:41.240  hit  -  Server - NPC:68
  22:27:41.240  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:41.258  hit  -  Server - NPC:68
  22:27:41.258  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:41.273  hit  -  Server - NPC:68
  22:27:41.273  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:41.290  hit  -  Server - NPC:68
  22:27:41.290  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:41.307   ▶ no hit (x28)  -  Server - NPC:98
  22:27:41.774  hit  -  Server - NPC:68
  22:27:41.774  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:41.790  hit  -  Server - NPC:68
  22:27:41.791  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:41.807  hit  -  Server - NPC:68
  22:27:41.807  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:41.823  hit  -  Server - NPC:68
  22:27:41.824  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:41.841  hit  -  Server - NPC:68
  22:27:41.841  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:41.857  hit  -  Server - NPC:68
  22:27:41.857  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:41.874  hit  -  Server - NPC:68
  22:27:41.874  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:41.891  hit  -  Server - NPC:68
  22:27:41.891  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:41.908  hit  -  Server - NPC:68
  22:27:41.908  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:41.924  hit  -  Server - NPC:68
  22:27:41.924  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:41.940  hit  -  Server - NPC:68
  22:27:41.940  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:41.957  hit  -  Server - NPC:68
  22:27:41.957  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:41.974  hit  -  Server - NPC:68
  22:27:41.974  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:41.991  hit  -  Server - NPC:68
  22:27:41.991  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:42.009  hit  -  Server - NPC:68
  22:27:42.009  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:42.024  hit  -  Server - NPC:68
  22:27:42.024  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:42.040  hit  -  Server - NPC:68
  22:27:42.040  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:42.057  hit  -  Server - NPC:68
  22:27:42.057  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:42.074  hit  -  Server - NPC:68
  22:27:42.074  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:42.091  hit  -  Server - NPC:68
  22:27:42.091  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:42.108  hit  -  Server - NPC:68
  22:27:42.108  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:42.123  hit  -  Server - NPC:68
  22:27:42.123  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:42.140  hit  -  Server - NPC:68
  22:27:42.140  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:42.158  hit  -  Server - NPC:68
  22:27:42.158  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:42.174  hit  -  Server - NPC:68
  22:27:42.174  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:42.191  hit  -  Server - NPC:68
  22:27:42.191  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:42.208  hit  -  Server - NPC:68
  22:27:42.208  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:42.223  hit  -  Server - NPC:68
  22:27:42.223  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:42.240  hit  -  Server - NPC:68
  22:27:42.240  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:42.257  hit  -  Server - NPC:68
  22:27:42.257  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:42.274  hit  -  Server - NPC:68
  22:27:42.274  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:42.290  hit  -  Server - NPC:68
  22:27:42.291  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.306  hit  -  Server - NPC:68
  22:27:42.307  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.324  hit  -  Server - NPC:68
  22:27:42.325  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.340  hit  -  Server - NPC:68
  22:27:42.341  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.357  hit  -  Server - NPC:68
  22:27:42.357  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:42.374  hit  -  Server - NPC:68
  22:27:42.374  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:42.391  hit  -  Server - NPC:68
  22:27:42.391  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:42.407  hit  -  Server - NPC:68
  22:27:42.407  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:42.424  hit  -  Server - NPC:68
  22:27:42.424  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:42.441  hit  -  Server - NPC:68
  22:27:42.441  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:42.457  hit  -  Server - NPC:68
  22:27:42.457  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:42.473  hit  -  Server - NPC:68
  22:27:42.474  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.491  hit  -  Server - NPC:68
  22:27:42.491  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.507  hit  -  Server - NPC:68
  22:27:42.507  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.524  hit  -  Server - NPC:68
  22:27:42.524  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.540  hit  -  Server - NPC:68
  22:27:42.540  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.557  hit  -  Server - NPC:68
  22:27:42.557  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.573  hit  -  Server - NPC:68
  22:27:42.574  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.590  hit  -  Server - NPC:68
  22:27:42.591  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.607  hit  -  Server - NPC:68
  22:27:42.608  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.624  hit  -  Server - NPC:68
  22:27:42.624  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.640  hit  -  Server - NPC:68
  22:27:42.641  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.657  hit  -  Server - NPC:68
  22:27:42.658  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.674  hit  -  Server - NPC:68
  22:27:42.674  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:42.690  hit  -  Server - NPC:68
  22:27:42.691  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:42.706  hit  -  Server - NPC:68
  22:27:42.707  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:42.723  hit  -  Server - NPC:68
  22:27:42.724  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:42.741  hit  -  Server - NPC:68
  22:27:42.741  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:42.758  hit  -  Server - NPC:68
  22:27:42.758  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:42.774  hit  -  Server - NPC:68
  22:27:42.774  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:42.791  hit  -  Server - NPC:68
  22:27:42.791  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:42.808  hit  -  Server - NPC:68
  22:27:42.808  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:42.823  hit  -  Server - NPC:68
  22:27:42.823  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:42.840  hit  -  Server - NPC:68
  22:27:42.840  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.857  hit  -  Server - NPC:68
  22:27:42.857  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.873  hit  -  Server - NPC:68
  22:27:42.874  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.890  hit  -  Server - NPC:68
  22:27:42.890  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.907  hit  -  Server - NPC:68
  22:27:42.908  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.923  hit  -  Server - NPC:68
  22:27:42.924  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.940  hit  -  Server - NPC:68
  22:27:42.941  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.956  hit  -  Server - NPC:68
  22:27:42.957  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.974  hit  -  Server - NPC:68
  22:27:42.974  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:42.991  hit  -  Server - NPC:68
  22:27:42.991  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:43.007  hit  -  Server - NPC:68
  22:27:43.008  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:43.024  hit  -  Server - NPC:68
  22:27:43.024  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:43.041   ▶ no hit (x51)  -  Server - NPC:98
  22:27:43.891  hit  -  Server - NPC:68
  22:27:43.891  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:43.908  hit  -  Server - NPC:68
  22:27:43.908  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:43.923  hit  -  Server - NPC:68
  22:27:43.924  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:43.940  hit  -  Server - NPC:68
  22:27:43.940  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:43.956   ▶ no hit (x7)  -  Server - NPC:98
  22:27:44.073  hit  -  Server - NPC:68
  22:27:44.073  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:44.090  hit  -  Server - NPC:68
  22:27:44.091  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:44.108  hit  -  Server - NPC:68
  22:27:44.108  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:44.124  hit  -  Server - NPC:68
  22:27:44.124  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:44.140  hit  -  Server - NPC:68
  22:27:44.141  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:44.157  hit  -  Server - NPC:68
  22:27:44.157  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:44.174  hit  -  Server - NPC:68
  22:27:44.174  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:44.190  hit  -  Server - NPC:68
  22:27:44.190  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:44.208  hit  -  Server - NPC:68
  22:27:44.208  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:44.224  hit  -  Server - NPC:68
  22:27:44.224  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:44.240  hit  -  Server - NPC:68
  22:27:44.240  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:44.257  hit  -  Server - NPC:68
  22:27:44.257  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:44.273  hit  -  Server - NPC:68
  22:27:44.274  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:44.290  hit  -  Server - NPC:68
  22:27:44.290  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:44.307  hit  -  Server - NPC:68
  22:27:44.307  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:44.323  hit  -  Server - NPC:68
  22:27:44.324  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:44.340  hit  -  Server - NPC:68
  22:27:44.340  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:44.358  hit  -  Server - NPC:68
  22:27:44.358  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:44.374  hit  -  Server - NPC:68
  22:27:44.374  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:44.391  hit  -  Server - NPC:68
  22:27:44.391  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:44.407  hit  -  Server - NPC:68
  22:27:44.407  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:44.424  hit  -  Server - NPC:68
  22:27:44.424  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:44.440  hit  -  Server - NPC:68
  22:27:44.440  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:44.457  hit  -  Server - NPC:68
  22:27:44.457  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:44.474  hit  -  Server - NPC:68
  22:27:44.474  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:44.490  hit  -  Server - NPC:68
  22:27:44.490  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:44.507  hit  -  Server - NPC:68
  22:27:44.507  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:44.524   ▶ no hit (x30)  -  Server - NPC:98
  22:27:45.023  hit  -  Server - NPC:68
  22:27:45.024  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:45.040  hit  -  Server - NPC:68
  22:27:45.041  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:45.056  hit  -  Server - NPC:68
  22:27:45.057  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:45.074  hit  -  Server - NPC:68
  22:27:45.074  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:45.090  hit  -  Server - NPC:68
  22:27:45.091  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:45.106  hit  -  Server - NPC:68
  22:27:45.106  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:45.123  hit  -  Server - NPC:68
  22:27:45.124  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:45.140  hit  -  Server - NPC:68
  22:27:45.141  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:45.156  hit  -  Server - NPC:68
  22:27:45.157  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:45.173  hit  -  Server - NPC:68
  22:27:45.173  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:45.191   ▶ no hit (x33)  -  Server - NPC:98
  22:27:45.740  hit  -  Server - NPC:68
  22:27:45.741  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:45.758  hit  -  Server - NPC:68
  22:27:45.758  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:45.774  hit  -  Server - NPC:68
  22:27:45.774  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:45.790  hit  -  Server - NPC:68
  22:27:45.790  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:45.806  hit  -  Server - NPC:68
  22:27:45.807  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:45.823  hit  -  Server - NPC:68
  22:27:45.824  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:45.840  hit  -  Server - NPC:68
  22:27:45.840  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:45.856  hit  -  Server - NPC:68
  22:27:45.857  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:45.873  hit  -  Server - NPC:68
  22:27:45.873  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:45.890  hit  -  Server - NPC:68
  22:27:45.890  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:45.908   ▶ no hit (x30)  -  Server - NPC:98
  22:27:46.407  hit  -  Server - NPC:68
  22:27:46.407  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:46.424  hit  -  Server - NPC:68
  22:27:46.424  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:46.440  hit  -  Server - NPC:68
  22:27:46.440  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:46.457  hit  -  Server - NPC:68
  22:27:46.457  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:46.473  hit  -  Server - NPC:68
  22:27:46.474  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:46.490  hit  -  Server - NPC:68
  22:27:46.491  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:46.507  hit  -  Server - NPC:68
  22:27:46.508  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:46.523  hit  -  Server - NPC:68
  22:27:46.523  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:46.540  hit  -  Server - NPC:68
  22:27:46.541  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:46.557  hit  -  Server - NPC:68
  22:27:46.557  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:46.573  hit  -  Server - NPC:68
  22:27:46.574  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:46.590   ▶ no hit (x30)  -  Server - NPC:98
  22:27:47.090  hit  -  Server - NPC:68
  22:27:47.091  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:47.106  hit  -  Server - NPC:68
  22:27:47.107  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:47.123  hit  -  Server - NPC:68
  22:27:47.123  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:47.140  hit  -  Server - NPC:68
  22:27:47.140  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:47.158  hit  -  Server - NPC:68
  22:27:47.158  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:47.173  hit  -  Server - NPC:68
  22:27:47.173  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:47.190  hit  -  Server - NPC:68
  22:27:47.190  Workspace.Characters.TaBigMemesGuy.Hollowed Antlers.Handle  -  Server - NPC:95
  22:27:47.208  hit  -  Server - NPC:68
  22:27:47.208  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:47.223  hit  -  Server - NPC:68
  22:27:47.223  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:47.240  hit  -  Server - NPC:68
  22:27:47.240  Workspace.Characters.TaBigMemesGuy.Meshes/Bucket HatAccessory.Handle  -  Server - NPC:95
  22:27:47.256  hit  -  Server - NPC:68
  22:27:47.256  Workspace.Characters.TaBigMemesGuy.Floating Black Sparkling Shine.Handle  -  Server - NPC:95
  22:27:47.273   ▶ no hit (x41)  -  Server - NPC:98
  22:27:48.242  Disconnect from ::ffff:127.0.0.1|63058  -  Studio

Code:

-- ...
	self.RaycastParams = RaycastParams.new()
	self.RaycastParams.FilterDescendantsInstances = {self.Character}
	self.RaycastParams.IgnoreWater = true
-- ...
for _, Character in Characters:GetChildren() do
		local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
		local Distance =  (HumanoidRootPart.Position - self.HumanoidRootPart.Position).Magnitude
		
		-- Check if the character is within view distance --
		if (Distance <= self.ViewDistance) then

			-- Check if the character is within line of sight --
			local Raycast = Workspace:Raycast(self.HumanoidRootPart.Position, HumanoidRootPart.Position, self.RaycastParams)
			
			if (Raycast) then
				print("hit")		
				
				if (Raycast.Instance.Parent == Character) then
					
					-- Pack the data --
					local Data = {
						Character = Character,
						Distance = Distance
					}
					
					-- Insert it into the array --
					table.insert(self.Sees, Data)
				else
					print(Raycast.Instance:GetFullName())
				end
			else
				print("no hit")
			end
		end
	end
end
1 Like

Try:

local Raycast = Workspace:Raycast(self.HumanoidRootPart.Position, HumanoidRootPart.Position - self.HumanoidRootPart.Position, self.RaycastParams)
			

Instead of:

local Raycast = Workspace:Raycast(self.HumanoidRootPart.Position, HumanoidRootPart.Position, self.RaycastParams)

And if you want to ignore hats and accessories, i recommend setting their handles CanCollide and CanQuerry to false from the server with a character added event

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.