There is no clash of the two parties

Hello, I have the same problem with collisions all the time.
Here is an example: I am creating a local script that creates a Part on the desktop. When this party collides with another party, it does not see it, but it sees other Parts concerning it, for example, HumanoidRootPart. I want to make a weapon attack through the touch of a detector.

local tool = script.Parent -- Gets the tool
local player = game:GetService("Players").LocalPlayer
local character = player.Character
--ПАРАМЕТРЫ
local Debris = game:GetService("Debris")
local debounce = false

local EquipTool = tool.Configuration.Animations:WaitForChild("EquipTool")
local animationTrack = character:WaitForChild("Humanoid"):LoadAnimation(EquipTool)
local animAttack1 = character:WaitForChild("Humanoid"):LoadAnimation(tool.Configuration.Animations:WaitForChild("AttackLeft1"))

local EventDamage = game.ReplicatedStorage:WaitForChild('Events'):WaitForChild('Damaged')
--ПРИ ЭКИПИРОВКЕ ОРУЖИЯ
tool.Equipped:Connect(function()
	animationTrack:Play() -- Play animation when equipped. If you want the animation to be a loop, make sure to click the loop icon when creating the animation!
end)
--ПРИ ИЗЪЯТИИ ОРУЖИЯ
tool.Unequipped:Connect(function()
	animationTrack:Stop() -- Stops the animation
end)

tool.Activated:Connect(function()
	--ПРИ НАЖАТИИ КНОПКИ АТАКИ
	if script.Parent.Parent.Humanoid.Health > 0 and debounce == false then debounce = true
		--ВОСПРОИЗВЕДЕНИЕ АНИМАЦИИ
		local DetectionSide = nil
		animAttack1:Stop()
		animAttack1.Priority = Enum.AnimationPriority.Action4
		animAttack1:Play()
		--В КАКУЮ СТОРОНУ БИТЬ
		if script.Parent.Parent.UpperTorso.Orientation.Y > 0 and script.Parent.Parent.UpperTorso.Orientation.Y < 180 then
			DetectionSide = script.Parent.Parent.HumanoidRootPart.Position - Vector3.new(2,0,0)
		else
			DetectionSide = script.Parent.Parent.HumanoidRootPart.Position + Vector3.new(2,0,0)
		end
		EventDamage:FireServer(script.Parent, DetectionSide)
		--СОЗДАТЬ ПАРТИЮ УДАРА
		local Detection = Instance.new('Part')
		Detection.Transparency = 0.8
		Detection.Color = Color3.new(1, 0, 0)
		Detection.Size = Vector3.new(8, 6.92, 3.467)
		Detection.Orientation = Vector3.new(0,0,0)
		Detection.CanCollide = false
		Detection.Anchored = true
		Detection.Position = DetectionSide
		--ЕСЛИ ПОПАЛ ТО ПЕРЕДАТЬ НА СЕРВЕР<<<<**<HERE**
		Detection.Touched:Connect(function(hit)
			if hit.Parent:FindFirstChild('EmptyWall') then
				print('Detect')
				Detection:Remove()
			end
			if hit.Parent ~= nil and hit.Parent:FindFirstChild('Enemy') and hit.Parent:FindFirstChild("Humanoid") then
				--ПЕРЕДАТЬ КОМУ НАНЕСЕН УРОН И ЧЕМ
				EventDamage:FireServer(hit.Parent,script.Parent, DetectionSide)
				Detection:Remove()
			end
		end)
		--ЖДЕМ КОНЦА АНИМАЦИИ И РАЗРЕШАЕМ УДАРЯТЬ ОРУЖИЕМ СНОВА
		animAttack1.Stopped:Wait()
		--ПОСТАВИТЬ НА УДАЛЕНИЕ И ПЕРЕНЕСТИ НА РАБОЧИЙ СТОЛ
		Debris:AddItem(Detection,20.1)
		Detection.Parent = game.Workspace.ForDetection
		debounce = false
		--ЕСЛИ ИГРОК МЕРТВ ТО УДАЛИТЬ ОРУЖИЕ
	elseif script.Parent.Parent.Humanoid.Health <= 0 then
		script.Parent:Remove()
	end
end)


not sure what do you mean by “desktop” … also isnt this suppose to be in scripting support ? :thinking: :thinking:

Don’t use part hitboxes, they are really bad and slow. If you want a more accurate way of doing hitboxes, consider client-server ray casting, or even FastCast if you are using ranged weapons. This should fix your issue.

1 Like