Hey developers,
I was making a script that would check if a certain animation was playing (in this case the lean animation for my stand) and if it was playing for another animation to stop playing (idle animation), but I can’t figure out what’s wrong with my code
LeanAnim.IsPlaying:Connect(function() local char = player.Character local Stand = char:FindFirstChild("Creator") local AnimControl = Stand.AnimationController local Idle = AnimControl:LoadAnimation(mainFolder.Animations.Idle) if Idle.IsPlaying==true then Idle:Stop() end end)
( I don’t know why the code isn’t indented here but it is regularly)
Why not stop all animations playing? Also that’s not how it’s done.
What do I fix then? Also I was going to do stop all animations playing but for now I was just testing it with Idle
I will give you a script that will disable all animations playing currently. (Like if you want it) k
local char = player.Character
local Stand = char:FindFirstChild("Creator")
local AnimControl = Stand.AnimationController
local activeTracks = AnimControl:GetPlayingAnimationTracks()
for i,v in pairs(activeTracks) do
v:Stop()
end
Tell me if it works
local AnimationTracks = Player.Character.Humanoid:GetPlayingAnimationTracks()
for i, track in pairs (AnimationTracks) do
track:Stop()
end
then load your new animation here and play it
Should I make it that it runs only when the combat animations and lean animation is playing since now it’s just not playing the idle animation
Make it run only in combat animations, and when the combat animation ends make it play the idle again
By the way do you mind giving me the link to the game? I love jojo games.
So my guess is if I was going to play the idle animation I would check if any animations are playing and the player’s speed is 0? Also would it look something like this-- i know i would have to put this in a function but i’m not sure how I would execute it.
local AnimControl = Stand.AnimationController
local activeTracks = AnimControl:GetPlayingAnimationTracks()
local walkspeed=char.Humanoid.WalkSpeed
local Idle = AnimControl:LoadAnimation(mainFolder.Animations.Idle)-- mainfolder is the folder that I put this stand in and I put a variable above for it
if walkspeed==0 -- I'm not sure how to check if there are no playing animations please let me know , I would add activeTracks==false or something
Idle:Play()
When the stand is summoned, make it play the idle animation. When a move is used make all anims stop and play the combat anim, after it ends play the idle animation again.
Yeah sure you can help test with me if you want just add me and I’ll show you it
Tell me your discord, ill add you
--------------------------------------------------- add me and we can discuss on there, I already made it that when the stand is summoned it plays the animation