-
I’m trying to make a local script so that when a player presses mouse button 1, they do a light attack, then after that, if they press mouse button 1 again they do a medium attack, then if they press mouse button 1 once more it does a heavy attack.
-
The issue is that after pressing mouse button 1 once, upon pressing it again it does not do the medium attack instead it repeats the light attack.
-
I have re-read the code and how to use elseif statements but I have no idea what to do to fix this issue.
inputService.InputEnded:Connect(function(input, gameProcessedEvent)
local lightDebo = false
local mediumDebo = false
if debounceLMB == false then
if not gameProcessedEvent then
if input.UserInputType == Enum.UserInputType.MouseButton1 then
if lightDebo == false and mediumDebo == false then
lightDebo = true
lightEvent:FireServer()
print("LIGHT FIRED")
elseif lightDebo == true and mediumDebo == false then
lightDebo = false
mediumDebo = true
mediumEvent:FireServer()
print("MEDIUM FIRED")
elseif mediumDebo == true and lightDebo == false then
lightDebo = false
mediumDebo = false
debounceLMB = true
heavyEvent:FireServer()
print("HEAVY FIRED")
end
if debounceLMB == true then
wait(1)
debounceLMB = false
end
end
end
end
end)