local LocalPlayer = game:GetService("Players").LocalPlayer
local Controls = require(LocalPlayer.PlayerScripts.PlayerModule):GetControls()
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local WalkSpeed = Humanoid.WalkSpeed
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Animator = Humanoid:WaitForChild("Animator")
local Animations = ReplicatedStorage:WaitForChild("Animations"):GetChildren()
local UserInputService = game:GetService("UserInputService")
local KeyCodes = {
Enum.KeyCode.Z,
Enum.KeyCode.X,
Enum.KeyCode.C
}
local Combo = 0
local MaxCombo = #Animations
local LastTimeClicked = os.clock()
local Debounce = false
local Endlag = false
UserInputService.InputBegan:Connect(function(Input, GameProcessedEvent)
if GameProcessedEvent or Debounce then return end
Debounce = true
if Input.UserInputType == Enum.UserInputType.MouseButton1 or Input.UserInputType == Enum.UserInputType.Touch then
local CurrentTime = os.clock()
Combo += 1
task.spawn(function()
if (Combo > MaxCombo) then
Combo = 0
Endlag = true
end
end)
local AnimationTrack = Animator:LoadAnimation(Animations[Combo])
AnimationTrack:Play()
if (CurrentTime - LastTimeClicked > 1) then
Combo = 0
end
LastTimeClicked = CurrentTime
end
if Input.UserInputType == Enum.UserInputType.Keyboard then
if table.find(KeyCodes, Input.KeyCode) then
print("Player has pressed "..Input.KeyCode.Name)
end
end
if Endlag then
task.delay(2.5, function()
Debounce = false
Endlag = false
end)
else
task.delay(0.5, function()
Debounce = false
end)
end
end)
The combo is always a non-negative integer greater than 0 so I don't know what's going on here