-
What do you want to achieve?
I want the damage function to work properly -
What is the issue?
Well whenever the script executes the variable part receives an error
-
What solutions have you tried so far?
I attempted to change dealer.Character to other parents of dealer.Character, still the same error.
This is the ROBLOX weapons kit I realized quickly that the kit is very exploitable that is when I tried to then fix some of the flaws within it.
local function _defaultDamageCallback(system, target, amount, damageType, dealer, hitInfo, damageData)
if target:IsA("Humanoid") then
local RayCheck = Ray.new(dealer.Character.Head.CFrame.Position, target.Parent.HumanoidRootPart.CFrame.Position)
local Part = workspace:FindPartOnRayWithWhitelist(RayCheck, dealer.Character)
if string.match(Part:GetFullName(), target.Name) then
target:TakeDamage(amount)
elseif target.Name == "Glass" then
target.Settings.Health.Value = target.Settings.Health.Value - amount
end
end
end