Hello! so ive been trying to fix this bug where .Touched on my projectile only detects if it touches a rig with humanoid and not detect regular parts, the idea is to make it destroy when touching anything (except its own player) so the projectile doesnt go through walls and players wont abuse this bug
anim1:GetMarkerReachedSignal("Attack"):Connect(function()
script.Parent.Sword.Blade.Trail.Enabled = true
script.Parent.Sword.Blade.SwingSFX:Play()
local forwardDirection = humanoidRootPart.CFrame.LookVector
local projectile = game.ReplicatedStorage.Projectiles.Arrow:Clone()
projectile.Parent = workspace
projectile.CFrame = CFrame.new(humanoidRootPart.Position, humanoidRootPart.Position + forwardDirection)
local newPosition = humanoidRootPart.Position + (forwardDirection * 1000)
local tweenService = game:GetService("TweenService")
tweenService:Create(projectile, TweenInfo.new(13, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), {Position = newPosition}):Play()
projectile.Touched:Connect(function(part)
if part.CollisionGroup ~= "Player" and touched == false then
touched = true
projectile:Destroy()
if part.Parent:FindFirstChild("Humanoid") or part.Parent.Parent:FindFirstChild("Humanoid") then
if part.Parent:FindFirstChild("Tag") then
if part.Parent.Tag.Value == "Enemy" then
if part.Parent.Humanoid.Health > 0 then
part.Parent.Humanoid:TakeDamage(math.floor(Config.Damage.Value))
end
end
end
end
end
end)
end)