GetTouching part not registering part

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Get touching part of a ball

  2. What is the issue? So I have a dummy,All of it part cancollide are true,And I have a police who will shot dummies inside,Which use collision to detect the dummy,The collision hitbox is a ball,50 stud,it has can query false and can collide false,Its collision group is 0,same as the dummy,But when i test,Ill always return only the terrain,Even if the dummy is at the center of the ball,BLock also dont work.Raycast function is called on heartbeat

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?Yes,Ive try changing the ball to a block,But that did not work,Also another note,My script worked before,Just 20 minute ago.Even if i delete if not get ancestor… it still wont work with anything aside terrain,PS.Even straght out of gettouching table,Theres no part getting registered

local function raycast ()
	for _,hit in pairs(script.Parent.Parent.Range:GetTouchingParts()) do
		if not hit:FindFirstAncestor(script.Parent.Parent.Parent) then
			if reloading == false and hit.Name ~= "Terrain" then
				reloading = true
				-- Build a "RaycastParams" object
				local raycastParams =
				raycastParams.FilterType = Enum.RaycastFilterType.Whitelist
				raycastParams.FilterDescendantsInstances = {script.Parent.Parent,hit.Parent}
				raycastParams.IgnoreWater = true
				local dir = hit.Position - script.Parent.Parent.Gun.Handle.position
				-- Cast the ray
				local part = script.Parent.Parent.Gun.Handle
				local raycastResult = workspace:Raycast(part.Position, dir*100, raycastParams)

				-- Interpret the result
				if raycastResult then
					if raycastResult.Instance:IsA("BasePart") then
						--local X,Y,Z =,dir):ToOrientation()
						--script.Parent.Parent.HumanoidRootPart.CFrame =*CFrame.fromOrientation(0,math.rad(Y),0)
						if raycastResult.Instance.Parent:FindFirstChildOfClass("Humanoid") then
							local hum = raycastResult.Instance.Parent:FindFirstChildOfClass("Humanoid") 
					if hit.Parent:FindFirstChildOfClass("Humanoid") then
						--local X,Y,Z =,dir):ToOrientation()
						--script.Parent.Parent.HumanoidRootPart.CFrame =*CFrame.fromOrientation(0,math.rad(Y),0)
						local hum = hit.Parent:FindFirstChildOfClass("Humanoid")
				reloading = false

Just so you know, FindFirstAncestor returns the first ancestor of the given name. You would need to define the name, Like this on line 4:

if hit:FindFirstAncestor("Terrain") then return end

Now, this could be your problem, however, I am not 100% sure, since I never really have used Ancestors! (I’m not the most experienced in them.)

SOrry,Still dont work,It does stop ter terrain from printing,But its still not registering the dumy

Wt is the name of ancestor u r trying to check?


Try this


Ive try if not hit:FindFirstAncestor(“Red”) then but it dont work (Red is the name)

Possibly replace


if hit.Parent and hit.Parent.Character and hit.Parent.Character:FindFirstChild("Humanoid")



local hum = hit.Parent.Character:FindFirstChild("Humanoid")

That could work, but for now, I will be offline. I will catch up to you soon!

for _,hit in pairs(script.Parent.Parent.Range:GetTouchingParts()) do

This print only terrain

U r using not so even if there is one part, it will not work.

Cud u send the heirarchy of the model?

Heres itUntitled
Setting the range part cancollide to true make it work

Where’s the range part? Ignor3

Under the police model,This is the most i can screenshot

Is this the problem?, :GetTouchingParts only accounts for CanCollide parts.

1 Like

Just an extension to your reply.