How I Can Make Animation Pause/Play

I Want To Create Player Live Animation Pause/Play But I Dont Know How I Can Make Animation Pause/Play
If possible I like to know how I can change animation speed

Game Link

4 Likes

Do you want to stop or slow down the animations of all players (or all humanoids in workspace aswell)?

3 Likes

This is a very simple approach you can use the following example

YourAnimationHere:Play() -- this plays the animation
YourAnimationHere:Stop() -- this stops it.
-- you also detect if animation is playing by  using the following
if YourAnimationHere.IsPlaying then
--YourAnimationHere:Stop() -- forces stops it.
end
-- You can also detect if an animation has ended
YourAnimationHere:Play()
YourAnimationHere.Stopped:Wait()
-- do something.

2 Likes

You could do something like this:

local Tracks = {} -- input all of the tracks you want to pause and unpause
for i, track in pairs(Tracks) do -- to stop animations
    track:AdjustSpeed(0)
end

for i, track in pairs(Tracks) do -- to start animations
    track:AdjustSpeed(1)
end
2 Likes

i want to make only 1 player who is playing animation if he touch on pause then anim pause and if he touch on play anime start(not from starting)

1 Like
local player = game.Players.LocalPlayer
local character = player.Character
repeat wait()
	character = player.Character
until character
local hum = character:WaitForChild("Humanoid")
playing = false
script.Parent.Play.MouseButton1Click:connect(function()
	script.Parent.Emote.AnimationId = "rbxassetid://"..script.Parent.AssetId.Text
	if playing == false then
		local emote = hum:LoadAnimation(script.Parent.Emote)
		emote:Play()
		playing = true
		script.Parent.Play.Text = "Pause"
	elseif playing == true then
		local emote = hum:LoadAnimation(script.Parent.Emote)
		emote:Stop()
		playing = false
		script.Parent.Play.Text = "Play"
	end
end)

its does not play animation(not showing any error)

Is the animation by any chances owned by a different user or owned by a group?

repeat wait() until game.Players.LocalPlayer.Character

local player = game.Players.LocalPlayer
local character = player.Character
local hum = character:WaitForChild("Humanoid")
local animator = hum:WaitForChild("Animator")

local emote = script.Parent:WaitForChild("Emote")

emote.AnimationId = "rbxassetid://"..script.Parent.AssetId.Text

local anim = nil

script.Parent.Play.MouseButton1Click:connect(function()
if anim == nil then
pcall(function()
anim = animator:LoadAnimation(emote)
end)
end
if anim == nil then print("Internal Server Error") return  end
	if script.Parent.Emote.IsPlaying == false then
		anim:Play()
		script.Parent.Play.Text = "Pause"
	else
		anim:Stop()
		script.Parent.Play.Text = "Play"
	end
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.