Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Make a crawling animation still play when the user stops and then walks again?

Hello,

Recently I have been trying to make an animation script that plays the animation I have made, but every time The user stops and carries on walking again, the animation stops and then has to repress the key to activate it. I have tried many different ways of doing this but none have worked and have just made the script more glitchy.

local Animate 
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local Humanoid = player.Character:FindFirstChild('Humanoid')

mouse.KeyDown:Connect(function(Key) 
 if Key == "c" then
  local Animation = Instance.new("Animation", player.Character)
  Animation.AnimationId = "rbxassetid://ID"
  Animate = Humanoid:LoadAnimation(Animation)
  Animate:Play()
 end  
end)

mouse.KeyUp:Connect(function(Key)
 if Key == "c" then
  Animate:Stop()
 end
end)

I have also tried checking if a key has been pressed, like W, and if so, carry on the animation if crawling = true, along with trying to make the animation pause when the user isn't moving, but not ending the animation.

Would there be any way of being able to do this?

1 answer

Im not really good with animations, but this should work!

LocalScript Inside ReplicatedFirst

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

mouse.KeyDown:Connect(function(Key) 
 if Key == "c" then
   player.Character.Animate.walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=0000"
 end  
end)

mouse.KeyUp:Connect(function(Key)
 if Key == "c" then
 player.Character.Animate.walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=0000"
 end
end)

If you arent pleased with the results you can try changing the property of the animation - make it idle, action, (idk what other options there are). Again im not the best with animations.

This discussion is preserved as it was. New answers, comments, and votes are closed.