Hey, guys
I was making a pvp module between 2 players, and the cooldown between their attacks, I’m using animation length.
Firstly I used animationTrack.Ended:Wait(), and it worked well, but I remembered about the fact that the script will fall if 1 of the player will leave, so I did something and tested; if the player what carries cooldown with their animations leave, then the script will wait forever and never continue.
So I thought about animationTrack.Length, why not just doing something like:
task.wait(animationTrack.Length)
It didn’t worked. The whole pvp freezed without an error or warning message.
So I wrote:
local sunrise_start_animation = sunrise_hum.Animator:LoadAnimation(animations_folder.start.sunrise)
local sunrise_idle_animation = sunrise_hum.Animator:LoadAnimation(animations_folder.idle.sunrise)
local sunrise_attack_win_animation = sunrise_hum.Animator:LoadAnimation(animations_folder["something about sunrise"]["sunrise hit → win"].sunrise)
local sunrise_attack_fail_animation = sunrise_hum.Animator:LoadAnimation(animations_folder["something about sunrise"]["sunrise hit → fail"].sunrise)
local sunrise_got_hit_animation = sunrise_hum.Animator:LoadAnimation(animations_folder["something about evgeniy"]["evgeniy hit → win"].sunrise)
local sunrise_dodged_animation = sunrise_hum.Animator:LoadAnimation(animations_folder["something about evgeniy"]["evgeniy hit → fail"].sunrise)
local sunrise_double_attack_animation = sunrise_hum.Animator:LoadAnimation(animations_folder["both is attacking"].sunrise)
local sunrise_double_dodging_animation = sunrise_hum.Animator:LoadAnimation(animations_folder["both is dodging"].sunrise)
-- animation durations for task.wait() s
local SSA_Length = sunrise_start_animation.Length
local SIA_Length = sunrise_idle_animation.Length
local SAWA_Length = sunrise_attack_win_animation.Length
local SAFA_Length = sunrise_attack_fail_animation.Length
local SGHA_Length = sunrise_got_hit_animation.Length
local SDA_Length = sunrise_dodged_animation.Length
local SDAA_Length = sunrise_double_attack_animation.Length
local SDDA_Length = sunrise_double_dodging_animation.Length
warn(SSA_Length)
warn(SIA_Length)
warn(SAWA_Length)
warn(SAFA_Length)
warn(SGHA_Length)
warn(SDAA_Length)
warn(SDAA_Length)
warn(SDDA_Length)
Look at the all these warns, they all showing 0. Why??
I tried this script in the command bar:
local animation = Instance.new("Animation", workspace)
animation.AnimationId = "animation here"
local dance = game.Players.LocalPlayer.Character.Humanoid.Animator:LoadAnimation(animation)
print(dance.Length)
dance:Destroy()
animation:Destroy()
and it showed real numbers.
So I’m wondering, how does that works, and where did I failed the job? Why is it showing 0 in the module, but in the command bar it shows real length?
Please, help
