local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local Animation =
Instance.new ("Animation")
-- Замените этот ID на ваш AnimationId
Animation.AnimationId = "rbxassetid://YOUR_ANIMATION_ID" -- Замените на ваш ID анимации
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animationTrack = humanoid:LoadAnimation(Animation)
-- Функция для обработки нажатия клавиши
local function onInputBegan(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.LeftControl then
if not animationTrack.IsPlaying then
animationTrack:Play()
else
animationTrack:Stop()
end
end
end
end
-- Подписываемся на событие ввода
User InputService.InputBegan:Connect(onInputBegan)