GetsPartInPart not working right

I have a script that creates a part and then checks if a player is inside from the client and I use workspace:getpartsinpart for this

If I shoot around the character of a player it dosen’t print me a part of their character unless I shoot directly at them

I tried putting a wait right after I create the part but it didn’t work

local ImpactEffects = Configuration.ImpactEffect
local Impact,TweenTime = CreateImpact(ImpactEffects,result.Position)

local HitFunction

local filter = OverlapParams.new()
filter.FilterType = Enum.RaycastFilterType.Exclude
filter:AddToFilter(Impact)
local TouchingParts = workspace:GetPartsInPart(Impact,filter)

Remotes.Blood:FireServer(Tool,result.Position)
for i,Hit in pairs(TouchingParts) do
	print(Hit)
	if Hit.Parent and Hit.Parent:IsA("Accessory") then
		Hit = Hit.Parent
	end
	
	local TargetChar = Hit.Parent
	if TargetChar then
		local Thum = TargetChar:FindFirstChild("Humanoid")
		if Thum then
			local IsPlayer = Players:GetPlayerFromCharacter(TargetChar)
			if not IsPlayer then

				PlaySound(180083286)
				if TargetChar:FindFirstChildOfClass("Script") and TargetChar.Parent ~= workspace.Npcs then
					
					Remotes.Shot:FireServer(Tool,Hit,result.Position)
					CameraShake = true
					task.spawn(function()
						task.wait(0.1)
						CameraShake = false
					end)
					BloodSplatter(TargetChar,result,Thum,result.Position)
				end
			end
		end
	end	
end

this is a local script I thought that might be the issue if it is how could I do this in a different way because I need to check in the client

1 Like