Hi all,

I have recently made an animation GUI, And have added an animation. Problem is, When i move, The animation keeps playing. Any help?

Here's The Script:

wait(1)
local scrollingframe=script.Parent
local user=game.Players.LocalPlayer
repeat wait() until user.Character local char=user.Character
local humanoid=char:WaitForChild("Humanoid")
local anim
function playanim(id)
	if char~=nil and humanoid~=nil then
		local id="rbxassetid://"..tostring(id)
		local oldanim=char:FindFirstChild("LocalAnimation")
		if anim~=nil then
			anim:Stop()
		end
		if oldanim~=nil then
			if oldanim.AnimationId==id then
				oldanim:Destroy()
				return
			end
			oldanim:Destroy()
		end
		local animation=Instance.new("Animation",char)
		animation.Name="LocalAnimation"
		animation.AnimationId=id
		anim=humanoid:LoadAnimation(animation)
		anim:Play()
	end
end
local b1=scrollingframe.Button1
b1.MouseButton1Down:connect(function() playanim(b1.AnimID.Value) end)

Thanks in advance.

2 comments

1

keep in mind that the animation is set as core, still doesn't work.

0

When you made the animation, what type of animation did you make it? If the animation was set to action, i think, then when you move the animation would stop. If that isn't the problem then I don't really know much more.