i have made a script where the player should play an animation when they press left control
it does print but wont play the animation at all
local ContextActionService = game:GetService("ContextActionService")
local Player = game.Players.LocalPlayer
local character = Player.Character or Player.CharacterAdded:Wait()
local humanoid = character.Humanoid
local animator = humanoid:FindFirstChild("Animator")
print(animator.Name)
local CrouchingAnimation = script.Crouch
local isCrouching = false
local function CrouchFunc(actionName, inputState, _inputObject)
local CrouchTrack = animator:LoadAnimation(CrouchingAnimation)
if actionName == "Crouching" and inputState == Enum.UserInputState.Begin then
if not isCrouching then
print("Play CrouchingAnimation")
isCrouching = true
humanoid.JumpHeight = 0
CrouchTrack:Play()
else
print("Stop Crouching")
isCrouching = false
humanoid.JumpHeight = 7.2
CrouchTrack:Stop()
end
end
end
ContextActionService:BindAction("Crouching", CrouchFunc, true, Enum.KeyCode.LeftControl, Enum.KeyCode.ButtonL1)
yes i used the right animation ids