I have a gun with an effect that plays when you click, for some reason, it only plays once when you click multiple times.
This is my code:
Local script in tool
uis.InputBegan:Connect(function(input, processed)
if processed then return end
if focused == false then return end
if input.UserInputType == Enum.UserInputType.MouseButton1 then
script.Fire:FireServer()
end
end)```
ServerScript inside of local script
local sounds = script.Parent.Parent.Handle.Grip
local effects = sounds.Muzzle
local debounce = false
script.Parent.Fire.OnServerEvent:Connect(function(player)
if debounce == false then
debounce = true
for _, effect in pairs(effects:GetChildren()) do
effect.Enabled = true
wait(0.1)
effect.Enabled = false
end
sounds.Fire:Play()
task.wait()
sounds.Echo:Play()
task.wait()
debounce = false
end
end)