Im using a variant of the FE weapons kit by Thienbao2109 and it works fine up until you try to inflict damage onto someone else. The weapon works correctly once on the head and body then it doesn’t after that.
What is the issue?
I get an error after attempting to shoot a player more than once
“ServerScriptService.VisualizeBulletScript:368: attempt to index nil with ‘Character’ - Client - BulletVisualizerClientScript:249”
Before the guns did not work at all because they were calling for a folder named Bullets in workspace but I do not really understand how to fix this issue.
Watch c2pFCXqk3tqq3iAd8NX7iQ | Streamable
I will put down both the lines from BulletVisualizerClientScript and VisualizeBulletScript with the errors below.
Bullet Visualizer Client Script line 249
if TargetHumanoid then
MakeBloodFX(HitPart, HitPoint, Normal, BloodEffectData)
if TargetHumanoid.Health > 0 then
print("SENDING")
game.ReplicatedStorage:WaitForChild("InflictTarget"):InvokeServer(Tool,
Tagger,
TargetHumanoid,
TargetTorso,
(HitPart.Name == "Head" and DamageData[3]) and DamageData[1] * DamageData[2] or DamageData[1],
{Misc[1],Misc[2],Misc[3],Misc[4],Misc[5],Misc[6],Misc[7],Misc[8]},
{Critical[1],Critical[2],Critical[3]},
HitPart,
{GoreData[1], GoreData[2], GoreData[3], GoreData[4], GoreData[5]}, HitPoint, Normal, true)
Tool.GunScript_Local:FindFirstChild("MarkerEvent"):Fire(HitPart.Name == "Head" and DamageData[3])
else
--if (HitPart.Name == "Head") then
_G.playEffect("hs")
--end
game.ReplicatedStorage:WaitForChild("InflictTarget"):InvokeServer(Tool, "f", TargetHumanoid, TargetTorso, 0, 0, 0, HitPart, 0 , HitPoint, Normal, false)
end
else
MakeImpactFX(HitPart, HitPoint, Normal, HitEffectData, BulletHoleData)
end
end
Visualize Bullet Script line 368
function knockBack(plr,speed,force,length,hitter)
local KnockBack = Instance.new("BodyVelocity")
KnockBack.Name = "gunKB"
KnockBack.Parent = plr.Character:FindFirstChild("HumanoidRootPart")
KnockBack.MaxForce = Vector3.new(force,force,force)
KnockBack.Velocity = hitter.Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * speed
if length == nil or not length or length == 0 then return end
task.delay(length,function()
KnockBack:Destroy()
end)
end