I'm making a gun and I've shortened my code to about sixty lines, but can I shorten the code more?
local tool = script.Parent.Parent
local pew = tool:WaitForChild('Pew')
local HEADSHOT = tool:WaitForChild('HEADSHOT')
local acceleration = -100
local damage = 15
tool.Equipped:Connect(function(Mouse)
Mouse.Button1Down:Connect(function()
pew:Play()
local bullet = game.ReplicatedStorage.Bullet:Clone()
bullet.Parent = workspace.Bullets
bullet.CFrame = script.Parent.CFrame + Vector3.new(0, 0.35, 0)
bullet.Anchored = false
bullet.Velocity = bullet.CFrame.lookVector * acceleration
bullet.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild('Humanoid')
local DB = hit:FindFirstChild('DB')
if DB then
bullet:Destroy()
end
if humanoid and humanoid.Parent.Name ~= tool.Parent.Name then
if hit.Name == 'Head' then
if HEADSHOT.IsPlaying == false then
humanoid:TakeDamage(damage + 15)
if hit.Neck then
hit:FindFirstChild('Neck'):Destroy()
end
bullet.GotHimInTheHead.Parent = hit
hit.GotHimInTheHead.HeadShotMessage.Text = 'HEADSHOT!'
bullet:Destroy()
HEADSHOT:Play()
end
humanoid:TakeDamage(damage + 15)
else
humanoid:TakeDamage(damage)
end
wait(2)
if workspace.Bullets:FindFirstChild('Bullet') then
workspace.Bullets.Bullet:Destroy()
end
if humanoid.Health <= 0 then
if hit.Parent then
hit.Parent:Destroy()
end
end
end
end)
end)
end)
It'll help if you don't scream at me :l

3 comments
i dont think you can
For the most part, your code is clean. It doesn't really need much shortening. Also the lines on a script doesn't matter. If it really pains you, remove the empty lines in between things.
Thanks, but skipping lines is just my style. I seperate any lines that aren't like the one above it.