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

Animation stops sometimes for no reason. Why?

local player = game:GetService("Players").LocalPlayer
local char = player.Character
repeat wait()
	character = player.Character
until character
local humanoid = char.Humanoid
local mouse = player:GetMouse()

local Frame = script.Parent.Frame
Frame.Visible = false

local animid = Instance.new("Animation")
animid.AnimationId = "rbxassetid://5607811807"
local idle = humanoid:LoadAnimation(animid)
idle.Looped = true
local testBtn = Frame.Menu.ScrollingFrame.Test

local emotesList = {idle}
for i, emote in pairs (emotesList) do
	emote.Priority = 2
end

humanoid.Running:connect(function()
	for i, track in pairs (emotesList) do
		track:Stop()
	end
end)

mouse.KeyDown:connect(function(key)
	if key:lower() == "e" then
		if Frame.Visible then
			Frame.Visible = false
		else
			Frame.Visible = true
		end
	end
end)

testBtn.MouseButton1Down:connect(function()
	local Running if humanoid.MoveDirection ~= Vector3.new(0,0,0) then
	else
		playAnim(idle)
	end
end)

function playAnim(container1)
	Frame.Visible = false
	container1:Play()
end

So I'm having this weird problem. I'm trying to make an emote GUI, but when I start playing an animation, sometimes it stops for no reason. Here's my code:

Here's some proof: https://i.imgur.com/WCCMyWA.gifv

5 comments

0

This won't fix your issue but please use Connect instead of connect as the lowercase version is deprecated

0

Ok, thank you.

0

What is your animation priority?

0

I'm setting the animation priority to 2 in line 20

0

instead of emote.Priority = 2 try emote.Priority = enum.AnimationPriority.Action

1 answer

You can't load more than one animation at a time so why is a table needed? Unless you're storing the animations in there, in which case it won't work because Priority is a property of an animation track (Humanoid:LoadAnimation(Animation)) and not an actual animation instance.

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