Bullet doesn't damage NPC when too close

I am trying to remake some old guns from scratch and when I finished it the bullets don’t damage the NPC when its close. This is really annoying because I am using these guns for a zombie game and when the zombies are close it is impossible to kill them. If anyone can tell me whats wrong with the script that would be really good.

Example: https://gyazo.com/a0b11023799a6344df9b0d6730736071

Script:

Tool = script.Parent
Accuracy = 25

Muzzles = {
	"http://www.roblox.com/asset/?id=131435802",
	"http://www.roblox.com/asset/?id=131435817",
	"http://www.roblox.com/asset/?id=131435825",
}


Tool.Shoot.OnServerEvent:Connect(function(vPlayer,lookAt)
	local Flash = coroutine.create(function()
		Tool.Muzzle.Flash.Flash.Image = Muzzles[math.random(1,#Muzzles)]
		Tool.Muzzle.Flash.Flash.Visible = true
		wait(0.1)
		Tool.Muzzle.Flash.Flash.Visible = false
	end)
	coroutine.resume(Flash)
	
	Tool.Fire:Play()
	local missile = Instance.new("Part")
	missile.Size = Vector3.new(1,1,1)
	missile.Shape = 1
	missile.BottomSurface = 0
	missile.TopSurface = 0
	missile.Name = "Bullet"
	missile.Elasticity = 0
	missile.Reflectance = .1
	missile.Friction = .3
	missile.CanCollide = false
	missile.Parent = Tool
	missile.CFrame = Tool.Barrel.CFrame
	missile.Velocity = lookAt * 467 + Vector3.new(math.random(-Accuracy, Accuracy), math.random(-Accuracy, Accuracy), math.random(-Accuracy, Accuracy))
	mesh = Tool.Mesh:Clone()
	mesh.Parent = missile
	local fly = Instance.new("BodyForce",missile)
	fly.Force = Vector3.new(0,missile:GetMass()*196.2,0)
	game.Debris:AddItem(missile,10)
	wait()
	missile.Touched:Connect(function(hit)
		wait(0.25)
		missile:remove()
	end)

	local new_script = script.Parent.Paintball:clone()

	new_script.Disabled = false

	new_script.Parent = missile

	local creator_tag = Instance.new("ObjectValue")

	creator_tag.Value = vPlayer

	creator_tag.Name = "creator"

	creator_tag.Parent = missile
end)
1 Like

Have you tried pushing the muzzle backwards (so that it’s closer to the shoulder)?

Yeah this does work but then I would have to push the muzzle back for every gun and it will take very long. Is there any other way to fix this by script or if there isn’t ill just do the long way

1 Like

I don’t think you have any alternatives (unless I’m wrong).

I would also suggest using FastCast which uses raycasting and handles bullets really well performance-wise. It’s just better overall.

Alright then I will do this. Thanks for helping now the game wont be impossible anymore

I would also suggest using FastCast which uses raycasting and handles bullets really well performance-wise.

Oh I will check that out

Nah man this actually made it worse because the bullet shoots weird and it doesn’t hit the zombie most of the time

Nvm I fixed it because the damage script was added after it said game.Debris:AddItem() so I put it before and now it works