This is kinda hard to explain so im gonna break it down but i have a script that activates when Mouse Button1 is down and i want it to repeat while it is still being held down, I’ve been stuck on this for about a day.
Here is the part of the script that i need help with.
function Fire()
if Ammuntion > 0 then
if mouse.Target ~= nil and mouse.Target.Parent:FindFirstChild(“Humanoid”) and Ammuntion > 0 then
Firing = true
while Firing == true and Ammuntion > 0 do
if mouse.Target then
if mouse.Target.Parent:FindFirstChild(“Humanoid”) then
Ammuntion -= 1
if Ammuntion > 0 then
game.ReplicatedStorage.Fire1:FireServer(mouse.Target)
end
end
end
task.wait(0.13)
end
elseif mouse.Target.Parent.Name ~= “Enemy” and mouse.Target ~= nil then
Firing = true
while Firing == true and Ammuntion > 0 and mouse.Target ~= nil do
Ammuntion -= 1
game.ReplicatedStorage.Miss1:FireServer(mouse.Hit.Position, mouse.Hit.Rotation)
task.wait(0.13)
end
end
end
end
mouse.Button1Down:Connect(Fire)