I want to include a properly working delay to this laser script. I used script.Disabled, but it seems to have a few inconsistantcies. Any ideas?
mouse.Button1Down:connect(function()
tool.Ammo.Value = tool.Ammo.Value - 1
tool.Handle.Fire:Play()
local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit * 2048)
local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)
local beam = Instance.new("Part", workspace)
beam.BrickColor = tool.NeonLight.BrickColor
beam.FormFactor = "Custom"
beam.Material = "Neon"
beam.Transparency = 0
beam.Anchored = true
beam.Locked = true
beam.CanCollide = false
local distance = (tool.Handle.CFrame.p - position).magnitude
beam.Size = Vector3.new(0.1, 0.1, distance)
beam.CFrame = CFrame.new(tool.Barrel.CFrame.p, position) * CFrame.Angles(math.rad(math.random(-SpreadAngle,SpreadAngle)), math.rad(math.random(-SpreadAngle,SpreadAngle)), 0) * CFrame.new(0, 0, -distance/2)
game:GetService("Debris"):AddItem(beam, 0.1)

2 comments
What do you mean Delay? You mean for it to wait a rate of fire before shooting again?
If you're talking about firerate, simply add a wait() at the end. Make the time that it waits (60/xx), with xx being the rate of fire of the weapon.