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

Why wont my animation play?? I tried everything but it still doesn't work.

I tried to make an Animation script that will make you emote when you press E. But the problem is it wont play and it doesn't show any error on the output.

wait(1)
userinput = game:GetService("UserInputService")
plr = game.Players.LocalPlayer.Character
anim = plr.Humanoid:LoadAnimation(script.anim)

userinput.InputBegan:connect(function(input)
	if input.KeyCode == Enum.KeyCode.E then
		anim:Play()
		end
	end)

1 comment

0

First, check to make sure that its not the function that is wrong. Before line 7 put print("works") to see if its not the animation but maybe the function.

3 answers

✓ Accepted answer
wait(1)
userinput = game:GetService("UserInputService")
plr = game.Players.LocalPlayer.Character

animation = Instance.new("Animation")
animTrack = nil 

anim = plr.Humanoid:LoadAnimation(script.anim)

userinput.InputBegan:connect(function(input)
    if input.KeyCode == Enum.KeyCode.E then
        	animation.AnimationId = " " -- paste your animation id here (HAS TO BE CREATED BY YOU OR IT WON'T WORK)
		animTrack = plr.Humanoid:LoadAnimation(animation)
		animTrack:Play()
        end
    end)

1 comment

0

Thank you!!

When you make an animation in the Animation Editor, you need to remember to set the priority to Action.

1 comment

0

Its already setted to action

Hi, i've had this problem but managed to fix it. By any chance are you making the animation and saving it to yourself but editing a group game. Because if so then that is the reason. Try publishing the animation to your group instead and taking the id

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