Hi guys!
Sorry for bad english.. i have write this code ->
UIS.InputBegan:connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then if Equipado == true then if Recarregando == false then Atirando = true spawn(function() while Atirando == true do wait() if Recarregando == false then if Bala > 0 then Atacar() Bala = Bala - 1 refresh(Bala) elseif Recarregando == false then Recarregando = true script.Parent.Handle.Reload:Play() refresh("R") Atirando = false wait(2) Bala = LimitBala refresh(Bala) Recarregando = false end end end end) end end end end) UIS.InputEnded:connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then if Equipado == true then Atirando = false end end end)
This script work correctly, but if i do a double-click, this script broke (in short, the script is performed 2 times and not 1).
Who can help me?
Fixed:
UIS.InputBegan:Connect(function(Input) if Input.UserInputType == Enum.UserInputType.MouseButton1 then keydown = true end end) UIS.InputEnded:Connect(function(Input) if Input.UserInputType == Enum.UserInputType.MouseButton1 then keydown = false end end) while true do wait(0.03) if keydown then if Equipado == true then if Recarregando == false then Atirando = true if Bala > 0 then Atacar() Bala = Bala - 1 refresh(Bala) elseif Recarregando == false then Recarregando = true script.Parent.Handle.Reload:Play() refresh("R") Atirando = false wait(2) Bala = LimitBala refresh(Bala) Recarregando = false end end end end end