I’m having an issue where when the player throws a pilum (javelin) and hits an object when it should just be welding itself to that part where it is, it welds itself but also teleports itself.
GIF:
Picture of a different throw:
Code:
function PilumProjectileModule.onHitPilum(Hit, Pilum)
local NewWeld = Instance.new("WeldConstraint")
NewWeld.Part1 = Hit
NewWeld.Part0 = Pilum.Tip
NewWeld.Parent = Pilum.Tip
if Hit.Parent:FindFirstChild("Humanoid") then
if Hit.Name == "Head" then
Hit.Parent.Humanoid:TakeDamage(150)
elseif Hit.Name == "UpperTorso" or Hit.Name == "LowerTorso" then
Hit.Parent.Humanoid:TakeDamage(75)
else
Hit.Parent.Humanoid:TakeDamage(50)
end
end
Pilum.PilumCanHit.Value = false
end
return PilumProjectileModule