Part does not collide with dummies but do collide with players

So I’m making a superpower that can summon a part that kills all players. It works with players, but it does not work with dummies. the problem about that is that the game is going to be mostly about testing on dummies.


code:

remoteEvent4.OnServerEvent:Connect(function (player)
	local part = Instance.new("Part")
	part.Parent = workspace
	part.Shape = Enum.PartType.Cylinder
	local newpsotion = (player.character.LeftFoot.Position + player.character.RightFoot.Position)/2
	part.CFrame = CFrame.new(newpsotion) * easyangles(0,0,90)
	part.Size = Vector3.new(4, 60.474, 65.958)

	part.Anchored =  true

	
    
	part.Touched:Connect(function (otherPart)
		if  otherPart.Parent == player.character then

		else
			print(otherPart.Parent.Name)
			otherPart.Parent.Humanoid.Health = 0
		end
	end)
	
end)

How can I make it work with dummies?

By the way this on a server script

1 Like

Most dummies as I know do not have humanoids so you might wanna get new ones

but I checked and they do have humanoids, and even if they didn’t it should still register them on the print() statement

Also I made them with the make rig plugin so they would have to have them

1 Like

Is otherpart.Parent the character model for the dummies?

Yes, the other part.parent is the character model for the dummies

Place all your dummies into the folder and get the children of that folder. Then whenver the part is spawning, you can choose all or one of the dummies to die.

What I’m trying to, is that whenever you press f a part appears and any dummy in that radius dies. I don’t want to kill every dummy. They are also all named the same

Ok you can use .magnitude and table.insert using the same method I told you. which dummy is in your radius and that dummy from the table would be killed.

But how would I get the dummy that’s touching the part? (The part is the radius)

Just detect whoever’s name had touched the part and the index of the dummy from the table. Like if multiple dummies have the same names [i] would be the first name of the name and the value would be assigned to it.

1 Like

But the thing is I can’t get which dummy touched the part, that’s the point. It doesn’t detect the collision between the radius part and the dummy

1 Like

I would try something like this:

local touchingParts = part:GetTouchingParts()

for i = 1, #touchingParts, 1 do

	--check to see if part is in a character, then kill character

end 

1 Like

Your script is working with players in the game not actual dummies. Just make a table like I said earlier and grab the dummies from there. And it should detect if it has a humanoid.

Yes but How would I know which dummy was in the radius? I can’t get the name of the dummy that touched the part

1 Like

You can like I said earlier. You need to use the table.insert function to place all the dummies in the table and then get the first reference of the dummy closest to the player

1 Like

But how would I get multiple dummies? And how would I get the dummy that’s in the radius?

bRuh. just make a folder and place all of the dummies in a folder. Use the table.insert method. if you want to really know i will link api references here.

tables:

magnitude:

I tried out your script and it worked, but it only killed one character per button press.

What do your dummies look like in the Explorer? Do they have Humanoids inside of a Model?

If they do, then try this… this would replace your part.Touched section.

local touchingParts = part:GetTouchingParts()
for i = 1, #touchingParts do
  local touchedPart = touchingParts[i]
  if touchedPart.Parent:IsA ("Model") then
    local humanoid = touchedPart.Parent:FindFirstChild("Humanoid")
    if humanoid then
      humanoid.Health = 0
    end
  end
end
1 Like