So this is my current blacklist, which works as intended, to make it so that rays don’t stop at MY OWN character:
local rayparams = RaycastParams.new()
rayparams.FilterType = Enum.RaycastFilterType.Blacklist
rayparams.FilterDescendantsInstances = {player.Character}
But I’m confused on how to make it so that the rays will hit another player, but completely ignore their accessories and tools.
I have a folder called “Entities” in workspace, which all player characters are loaded into.
I suppose you can loop through and get all the accessories?
local entities = workspace.Entities
local function getHats()
local hats = {}
for _, character in pairs(entities) do
for _, child in pairs(character:GetChildren()) do
if child:IsA("Accessory") then
table.insert(hats, child)
end
end
end
return hats
end
print(getHats()) --> returns a table with all the hats in the game, assuming your characters are under "Entities" like you stated.
Here's an alternative without having to store your characters under a folder
local function getHats()
local hats = {}
for _, player in pairs(players:GetPlayers()) do
local character = player.Character
if character then
for _, child in pairs(character:GetChildren()) do
if child:IsA("Accessory") then
table.insert(hats, child)
end
end
end
end
return hats
end