Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Properly Stop Animations?

Asked by 9 years ago

Is there a way to properly stop the animations that are run by the "Animate" script? I have tried removing and disabling the script, trying to get the script to trigger its own "stopAllAnimations" function, and some other stuff... but nothing has worked. Does anybody on here know how to do this?

Thanks in advance!

1 answer

Log in to vote
0
Answered by 9 years ago

Never mind, I figured it out myself.

  1. Destroy Animate script with LocalScript.
  2. Load and play a blank animation with the priority set to core. Here's one: http://www.roblox.com/Empty-Core-Animation-item?id=194175802

Example Script:

Script

function playerAdded(player)
    player.CharacterAdded:connect(function(char)
        while char.Parent ~= game.Workspace do
            wait()
        end

        script.CustomAnimate:clone().Parent = char -- Note: script.CustomAnimate is the LocalScript bellow
    end)
end

game.Players.PlayerAdded:connect(playerAdded)

for i, player in pairs(game.Players:GetPlayers()) do -- Sometimes you are loaded in PlaySolo without the PlayerAdded event being called
    playerAdded(player)
end

LocalScript

local char = script.Parent
char:WaitForChild("Animate"):Destroy()
char.Humanoid:LoadAnimation(script:WaitForChild("BlankAnimation")):Play() -- Note: Script.BlankAnimation is an Animation with an AnimationId of: rbxassetid://194175802
Ad

Answer this question