Hello, I really didn’t want to make this post because I thought it would just be a waste, but I am confused on why the script I made only play’s the last keyframe once, then after it doesn’t play that last keyframe. Here’s a gif of what I mean,
If you are wondering, the code is below. It just loads the animation onto the humanoid, then plays that animation.
local RequestAnim = game.ReplicatedStorage.RequestEggHatchAnimation
local function PlayAnimation()
script.Parent.Parent.Parent.Visible = true
local humanoid = script.Parent:WaitForChild("Humanoid")
local anim = humanoid:LoadAnimation(script.Animation)
anim:Play()
anim.Stopped:Wait()
print("Animation track done")
script.Parent.Parent.Parent.Visible = false
end
RequestAnim.Event:Connect(PlayAnimation)
This is a local script parented inside of a viewport frame.
Have you made sure that the viewport frame isn’t being set to false since the other animation is still running?
Ie it’s possible that the next animation starts a few seconds before the old animation calls .Stopped which triggers .visible = false just after the new animation sets it to true
You can fix this with a denounce, so checking if there is another animation call running just after .Stopped before you set visible to false.
No I didn’t try that, but I didn’t think of it since the viewport is becoming invisible after animation.Stopped:Wait() is ran since it only fires once the animation is completed. I’ll add a debounce system brb.
If you’re calling the animations from the server there is going to be somewhat of a synchronization issue. It’s possible this is a different problem but definitely mark down when the server says it’s done waiting and then mark down when the client says it’s done and see if there is a difference in the timestamps.
It’s all done on the client as if an exploiter exploits it all they will be doing is seeing an animation. Everything that is actually important will be handled on the server.