relatively simple. just curious what the best method of doing it is
here’s my idea:
repeat
print("fire")
fire:FireServer()
task.wait(cooldown) -- 0.1s
until not uis:IsMouseButtonPressed(Enum.UserInputType.MouseButton1)
what ends up happening, though, is that it is very inconsistent on its firing. i assume it is because i try to send a remote to the server but its still on cooldown so it just ignores it.
i used a RemoteFunction to fix this, but im just curious whether thats the best method.
The way I usually handle this is having an InputBegan and InputEnded and under the Began variable I would have a
UIS.InputBegan:Connect(function(input)
if input == Enum.UserInputType.MouseButton1 then
IsHoldingMouse = true
end
end)
UIS.InputEnded:Connect(function(input)
if input == Enum.UserInputType.MouseButton1 then
IsHoldingMouse = true
end
end)
and then in a repeat loop or render stepped function have a debounce variable tied to the firerate of the weapon and fire the remote event every firerate as long as the IsHoldingMouse == true