How I Can Fix Animation Start/Stop[Solved]

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)

I suggest you loading the animation using the Animator, not the Humanoid. Try printing the AnimationTrack’s name and see if there is anything.

1 Like

Also when you want to stop the animation, you just load another one. Store the emote var globally.

1 Like

ok let me try

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
	print(script.Parent.Emote.AnimationId)
	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)

doesn’t works any other idea

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

Try now.

1 Like

it doesn’t play animation

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

Can you try importing the animation into a rig and then show me an image?

1 Like

No, not put it here. Import it in a rig and send a screenshot

you can’t use other players animations, you can use only your animations (if your game was in a group or not)

my game was in group and i am using only Catalog - Roblox emotes by roblox

Edit : Sorry, just realized you are using the ‘actual’ player.Character

Where is the character that is playing the animation? Is it in a viewport frame? If so, it needs to be parented under a WorldModel to animate.

image

Character is not in viewport i am making the character animation pause/play with animation id place: Animation - Roblox

Asset IDs differ from animation IDs. An asset ID is shown on the URL, not an animation ID.

Is there a way to obtain the animation ID from a Roblox asset? The answer is yes.

Using insertservice, you can import the asset into your game and see the animation immediately! From there, you can use the anomation ID.

What is the process for adding the insertservice to the system?

Since insertservice cannot be used in client scripts, we will add an event that fires whenever the player wants to play an animation. As a result, the Server script inserts the model and gives it to the client. Afterwards, the client’s function continues.

Here is the fixed file.

Make sure to give this reply a check! :white_check_mark:

Dance fixed.rbxl (48.6 KB)

1 Like

thank you very much for solving my problem

i have 1 question
can we pause player live animation(so player animation stop in his pose)
if we pause animation it was stop animation but in pose (character live animation walk/swim/jump also stop in pose)

Pause Anim.rbxl (49.0 KB)