Hi! So, I am making some animations for viewmodels and when I use the Stop() function, the animation doesn’t stop for some reason. How can I fix this?
local hum = Players.LocalPlayer.Character:WaitForChild("Humanoid")
local ViewmodelHum = Viewmodel.Humanoid
local Viewmodel_Run = ViewmodelHum.Viewmodel_Run
local RunS = game:GetService("RunService")
local VMRunTrack = ViewmodelHum:LoadAnimation(Viewmodel_Run)
if hum.MoveDirection.Magnitude > 0 and VMRunTrack.IsPlaying == false then
elseif hum.MoveDirection.Magnitude == 0 and VMRunTrack.IsPlaying == true then
The Stop method has a default fade time of 0.1 seconds, which means your animation will continue to affect the viewmodels for a short amount of time. If that’s your issue, try:
VMRunTrack:Stop(0.0001) -- or some other very small number
-- Alternatively (I don't know if this will work)
No, that’s not the issue, I mean that the animation keeps going even after the player is stopped.
You are creating a new Animation within the Animator of the Character each time your fire the function (which is every frame), so create it once outside of the function, then manipulate it when using the function.
local VMRunTrack = ViewmodelHum:LoadAnimation(Viewmodel_Run) -- create here
-- modify here
RunS.Heartbeat:Connect(AnimationHandlerFunc) -- Fire here
If you have to, use a table, or modules to properly store each animation that goes through so you can easily modify it
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.