Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Properly Stop Animations?

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.