local tool = script.Parent
local animations = tool.Animations
local lp = game.Players.LocalPlayer
local re = game.ReplicatedStorage.FireCache
local mouse = lp:GetMouse()
local loop
lp.CharacterAdded:Connect(function(char)
local hum = char:WaitForChild("Humanoid")
local grip = hum:LoadAnimation(animations.IdleGrip)
local fire = hum:LoadAnimation(animations.Recoil)
tool.Equipped:Connect(function()
grip:Play()
grip.Looped = true
end)
tool.Activated:Connect(function()
if tool.Other.Reloaded.Value == true and tool.Other.Bolted.Value == true then
if (grip) then
mouse.Button1Down:Connect(function()
grip.Looped = false
grip:Stop()
fire:Play()
fire.Looped = true
loop = true
re:FireServer(mouse.Hit)
end)
mouse.Button1Up:Connect(function()
fire.Looped = false
grip.Looped = true
grip:Play()
loop = false
end)
if loop == true then
repeat
tool.Other.Use.Value = tool.Other.Use.Value - 1
until loop == false
end
end
end
end)
tool.Unequipped:Connect(function()
if (grip) then
grip.Looped = false
grip:Stop()
end
end)
end)
I am trying to make this script work so that when you hold down left click every .3 seconds your ammo goes down by one, and when you release on the mouse it stops.
There are no errors in everything else updates except the “Use” value also known as ammo in your current magazine.