Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

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

Asked by 2 years ago

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)
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. Galicate 99 — 2y

3 answers

Log in to vote
0
Answered by
hellmatic 1502 Moderation Voter
2 years ago
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)

0
Thank you!! justin12343434 4 — 2y
Ad
Log in to vote
0
Answered by 2 years ago

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

0
Its already setted to action justin12343434 4 — 2y
Log in to vote
0
Answered by 2 years ago

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

Answer this question