character = script.Parent.Parent
loaded = true
hud = nil
damage = 20
headshotdamage = 40
function play(sound)
sound:Play()
end
function MagEffect()
part = Instance.new("Part", workspace)
part.Name = "EmptyMag"
part.Size = Vector3.new(1,1,1)
part.BrickColor = BrickColor.new("Black")
mesh = Instance.new("BlockMesh", part)
mesh.Scale = Vector3.new(0.2,0.7,0.2)
part.Position = script.Parent.Handle.Position - Vector3.new(0,script.Parent.Handle.Size.Y+.1,0)
play(script.Parent.Reload)
game.Debris:AddItem(part,12)
end
function Shoot(at)
play(script.Parent.Fire)
part = Instance.new("Part", workspace)
part.Name = "Bullet"
part.Size = Vector3.new(1,1,1)
part.BrickColor = BrickColor.new("Black")
mesh = Instance.new("BlockMesh", part)
mesh.Scale = Vector3.new(0.2, 0.2, 0.7)
bof = Instance.new("BodyForce")
bof.force = Vector3.new(0,part:GetMass() * 196,0)
bof.Parent = part
part.CFrame = CFrame.new(script.Parent.Handle.Position,at)
part.Position = script.Parent.Handle.Position + part.CFrame.lookVector
part.Velocity = part.CFrame.lookVector * 300
game.Debris:AddItem(part,12)
part.Touched:connect(function(p)
if p.Parent:findFirstChild("Humanoid") then
hum = p.Parent.Humanoid
if p.Name == "Head" then
hum:TakeDamage(headshotdamage)
else
hum:TakeDamage(damage)
end
cr = Instance.new("ObjectValue",hum)
cr.Value = character
cr.Name = "creator"
game.Debris:AddItem(cr,.2)
game.Debris:AddItem(part,0)
end
game.Debris:AddItem(part,0)
end)
end
while true do
wait(1)
if script.Parent.TotalAmmo.Value >= 7 then
if script.Parent.MagAmmo.Value == 0 then
MagEffect()
script.Parent.TotalAmmo.Value = script.Parent.TotalAmmo.Value - 7
script.Parent.MagAmmo.Value = 7
end
end
if script.Parent.EnableFire.Value then
script.Parent.EnableFire.Value = false
if script.Parent.MagAmmo.Value > 0 then
Shoot(script.Parent.EnableFire.Position.Value)
script.Parent.MagAmmo.Value = script.Parent.MagAmmo.Value - 1
end
end
end
I'm editing this script, and I can't seem to find the line that identifies how fast it shoots! For some details, the gun appears to be shooting every 1 second.

1 comment
Line 56, "wait(1)". Change 1 to however long you want between each shot.