VeIexory
(Unknown)
July 3, 2024, 1:40am
#1
im am currently working on a PVP game and i need help playing animations in an order.
script: if math.random(1,2) == 1 then
PlayingAnimation.Animation:Stop()
PlayingAnimation = Animations.Attack1
PlayingAnimation.Animation:Play()
playSound:FireServer(slashSound)
currentDamage = slashDamage
NormalDamage = true
if not Debugging then
toggleTrail:FireServer(true)
end
Hitbox:HitStart()
Hitted = true
wait(1)
Hitted = false
Hitbox:HitStop()
NormalDamage = false
toggleTrail:FireServer(false)
repeat wait() until (tick() - StartTick) >= PlayingAnimation.Duration
if Equipped then
PlayingAnimation.Animation:Stop()
PlayingAnimation = Animations.Idle
PlayingAnimation.Animation:Play()
end
else
PlayingAnimation.Animation:Stop()
PlayingAnimation = Animations.Attack2
PlayingAnimation.Animation:Play()
playSound:FireServer(slashSound)
currentDamage = slashDamage
if not Debugging then
toggleTrail:FireServer(true)
end
NormalDamage = true
Hitbox:HitStart()
Hitted = true
wait(1)
Hitted = false
Hitbox:HitStop()
NormalDamage = false
toggleTrail:FireServer(false)
repeat wait() until (tick() - StartTick) >= PlayingAnimation.Duration
if Equipped then
PlayingAnimation.Animation:Stop()
PlayingAnimation = Animations.Idle
PlayingAnimation.Animation:Play()
end
end
end
CanUse = true
end
end)
1 Like
0101100_0
(η§γ―γγγγγ―γγγ«γ§γ)
July 3, 2024, 10:41am
#2
you can change animation priorities, if thats not what you meant then you can use task.delay and task.spawn to delay functions and spawn functions.
could you please explain yourself better?
i dont understand , what do you mean? Also be more specific about what part you need help about and whatβs the issue
1 Like
VeIexory
(Unknown)
October 3, 2024, 1:55am
#4
like play animation 1 then play animation 2 then 3 ect instead of randomly like 1 2 1 1 1 2 ect.
Have you tried making a table possibly?
sonic_848
(killer)
October 3, 2024, 3:32am
#6
You could try something like this (Plays all anims at once in sequence):
local AnimsToPlayInSequence = {
[1] = nil, --First anim track
[2] = nil, --Second anim track
[3] = nil --Third anim track
}
local function PlayAnims(A:{AnimationTrack})
for _, X in ipairs(A) do
X:Play()
X.Ended:Wait()
end
end
PlayAnims(AnimsToPlayInSequence)
sonic_848
(killer)
October 3, 2024, 3:44am
#7
I was about to go dev something when I realized you might just want to cycle through the animations manually. So here:
local AnimsToPlayInSequence = {
[1] = nil, --First anim track
[2] = nil, --Second anim track
[3] = nil --Third anim track
}
local CurrentAnim = AnimsToPlayInSequence[1]
local function PlayAnim()
CurrentAnim:Play()
local NextAnim = AnimsToPlayInSequence[table.find(AnimsToPlayInSequence, CurrentAnim)+1]
if NextAnim then
CurrentAnim = NextAnim
else
CurrentAnim = AnimsToPlayInSequence[1]
end
end
system
(system)
Closed
October 17, 2024, 3:45am
#8
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.