How can I make it so where you can press T again after the animation is activated to turn it off? Sorta like a toggle.
local UIS = game:GetService(‘UserInputService’)
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Key = ‘T’
local Animation = Instance.new(‘Animation’)
Animation.AnimationId = ‘rbxassetid://4515171742’
local Debounce = true
UIS.InputBegan:Connect(function(Input, IsTyping)
if IsTyping then return end
local KeyPressed = Input.KeyCode
if KeyPressed == Enum.KeyCode[Key] and Debounce then
Debounce = false
local LoadAnimation = Character.Humanoid:LoadAnimation(Animation)
LoadAnimation:Play()
wait(2)
Debounce = true
end
end)