I want to figure out what’s causing the problem I’m having
basically, I am making a turn based combat game, and right now, after the first battle, when the enemy attacks the player, it takes a while till the animation starts to play as I have the moment the player gets damaged on an animation event. It only happens after the first enemy but its not always consistent, sometimes the animation plays when its supposed to, sometimes there’s like up to a 20 second delay.
in the clip I show the battle sequence for the first and second enemy, between the cuts are me attacking. you can see as the second enemy attacks more, the delay between his animation playing is getting longer.
I’ve at least maybe ruled out a possible memory leak causing the problem as I’ve tested it with the dev log menu open to see the memory usage and it stayed consistent around 1400 and doesn’t really change between battles as shown in the clip below.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
below is the code for the animation and the damaging in the enemy script
local punchAnim = "rbxassetid://18262149195"
local baseATKDmg : IntValue = enemyHrp.Parent:WaitForChild("baseATKDmg")
local animator : Animator = enemyHum:WaitForChild("Animator")
local animation = Instance.new("Animation")
animation.AnimationId = punchAnim
local animTrack = animator:LoadAnimation(animation)
enemyHum:MoveTo(fightigA1.enemyPlace2Attack.Position)
enemyHum.MoveToFinished:Connect(function()
if attackDone == false then
attackDone = true
animTrack:Play()
task.wait(0.5)
plrHum:TakeDamage(dmg)
-- fires to the client to show the damage that was dealt and shows the health bar
dmgEvent:FireClient(player, dmg, plrHum, "basic", true)
animTrack.Ended:Connect(function()
enemyHum.WalkSpeed = 30
enemyHum:MoveTo(fightigA1.enemySpawn.Position)
task.wait(1)
-- fires to the combat gui local script to show the fighting gui as the enemy attack is done
combatEvent:FireClient(player, "enemyATKdone")
end)
end
end)
attackDone = false
so I just need an opinion or a clue as to what could be causing this problem as I’m really not sure at all as to why this is happening but maybe it might be due to one of the errors shown in the second clip where it says “Property “Animator.EvaluationThrottled” is not currently enabled. (x7)”