I have 3 guns here. The luger is a free model, and the Berretta and AR are both edited guns from a kit.
All of these guns are actually doing damage but it only displays how much health has been lost when the luger shoots, and not any other gun.
Here is a video showing the issue:
https://www.kapwing.com/videos/62ac783cfe396200786016bf
Damage Code for My Guns
function Damage(H, P, N, D, Dist, customIgnore)
local hVal = S.damageSettings.Multipliers.Head
local cVal = S.damageSettings.Multipliers.Chest
local lVal = S.damageSettings.Multipliers.Limbs
local baseDamage = getBaseDamage(Dist)
if Humanoid.Health ~= 0 then
local hitHumanoid = nil
if H.Parent:IsA("Hat") then
table.insert(customIgnore, H)
local newRay = Ray.new(P - D * 0.1, D * (S.bulletSettings.Range - Dist + 0.1))
local newH, newP, newN = workspace:FindPartOnRayWithIgnoreList(newRay, customIgnore)
if newH then
hitHumanoid = Damage(newH, newP, newN, D, Dist + (newP - P).magnitude, customIgnore)
end
else
hitHumanoid = findFirstClass(H.Parent, "Humanoid")
if hitHumanoid and hitHumanoid.Health > 0 and isEnemy(hitHumanoid) then
local Tag = Instance.new("ObjectValue")
Tag.Value = Player
Tag.Name = "creator"
Tag.Parent = hitHumanoid
DS:AddItem(Tag, 0.3)
local chosenDamage = 0
if H.Name == "Head" then
chosenDamage = baseDamage * RAND(hVal, hVal + 0.1, 0.01)
elseif H.Name == "Torso" then
chosenDamage = baseDamage * RAND(cVal, cVal + 0.1, 0.01)
else
chosenDamage = baseDamage * RAND(lVal, lVal + 0.1, 0.01)
end
hitHumanoid:TakeDamage(chosenDamage)
markHit()
end
end
return hitHumanoid
end
end
Damage Code for Luger
if bolthit ~= nil then
local h = bolthit.Parent:FindFirstChild("Humanoid")
if h ~= nil then
local plr = game.Players:GetPlayerFromCharacter(self.Tool.Parent)
if plr ~= nil then
local creator = Instance.new("ObjectValue")
creator.Name = "creator"
creator.Value = plr
creator.Parent = h
end
if hit.Parent:FindFirstChild("BlockShot") then
hit.Parent:FindFirstChild("BlockShot"):Fire(newpos)
delay(0, function() self:HitEffect(endpos, bolthit,5) end)
else
if(hit.Name=='Head') then
KnockOffHats(hit.Parent)
elseif hit.Name=='Left Leg' or hit.Name=='Right Leg' then
h.WalkSpeed=h.WalkSpeed/1.5
elseif hit.Name=='Left Arm' or hit.Name=='Right Arm' then
KnockOffTool(hit.Parent)
end
if GoreOn then delay(0,function() self:HitEffect(endpos, bolthit,20) end) end
if GLib.IsTeammate(GLib.GetPlayerFromPart(script), GLib.GetPlayerFromPart(h))~=true then
GLib.TagHumanoid(GLib.GetPlayerFromPart(script), h, 1)
h:TakeDamage(damage)
end