#Help with cooldown issue

149 messages · Page 1 of 1 (latest)

rocky ledge
#

I made a script for combo string but when the second/last punch end and if you click even 1 time before the cooldown end you will cant use the punch
someone can help me?

frigid bison
#

script please

rocky ledge
#

lemme know if you still here

nimble nacelle
#

Do you want us to guess the code?

rocky ledge
#

@nimble nacelle

nimble nacelle
#

Nesting...

#

ffs dude... Here you could just make one if...

rocky ledge
#

i will change it

#

but i want to know what is the problem that cause the bug

#

@frigid bison

prisma mulch
rocky ledge
#

i sent the code buddy

prisma mulch
rocky ledge
#

you will help me?

neat timber
#

issues

#

many

#

hit() and hit2() functions increment the global variable punchA

#

it will increment beyond the range

#

ur reset punchA wrong

rocky ledge
#

oh

neat timber
#

bruh the `

#

things

#

remained

#

sad

#

discord asks me to send as file

#

but then it dont delete

#

the shit

#

so sad

rocky ledge
#

😦

#

emm

#

so now you rewrite it?

neat timber
#

I just

#

fixed ur punch

#

WHY IT DELETE MY MESSAGE IT STOPID BOT I CANT TALK IN ONE PHRASE

rocky ledge
#

i saw it

#

dw

neat timber
#

:((( so shit bot it bully me:((

rocky ledge
#

lol

neat timber
#

all day it deleted my messages

rocky ledge
#

you gonna change the bot script

neat timber
#

tell me if the refactored function works

rocky ledge
#

kk

#

emm

#

it just play the 2 animations togther

neat timber
#

oh

rocky ledge
#

what you did here?

neat timber
#

after 1 player

#

punchAt

#

is 2

#

after 2 is played

#

punchAt is 1

rocky ledge
#

so it just make the 2 animations run togther

neat timber
#

oh

#

maybe

#

the thread

#

did some fun

#

racing

#

wait a bit

#

i forgor something

#

wait

#

my vsc crashed...

#

stupid....

nimble nacelle
neat timber
#

I refuse

#

I will sent as msg

#

.txct

#

.txt

#

always

rocky ledge
#

ok

neat timber
#

tell me if it still overrides eachother

rocky ledge
#

ok

#

it doesnt override each other but at the second the first animation stopped play the second animaton went right away, and i wanted the second animation to play if the character clicked again

neat timber
#

OF COURSE IT ADDED MY CAN U TRY THIS TEXT

#

nah im quitting discord

rocky ledge
#

its ok

neat timber
#

works

#

half works?

#

0 works?

#

or still 2 play

#

instant after 1

rocky ledge
#

now if im spamming clicks it will play the second animation but if i wait 1 sec it will play the first animation, the punch at acting bad

rocky ledge
neat timber
#

oh

#

got idea

#

fast

#

can use tick

rocky ledge
#

yes

neat timber
rocky ledge
#

ping me if i dont answer fast

neat timber
#

@rocky ledge

rocky ledge
#

bruh im here

#

lol

neat timber
#

xD

rocky ledge
#

errror ServerScriptService.PunchServer:104: attempt to index nil with Instance

neat timber
#

huh?

rocky ledge
#

i think you forgot to announce local lastPunchTime

neat timber
#

i jsut sent the punch function

#

forgor

#

local lastPunchTime = {}

#

add this

#

up

#

in ur variable

#

s

rocky ledge
#

ok

neat timber
#

and change to this

#
 if lastPunchTime[player] and tick() - lastPunchTime[player] < punchDebounceDuration2 then
#

so no error appear

#

in case any appears

rocky ledge
#

the first click playing the first punch, but even if i dont hit character the second animation play and just stuck on the second animation

#

everytime i click

neat timber
#

that's why I hate animations:((

rocky ledge
#

maybe i will return to my original?

mystic deltaBOT
#

studio** You are now Level 6! **studio

neat timber
#

like it only plays 2

#

or

rocky ledge
#

yes

neat timber
#

just

#

stuck

neat timber
rocky ledge
#

the original problem was when i click one more time after the second animation, and before the cooldown of the second punch wear off there will be bug that no longer let you use the punch mechanic/skill

neat timber
#

code

#

but add this at punch function

#

beggining

rocky ledge
#

i do

neat timber
#
if punchDebounce[player] then
        return
    end
rocky ledge
#

still the bug is there

neat timber
#

idk :((

#

too many issues:((

limber apex
#

And if you're a gigachad you can even

local punchDebounce: {[Player]: boolean} = {}

...
#

Cause typing is cool

rocky ledge
#

what is this?

limber apex
#

It's typed variables

#

Here you say your punchDebounce will be a dictionary of key Player and value a boolean

#

So you can do like

punchDebounce[playerService.paulogarithm] = true

But not

punchDebounce[3] = true

Or I can't

punchDebounce[playerService.paulogarithm] = 3
rocky ledge
#

ok

neat timber
#

can

#

u fix his bug

#

instead of teaching lua

#

his animations go brr

rocky ledge
#

em?