Hello, i've recently created an animation and i'm trying to learn how to trigger it in game using keydown. I have already tried this :
animation = Instance.new("Wide Reciever Stance") animation.AnimationId. = "http://www.roblox.com/WR-Stance-item?id=173047536" player = game.Players.LocalPlayer mouse = player:GetMouse() animTrack = nil canPlay = true mouse.keyDown:connect(function(activate) activate = activate:lower() if activate == "y" then if canPlay then canplay = false animTrack = player.Character.Humanoid:LoadAnimation(animation) animTrack.KeyframeReached:connect(function(keyframeName) keyframesReached = keyframesReached + 1 print("Keyframe #"..keyframesReached..": "..keyframeName) canPlay = true end) end animTrack:Play() end end) end) end end end)
But it did not work. I am new to scripting. I'm not even sure if I'm doing this right.