I created an animation (that is on the ROBLOX site now, I had to pay 30 R$) that I would like to play when a player presses the W or UP arrow key on the keyboard, but I do not know how to do this.
Any help?
Thank you!
01 | local animation = Instance.new( "Animation" ) |
02 | animation.AnimationId = "animation ID" -- ex http.robloxblahblah |
03 | local animTrack = Humanoid:LoadAnimation(animation) |
04 |
05 | function onKeyDown(key) |
06 | key = key:lower() |
07 | if key = = "w" then -- i dont know how to do it for the up key, sorry |
08 | animTrack:Play() |
09 | end |
10 | end |
11 | script.Parent.Parent:GetMouse().KeyDown:connect(onKeyDown) |
make sure it is in a local script, in the player's backpack