I'm trying to make it so when after one of these animations loads, the other one also does.

local v = true
local function onKeyPress(input, two)
	if v == true and input.KeyCode == Enum.KeyCode.F then
	    local anim1 = script:FindFirstChild("RightPunch")
	    local player = game.Players.LocalPlayer.Character.Humanoid
	    local punch2 = player:LoadAnimation(anim1)
		punch2:Play()
		v = false
	elseif input.KeyCode == Enum.KeyCode.T and v == false then
		local anim2 = script:FindFirstChild("LeftPunch")
	    local player = game.Players.LocalPlayer.Character.Humanoid
	    local punch1 = player:LoadAnimation(anim2)
		punch1:Play()
		v = true
		end
	end
game:GetService("UserInputService").InputBegan:Connect(onKeyPress)

The animation is only loading once when I press the letter F.

There's nothing in the output.

1 comment

0

Already tried to put some "wait()" on your code ?