So I recently made a pistol and I think it turned our pretty well. However, if I crank the bullet's velocity up to 200 or above it won't register the bullet hitting something (a zombie) from a close range. Is there any way to fix this? These are the parts in the script where I believe the error is coming from
bullet.CFrame = char.Pistol.Barrel.CFrame
bullet.CFrame = CFrame.new(bullet.Position, target.p) --bullet position = mouse position
bullet.BodyVelocity.Velocity = bullet.CFrame.lookVector * 200 --speed of bullet
...
...
...
bullet.Touched:connect(function(hit)
local blood = game.Workspace.blood:Clone()
local zombie = hit.Parent:FindFirstChild("Zombie")
local humanoid = hit.Parent:FindFirstChild("Humanoid")
local head = hit.Parent:FindFirstChild("Head")
if (hit == head and zombie) then
blood.Parent = hit
if(humanoid) then
blood:remove()
end
zombie:TakeDamage(100)
bullet:Remove()
wait(0.5)
blood:Remove()
elseif(zombie) then
blood.Parent = hit
if(humanoid) then
blood:remove()
end
zombie:TakeDamage(16.67)
bullet:Remove()
wait(0.5)
blood:Remove()
elseif (hit ~= tool or hit ~= char or hit ~= humanoid) then
bullet:remove()
end
end)
I know the touch function is kinda weird but I'm new to this and it works so it's what I'm going with for now

4 comments
Try printing if it actually runs the touched function
use raycasting for your bullets it is way easier
raycasting can make your bullet do instant damage (right when you click). You can lerp the bullets CFrame if you don't want instant damage
ok ill try it out, thanks