How do I apply my walking animation to my custom player rigs? I've tried repeatedly for the past 3 days and I couldn't figure it out. It won't run the walking animation. I found something that did help me out but it only plays the animation while pressing 'W'. But a problem with that script, it won't stop running animation (It's a looped walking animation) I want it to stop the animation as soon as you release the key.
local Service = game:GetService("UserInputService") local animation = Instance.new("Animation") local player = game.Players.LocalPlayer local char = player.Character Service.InputBegan:connect(function(input, recieved) if input.UserInputType == Enum.UserInputType.Keyboard then if input.KeyCode == Enum.KeyCode.W then repeat print('Input W') animation.AnimationId = "http://www.roblox.com/Asset?ID=485533211" local animTrack = player.Character.Humanoid:LoadAnimation(animation) animTrack:Play() wait(1) until Service.InputEnded:connect(function(input, recieved) if input.UserInputType == Enum.UserInputType.Keyboard then if input.KeyCode == Enum.KeyCode.W then print('Input W stahped') local animTrack = player.Character.Humanoid:LoadAnimation(animation) animTrack:Stop() end end end) end end end)
This is the script I'm using for reference ^
You can't do this with a Animation
variable.
You can only do this using CFrame.
Try this out: made the functions separate.
local Service = game:GetService("UserInputService") local animation = Instance.new("Animation") local player = game.Players.LocalPlayer local char = player.Character Service.InputBegan:connect(function(input, recieved) if input.UserInputType == Enum.UserInputType.Keyboard then if input.KeyCode == Enum.KeyCode.W then animation.AnimationId = "http://www.roblox.com/Asset?ID=485533211" local animTrack = player.Character.Humanoid:LoadAnimation(animation) animTrack:Play() wait(1) end end end) Service.InputEnded:connect(function(input, recieved) if input.UserInputType == Enum.UserInputType.Keyboard then if input.KeyCode == Enum.KeyCode.W then local animTrack = player.Character.Humanoid:LoadAnimation(animation) animTrack:Stop() end end end)