I’m currently using the FastCast module and realized that hats were blocking shots from registering.
I want to make it so that shots go through accessories and not just treat it as part of the hitbox of a player.
FastCast comes with a BlackList fire for its raycast that ignores parts that you put in a table; however, I’m not exactly sure as to how to put every accessory in the server in a table.
My first idea was to get a modulescript and use another script to add to it like this:
game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(player)
print("hi2")
local humanoid = player:WaitForChild("Humanoid")
if humanoid then
print("Humanoid Detected")
for i, v in pairs(humanoid:GetAccessories()) do
print("Hi3")
if v:IsA("Accessory")then
table.insert(rayIgnoreList, v)
print("Inserted: ", v)
end
end
end
end)
end)
(rayIgnoreList is a table in the modulescript)
But for some reason it's not detecting the accessories...
You could use collection service and use a blacklist, when a player is added, wait for their humanoid to load in, call :GetAccessories() and add all of the accessories returned to a blacklist.
I recommend reading this post by colbert2677Issue removing hats from table - #20 by colbert2677
It explains what I’ve just said in much greater detail.
Edit* Humanoid.CharacterAppearanceLoaded:Wait()
FastCast Blacklist requires an actual table in its arguments though.
Also, for the first part, for some reason, accessories aren’t detected from the humanoid when using humanoid:GetAccessories because “print(“Hi3”)” isn’t outputted.
That’s actually a good call. Luckily, even with the still-finnicky ordering of avatar loading events, CharacterAppearanceLoaded does fire after the appearance has been initialised. I didn’t use that here and I do have a note about why I opted not to use it in the original code sample.
GetAccessories returns a table of accessories being worn by the character, so GetChildren but specific to instances of the Accoutrement class. Character appearance isn’t guaranteed to be initialised with just CharacterAdded so understandably you might have no items returned.
Another way to account for this scenario is to tag all new hat children in the character.