#Second attack isnt playing it's animatio

1 messages · Page 1 of 1 (latest)

jaunty galleon
#

Im making an attacking script that plays the animations when the current combo is at a specific number, Both combo 1 and 3 work fine but 2 resets itself before the animation gets time to play

Heres the code (cant give the whole thing because its more than 2000 characteres) :

opaque bane
#

invest in a Finite State Machine please

#

Whats the value of M2Begin

jaunty galleon
opaque bane
#

Its a system which manages states

#

Search on youtube

jaunty galleon
opaque bane
#

Send the module for data

jaunty galleon
#

the thing is that the animation DOES attempt to play but its canceled for some reason

#

hold on

#

Unarmed = {
WeaponName = "Empty",
WeaponType = "Light",
BaseDamage = 5,
StunTime = 1,
ArmorPEN = 0,
SwingSpeed = 0.6,
Weight = 3,

    AnimationSet = game.ServerStorage.Animations.Combat.Basic.Unarmed,
    IdleBegining = 0,
    IdleEnd = 2,
    
    BlockBegining = 3,
    BlockEnd = 4,
    
    M1Begin = 5,
    M1BeginMarker = "Punch1Begin",
    M1End = 6.6,
    M1EndMarker = "Punch1End",
    M1Size = Vector3.new(6, 6, 6),
    M1Dodgable = true,
    M1Parryable = true,
    
    M2Begin = 6.6,
    M2BeginMarker = "Punch1End",
    M2End = 8,
    M2EndMarker = "Punch2End",
    M2Size = Vector3.new(6, 6, 6),
    M2Dodgable = true,
    M2Parryable = true,
    
    M3Begin = 5,
    M3BeginMarker = "Punch1Begin",
    M3End = 6.6,
    M3EndMarker = "Punch1End",
    M3Size = Vector3.new(6, 6, 6),
    M3Dodgable = true,
    M3Parryable = true,
    
    Model = nil
}
opaque bane
#

@jaunty galleon

#

you really should make this using finite state machines

#

Its way harder to debug when its hard coded

jaunty galleon
#

thats why im making it like this

opaque bane
jaunty galleon
#

im not sure how to explain it

opaque bane
#

Can you show a video of the error?

jaunty galleon
#

hold on im doing liek to things at once 😭

#

yea give me a few minutes

opaque bane
#

kk

jaunty galleon
opaque bane
#

Have you checked the whole animation track?

#

Why are you using one track for 3 animations btw

jaunty galleon
#

yeah the events are placed where they should be and the animation isnt broken

jaunty galleon
opaque bane
#

.-.

#

okay

#

wait

#

where is the script located

jaunty galleon
#

?

haughty brookBOT
#

studio** You are now Level 2! **studio

jaunty galleon
#

in the character i think

#

yah

opaque bane
#

How new are you to scripting

jaunty galleon
#

that is

#

a question

#

ive been using this dreaded software for a few years but im still not good at it

opaque bane
#

The script is replicated on every character wasting alot of memory and alot of problems could arise

#

The script should be located in the serverscript service

#

one script that talks to the client via remotevents

#

The User Input is taking through clientside and sent to the server

#

Do you know what OOP is or modular style of coding?

jaunty galleon
#

i dont think so

#

ill deal with all those issues later i just need to fix this dang attack script so i can get on with other things

opaque bane
#

You're building a bad habit

jaunty galleon
#

its not like ill keep it like this forever i just need to know the script works before i move it

opaque bane
#

Try to set the value directly to 6.6

#

to see if the variable is causing the issue or the animation track

jaunty galleon
#

nothing changes

opaque bane
#

So its the animation track

jaunty galleon
#

its not the variable or the animation track

#

ive tried

#

something is ending the animation earliy i KNOW it

#

my initial guess is that somehow the attacking atribute isnt being set so the idle ends up playing instead of the attacking animation

opaque bane
#

ah

#

i might see the problem

jaunty galleon
#

?

opaque bane
#

You never wait for the animation to finish

#

you create a new thread

jaunty galleon
#

currentAnimTrack:GetMarkerReachedSignal(CurrentWeapon.M3EndMarker):Connect(function()
Character:SetAttribute("Attacking", false)
end)

opaque bane
#

and instead of waiting for the animation to end you increase it

opaque bane
#

it doesnt wait

#

btw

#

@jaunty galleon

#

Instead of using markers

#

do this instead

#

or

#

add this below the markerreachedsignal

#
task.wait(M2End-M2Begin)
#

?

jaunty galleon
#

uhh

#

that just breaks the other two

opaque bane
#

Add that after each markerreachedsignal

jaunty galleon
#

and the second one stays the same

opaque bane
#

add them to the others

#

your script extends the combo before the hit is complete

jaunty galleon
#

WAIT HOLD ON

#

nvm

opaque bane
#

where do you end the anim

jaunty galleon
#

when the marker reaches the hit end

#

ok

#

so

#

dont be mad at me

#

but

#

you MIGHT have been right about the animation track being the problem

opaque bane
#

.-.

#

what happened

jaunty galleon
#

apparently for some reason since i was using the first attack end time position it ended the attack early because of this

currentAnimTrack:GetMarkerReachedSignal(CurrentWeapon.M1EndMarker):Connect(function()
Character:SetAttribute("CurrentCombo", 2)
Character:SetAttribute("Attacking", false)
end)

#

which i have NO clue how it was effecting the second attack but

#

its fixed now

#

thank you!