Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[SOLVED] How can i make a player play an animation correctly?

Asked by 4 years ago
Edited 4 years ago

I have an animation and i want the player to play it once E is pressed.

LocalScript:

ocal UserInputService = game:GetService("UserInputService")
local E_Key = Enum.KeyCode.E
local WaitForAnimation = script:WaitForChild("Animation")
local Humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
local Animation = Humanoid:LoadAnimation(WaitForAnimation)

UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
    if (input.KeyCode == E_Key) then
        Animation:Play()
    end
end)

I know that the function is working but the animation isn't playing. I already tried with RemoteEvents and it just printed something. Can anyone explain what is wrong with the code?

P.S.: The code is perfectly fine, tried with an npc and it worked, but not with players.

0
Are there any errors? LucarioZombie 291 — 4y
0
it works perfectly fine. i've tested it. what do you see here wrong? jesusbeef 33 — 4y
0
The animation don't play. User#27525 1 — 4y
0
you can try setting the track.Priority = 1 shanelaw12 64 — 4y

Answer this question