For a while now, I’ve been trying to get some animations to load properly. I’ve set animation priority both in the animation editor and in the script. I’ve also tried using ‘:AdjustWeight()’. None of them have worked, or even slightly improved it. The animation is playing on the server, playing it on the client doesn’t work well, either. And there are no errors.
This is how it should play:
This is how it plays when I test:
no it is not a single animation, they are 4 separate ones
local Track = Instance.new("Animation")
Track.Name = AnimationName
local ID = Animations[AnimationName]["id"]
Track.AnimationId = "rbxassetid://"..ID
local Animator = Figure.Humanoid:findFirstChild("Animator")
local Animation = Animator:LoadAnimation(Track)
Animation.Priority = Enum.AnimationPriority.Action
I have a function in a module script that returns the animation. This is called by a script, where it plays the animation.
No, I don’t have an Idle animation specifically for the sword, the idle animation that you see is just a custom anim inputed into Roblox’s animation script. Yes the animation plays when clicked, but the animation does stop and wait before the next attack.
AttackAnimation.Stopped:Connect(function() -- when attack animation is stopped or finished playing
Enabled = true -- allow to move on to next attack
end)
AttackAnimation:Play() -- play animation
Enabled = false -- do not allow to move on to next attack
AttackAnimation.Stopped:Wait() -- waits until animation is stopped
return 4 -- just because
AttackAnimation:Play() – play animation
Enabled = false – do not allow to move on to next attack
AttackAnimation.Stopped:Wait() – waits until animation is stopped
return 4 – just because
AttackAnimation.Stopped:Connect(function()
Enabled = true -- allow to move on to next attack
AttackAnimation:Play() -- play animation
Enabled = false -- do not allow to move on to next attack
AttackAnimation.Stopped:Wait() -- waits until animation is stopped
return 4 -- just because
end)
Maybe it will work!
Or you can use instance.Changed to detect if any propertie was changed on the animation.
You can use as well If Enabled == true then and maybe it works.
It won’t because AttackAnimation.Stopped only fires when said animation is stopped or is finished playing. It cant stop or finish playing if I never say AttackAnimation:Play() outside of it, in addition, there is no point in Enabling and then Disabling without waiting.
also, I use something similar to if Enabled == true then:
When I did animations in my game, I used something like: wait(animationTrack.Length)
to wait the appropriate time between tracks (it essentially does the same thing as the event, but is a wait yield).
For each attack/animation, you click once. I am only clicking 4 times. But, even if I did click more than 4 times, it would register because the server is still waiting for the animation to end before accepting any more requests.
Right, I have made a sword script with a similar setup. My problem was the extra clicking interrupting the animation. You would ensure that this doesn’t interrupt with a boolean because I believe it would still try to run the animation again even if it waits. The wait just yields the code after the wait not any other clicks that incur.
edit:
Might I add, that the boolean be a debounce check. If you’re using a tool, you could even go as far as just checking the Tool.Enabled property for this.
Just surround your animation code with the debounce check and that might solve your issue? (Block any other unwanted clicks before animation finishes?)
In whatever suite you use you get like a list of each part that is in your animation. Your sword handle has to be in that list or else it wont get animated. To check that open your 2nd 3nd or 4th animation in your editor and check if your sword is in that list. Your 1st animation seems to be animated correctly.
The part that controls the sword is listed in the animation. (The sword is one mesh part that is welded to a regular part that is connected to the right arm using a Motor6D).
Yes, everything there is animated. I put keyframes everywhere, I also import it to moon animator and then take export it. The only reason I’m showing it here is because it’s easier to see.