So I'm trying to make my animation stop when the player clicks it one more time so I have no clue on how to do it here are the lines. It only stops the animation after 1 click it waits for a sec then stops it.
local Player = game.Players.LocalPlayer local Character = Player.Character or script.Parent local Humanoid = Character.Humanoid local UserInputService = game:GetService("UserInputService")
local AnimationId = -- cannot say for reasons
local Key = 'C'
UserInputService.InputBegan:Connect(function(Input, IsTyping) if IsTyping then return end if Input.KeyCode == Enum.KeyCode[Key] then local Animation = Instance.new("Animation") Animation.AnimationId = AnimationId local LoadAnimation = Humanoid:LoadAnimation(Animation) LoadAnimation:Play() wait(1) if Enum.KeyCode[Key] then wait(0.2) LoadAnimation:Stop() end
end
end)
local Player = game.Players.LocalPlayer local Character = Player.Character or script.Parent local Humanoid = Character.Humanoid local UserInputService = game:GetService("UserInputService") local AnimationId = --cannot say local Key = 'C' UserInputService.InputBegan:Connect(function(Input, IsTyping) if IsTyping then return end if Input.KeyCode == Enum.KeyCode[Key] then local Animation = Instance.new("Animation") Animation.AnimationId = AnimationId local LoadAnimation = Humanoid:LoadAnimation(Animation) LoadAnimation:Play() wait(1) if Enum.KeyCode[Key] then wait(0.2) LoadAnimation:Stop() end end end)