FE Weapon No Damage After 1 Shot

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

In this part of the code you’re checking if the humanoid’s health is less or equal to 0? It should be >= Again, after you do GetPlayerFromCharacter, you should use an if statement to check if plrObj is nil or not. Since what you’re hitting is nil, you can’t access nil.Character which causes the error. Try adding an if statement like

if plrObj then
    knockback(plrObj, 35, 4000, 0.1, Player)
end
1 Like

Thanks for the feedback!

Though it was good advice, I decided to just remove the knockback feature entirely and it fixed the weird damage.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.