I’m don’t know why the delay won’t work. No one has such problems…
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
local UserInput = game:GetService("UserInputService")
local ContexAction = game:GetService("ContextActionService")
script.Parent.Handle.Fire.Volume = 0 -- Server sound
script.Parent.Handle.GunMuzzlePoint.Flash.Lifetime = NumberRange.new(0) -- -- Server particle
equiped = false
script.Parent.Equipped:Connect(function()
ContexAction:BindAction("Reload",function(name,state,obj)
if state == Enum.UserInputState.Begin then
script.Parent.ReloadEvent:FireServer()
end
end,true,Enum.KeyCode.R)
script.Parent.Handle.EquippedSound:Play()
equiped = true
end)
script.Parent.Unequipped:Connect(function()
ContexAction:UnbindAction("Reload")
script.Parent.Handle.EquippedSound:Play()
equiped = false
end)
firing = false
mouse.Button1Down:Connect(function()
if equiped and not firing and not script.Parent.NoAmmo.Value == true then
firing = true
while firing == true and equiped do
local firesound = script.Parent.Handle.GunFirePoint.Empty:Clone()
firesound.Parent = script.Parent.Handle
firesound:Play()
script.Parent.Handle.GunMuzzlePoint.FakeFlash:Emit(500)
game:GetService("Debris"):addItem(firesound,4)
mouse.Button1Up:Connect(function()
firing = false
end)
mouse.TargetFilter = workspace.BulletStorage
script.Parent.StartFire:FireServer(mouse.Hit.p)
task.wait(0.1) -- the delay won't work
end
end
end)