I am using the Roblox Gun system and I am fixing code that I’m doing for a commission, the function in the script won’t even fire. the following code is from the "WeaponsSystem module starting on about line 445.
function WeaponsSystem.doDamage(target, amount, damageType, dealer, hitInfo, damageData)
print("Function fired")
if not target or ancestorHasTag(target, "WeaponsSystemIgnore") then
return
end
if IsServer then
if target:IsA("Humanoid") and dealer:IsA("Player") and dealer.Character then
local dealerHumanoid = dealer.Character:FindFirstChildOfClass("Humanoid")
local targetPlayer = Players:GetPlayerFromCharacter(target.Parent)
if dealerHumanoid and target ~= dealerHumanoid and targetPlayer then
-- Trigger the damage indicator
local killDetection = game:GetService("ReplicatedStorage"):WaitForChild("killDetection")
local info = {
victim = targetPlayer,
victimHumanoid = target,
perpetrator = dealer
}
WeaponData:FireClient(targetPlayer, "HitByOtherPlayer", dealer.Character.HumanoidRootPart.CFrame.Position)
if target.Health <= 0 then
print("Dead player")
--the player is dead
killDetection:Invoke(info)
end
end
end
-- NOTE: damageData is a more or less free-form parameter that can be used for passing information from the code that is dealing damage about the cause.
-- .The most obvious usage is extracting icons from the various weapon types (in which case a weapon instance would likely be passed in)
-- ..The default weapons pass in that data
local handler = _damageCallback or _defaultDamageCallback
handler(WeaponsSystem, target, amount, damageType, dealer, hitInfo, damageData)
end
end
Please note that the code will be different from what you might see when you go it look at yours because it’s designed to integrate with my kill streak system so don’t comment about that.
Edit: It doesn’t print and there are no errors.