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

How can I make my emote stop playing when the player moves?

Soo I got this script that plays an animation whenever the player says: '/e bouncydance'.

game.Players.PlayerAdded:connect(function(Plr)
Plr.Chatted:connect(function(msg)
if msg == "/e bouncydance" then
A = Instance.new("Animation", Plr.Character)
A.AnimationId = "rbxassetid://1746899451" 
track = Plr.Character.Humanoid:LoadAnimation(A)
track:Play()
end
end)
end)

The problem is that when the player moves the animation keeps on playing. Could you please tell me what to add so the emote stops playing when the player moves?

Thank you :>

2 comments

0

When you were making the animation, what priority did you set it at? The core priority should make it stop when the player moves, whereas the Action priority shouldn't stop.

0

Btw, the second arg (parent) from instance.new is deprecated, don't use it anymore..

2 answers

✓ Accepted answer
game.Players.PlayerAdded:connect(function(Plr)
	Plr.Chatted:connect(function(msg)
		if msg == "/e bouncydance" then
			A = Instance.new("Animation", Plr.Character)
			A.AnimationId = "rbxassetid://1746899451" 
			track = Plr.Character.Humanoid:LoadAnimation(A)
			track:Play()

			Plr.Character.Humanoid.Running:connect(function(speed)
				if speed > 0 then 
					track:Stop()
				end
			end)
		end
	end)
end)

1 comment

0

Thank you so much! You're the best!

game.Players.PlayerAdded:connect(function(Plr)
Plr.Chatted:connect(function(msg)
if msg == "/e bouncydance" then
A = Instance.new("Animation", Plr.Character)
A.AnimationId = "rbxassetid://1746899451" 
track = Plr.Character.Humanoid:LoadAnimation(A)
track:Play()
end
end)
end)
game.Workspace.Player.Humanoid.Running:connect(function(speed)
	if speed > 0 then
		track:stop()
	end

Hope this is helped you!

2 comments

0

Thank you for answering! Unfortunately, it is still not working, but thanks!

0

Ohhh i sorry for wrong answering :( I'll try my best!

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