Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make mousebutton1 have to be pressed repeatedly instead of hold?

Asked by
Launderer 343 Moderation Voter
6 years ago

So in my script here it all works right but if you hold mousebutton1 down it'll keep attacking which isn't what I want. I want it to be the player has to click multiple times for it to attack. This part of the script is to a 250 line all FE lightsaber script I'm making in serverscriptservice which requires no tool.

game:GetService("UserInputService").InputBegan:connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 and player.Character.equipped.Value == true and attackdebounce == 0 and attack == 2 then
attackdebounce = 1
player.Character.Humanoid:LoadAnimation(anim2):Play()
attack = 1
game.ReplicatedStorage.Remotes.RemoteLightsaberAttack:FireServer()
wait(0.5)
attackdebounce = 0
end
end)
end)
end)
0
You can add a variable so that they have to press a certain amount of times or it won't work. Local Clicks = 0, -- userinput, everyclick +1 to Clicks if Clicks == value you want then do what you want BlackOrange3343 2676 — 6y

Answer this question