#Punches that go right -> left ,...

1 messages · Page 1 of 1 (latest)

hot ibex
#

I want to make a 2 punch combo system where the frist click plays the right punch animation and the second click plays the left punch animation,

#

How do i achieve this?

uneven pine
#

im codnifent and im not testing it but i hope it will work

local punches = 0

punchEvent:Connect(function()
    punches += 1
    if punches == 1 then
        -- first punch code
    elseif punches == 2 then
        -- second punch code
    end

    task.wait(small number)
    punches = 0
end)

better refined code (thanks kleb apple)

local punches = 0

punchEvent:Connect(function()
    punches += 1
    if punches == 1 then
        -- first punch code
        return
    elseif punches == 2 then
        -- second punch code
       return
    end

    task.wait(small number)
    punches = 0
end)
brazen thistle
#

this code would reset the punches after the first one, you need a return after each if statement

#

if punches == 1 then
-- code
return
elseif