Hey, I’m trying to exclude my character out of a raycast for a gun, but it just doesn’t work.
I also checked the children of char, to see if the character was rightfully defined, and it showed all the body parts so it should work?
tool.Activated:Connect(function()
if deBounce == false then
local mouse = player:GetMouse()
local char = tool.Parent
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
>>> params.FilterDescendantsInstances = {char}
if mouse.Target == nil then
return
else
script.Sound:Play()
local direction = mouse.Target.Position - tool.Handle.Position
local ray = workspace:Raycast(tool.Handle.Position, direction)
if ray then
local hit = ray.Instance
local hum = hit.Parent:FindFirstChild("Humanoid")
if not hum and hit.Parent:IsA("Accessory") then
hum = hit.Parent.Parent:FindFirstChild("Humanoid")
end
if hum then
RS.onShot:FireServer(Dmg,hum)
end
end
deBounce = true
wait(deBounceTime)
deBounce = false
end
end
end)
does anyone know a fix for this?