So your animation code works fine, but it seems to be that you are using Mouse.KeyDown [deprecated] instead of a newer function. Let me help you on this code.
wait(2)
local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
Anim = script.Animation
function onKeyPress(actionName, userInputState, inputObject)
if userInputState == Enum.UserInputState.Begin then
s = player.Character.Humanoid:LoadAnimation(Anim)
s:Play()
end
end
game.ContextActionService:BindAction("keyPress", onKeyPress, false, "e")
What this basically does is that it makes use of ContextActionService which is a useful service for a lot of things, and binds a keypress action checking for the key "e" which is the key you demonstrated above, then it runs the animation code. Remember to put this in a localscript, and lua on!
1 comment
Thanks man