Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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.

01local Animate
02local player = game.Players.LocalPlayer
03local mouse = player:GetMouse()
04local Humanoid = player.Character:FindFirstChild('Humanoid')
05 
06mouse.KeyDown:Connect(function(Key)
07 if Key == "c" then
08  local Animation = Instance.new("Animation", player.Character)
09  Animation.AnimationId = "rbxassetid://ID"
10  Animate = Humanoid:LoadAnimation(Animation)
11  Animate:Play()
12 end 
13end)
14 
15mouse.KeyUp:Connect(function(Key)
16 if Key == "c" then
17  Animate:Stop()
18 end
19end)

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

Log in to vote
0
Answered by
14dark14 167
5 years ago

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

LocalScript Inside ReplicatedFirst

01local player = game.Players.LocalPlayer
02local mouse = player:GetMouse()
03 
04mouse.KeyDown:Connect(function(Key)
05 if Key == "c" then
06   player.Character.Animate.walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=0000"
07 end 
08end)
09 
10mouse.KeyUp:Connect(function(Key)
11 if Key == "c" then
12 player.Character.Animate.walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=0000"
13 end
14end)

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.

Ad

Answer this question