So i have these lines of codes, they are about getting ALL the hats (and also accessories) handles from the workspace into a table for my gun system. When I shoot someone's head, if they are wearing Hats, then the ray will go through the hat, but not with Accessory.
When I try to print out the names of the handles, the handle names of the accessories are there, but somehow the ray still couldn't go through them.
Forgot to mention that this code is in a local script
I've tried some free model guns, some have the ability to go through hats and accessories, but some don't. Some of them are way too long for me to understand. So I decided to ask here for solutions
OK, so I found out something big and I have to write it as an answer:
After so many attempts, this 1 line was the problem here:
local rayhit,raypos,raynormal = workspace:FindPartOnRayWithIgnoreList(ray, {unpack(hatlist), plr.Character, workspace.CurrentCamera})
If I scramble the orders of the items in the ignore list, like this:
local rayhit,raypos,raynormal = workspace:FindPartOnRayWithIgnoreList(ray, {plr.Character, workspace.CurrentCamera, unpack(hatlist)})
It will actually works, it will actually ignores both hats and accessories, I have no idea why, and I bet nobody will know why. But let's just acknowledge that it happens and follow it.