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

How come my Crouch script won't make a animation play?

Asked by 4 years ago
Edited 4 years ago

So I am making an Idle Crouch and a walking Crouch, but for some reason, the walking Crouch never seems to play. What exactly did I do wrong? If you could help that would be great!

-------------------------------------------------------[|Locations|]------------------------------------------------------------

Script: StarterPlayer ---> StarterCharacterScripts

---------------------------------------------------------[|Script|]----------------------------------------------------------------

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local Animate 
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://4604781082"
  Animate = Humanoid:LoadAnimation(Animation)
  Animate:Play()
 if "rbxassetid://4604781082" == Animate:Play() then
    if Key == "c" then
       Key = "w"
        if Animate == "rbxassetid://4604781082" then
            Animate:Stop() do
            local Animation = Instance.new("Animation", player.Character)
            Animation.AnimationId = "rbxassetid://04606751354"
            Animate = Humanoid:LoadAnimation(Animation)
            Animate:Play()
           end
         end
       end
     end
   end  
end)

mouse.KeyUp:Connect(function(Key)
 if Key == "x" then
  Animate:Stop()
if Animate:Stop() then
  Animate = "rbxassetid://4604781082"
  Animate:Play()
  end
 end
end)

Answer this question