Trying to make a combat system but only loads first animation when I click

You can write your topic however you want, but you need to answer these questions:

  1. Trying to figure out why its only loading the first animation

  2. The issue is its only loading the first animation when I fire my left mouse button

  3. Tried fixing it but nothing will work

local player = game.Players.LocalPlayer
local Character = player.Character
local Mouse = player:GetMouse()
local UIS = game:GetService("UserInputService")
-----------------------------------------------
local CurrentTime = 0
local PastTime = 0
local Count = 0

UIS.InputBegan:Connect(function(Input,IsTypin)
	if IsTypin then
		return
	end
	
	if Input.UserInputType == Enum.UserInputType.MouseButton1 then
		CurrentTime = tick()
		PastTime = CurrentTime - PastTime
		-----------------------------------
		if PastTime < CurrentTime then
			--------- Can still do the combo
			Count = Count + 1
			-------------------------------
			if Count > 2 then
				Count = 0
			end
		
		
		end
		local Anims = {
			game.ReplicatedStorage.RightPunch,
			game.ReplicatedStorage.LeftPunch,
			
}
--------------------------------------------		
		for _,v in pairs(Anims) do
			local humanoid = player.Character:WaitForChild("Humanoid")
			local animator = humanoid:WaitForChild("Animator")
			local LoadAnimation = animator:LoadAnimation(v,(Count))
			LoadAnimation:Play()
		end
	end
end)

I don’t understand why are you doing CurrentTime - PastTime(which is 0 you never changed this variable) so the if PastTime < CurrentTime statement will never run, and why are you using a for loop just do local LoadAnimation = animator:LoadAnimation(Anims[Count])

I tried doing it without the for loop still only loads the first animation because I’m dumb and didn’t realize the animation was in r15, and for the current time - past time thing I just realized you were right,

But I just found out like at this second the other animation was in r15 when it’s a r6 game

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.