i made a throwable knife but i’m having trouble welding the knife to a part. it works perfectly fine with an NPC or a player but im trying to do the same for a part in general.
the problem originates from this elseif conditional, i’m trying to check if “hit” is a base part and i’m making sure it’s not a part from the person throwing the knife.
elseif hit:IsA("BasePart") and not hit:IsDescendantOf(plr_wknife.Character) then
weld_knife(knife_clone, hit)
as u can see the knife weld attaches to my right hand.

code:
local function detectHits(knife_clone)
local hitDB = false
for _, knifepart in pairs(knife_clone:GetChildren()) do
if knifepart:IsA("BasePart") then
knifepart.Touched:Connect(function(hit)
if hitDB then return end
hitDB = true
local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid")
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local plr_wknife = game.Players:FindFirstChild(knife_config:GetAttribute("player_name"))
if player and player.Name ~= plr_wknife then
print(player.Name .. " was hit by the knife.")
weld_knife(knife_clone, hit)
kill_plrRemote:FireServer(player)
elseif humanoid and not player then
weld_knife(knife_clone, hit)
kill_plrRemote:FireServer(humanoid)
elseif hit:IsA("BasePart") and not hit:IsDescendantOf(plr_wknife.Character) then
weld_knife(knife_clone, hit)
end
hitDB = false
end)
end
end
end