I am making a gun system and the filter list won’t work. It won’t filter out my Roblox character. Here is a video:
Here is a sample of my code, don’t worry about undefined variables/arguments as this is only a sample of a much larger script:
local rayP = RaycastParams.new()
rayP.FilterDescendantsInstances = {player.Character}
rayP.FilterType = Enum.RaycastFilterType.Blacklist
local raycastResult = workspace:Raycast(handle.Position, (hit - handle.Position)*range)
if raycastResult then
local hitPart = raycastResult.Instance
local model = hitPart:FindFirstAncestorOfClass("Model")
print("Model - "..model.Name)
if model then
local hum = model:FindFirstChild("Humanoid")
if hum then
if hitPart.Name == "Head" and headDamageEnabled then
hum.Health -= headDamage
else
hum.Health -= damage
end
end
end
end
Pay attention to the output in the video, it prints my character name (Model - falcon2666
) as it should filter it out because of the filter list. It damages me if I shoot away.
Any help is appreciated !