I am new to scripting and have very little knowledge, but this is what i have so far:
wait(2)
local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
Anim = script.Animation
Mouse.KeyDown:connect(function(key)
if key == "q" then
local crouch = player.Character.Humanoid:LoadAnimation(Anim)
crouch:Play()
else
local crouch = player.Character.Humanoid:LoadAnimation(Anim)
crouch:stop()
end
end)
By the way, here's where its placed: StarterPack -> LocalScript -> Animation
I would like to have a toggle key to turn on and off crouching. I have looked up online tutorials, but found nothing about toggling an animation. Sorry if the script is cringey to look at, but i don't know much. So far, I am able to get the player to crouch when "Q" is pressed, but can't get it to stop. Any help? Thanks.

1 comment
why did you use KeyDown if you said it was deprecated then?