Need Help With Position Error

I sometimes get “tried to index nil with position” when I punch a rig. Can somebody please help me, Thanks (This is only part of the code)

-- for _, plr in players:GetPlayers() do
				local char = plr.Character

				if char == nil or plr == player then continue end

				if (char.PrimaryPart.Position - character.PrimaryPart.Position).Magnitude <= punchDistance then
					coroutine.wrap(hit)(player, char, punchDamage)
					break
				end
			end

			for _, dummy in workspace.Dummies:GetChildren() do
				if (dummy.PrimaryPart.Position - character.PrimaryPart.Position).Magnitude <= punchDistance then
					coroutine.wrap(hit)(player, dummy, punchDamage)
					break
				end
			end

You could add a print statement after your dummy for loop to see what the name of the object is that does not have a PrimaryPart:

    for _, dummy in workspace.Dummies:GetChildren() do
        print(dummy.Name)
		if (dummy.PrimaryPart.Position - character.PrimaryPart.Position).Magnitude <= punchDistance then
			coroutine.wrap(hit)(player, dummy, punchDamage)
			break
		end
	end

You could also look in your explorer at the workspace.Dummies folder when running the game and make sure only Rigs are going in there and not some other type of object which doesn’t have a PrimaryPart.

its the dummy. I think it might be because of the knockback