So I need some information on how to make a combo system. What could be the best way in order to make one?
And here’s my punch script (a local script located in StarterCharacterScripts):
local Player = game.Players.LocalPlayer
repeat wait() until Player.Character
local Humanoid = Player.Character.Humanoid
local UIS = game:GetService("UserInputService")
local debounce = false
local Punch = script.Punch
local Punch2 = script.Punch2
local LeftArm = game.Players.LocalPlayer.Character["Left Arm"]
local Table = {LeftArm}
local CanDamage = false
UIS.InputBegan:Connect(function(Input, IsTyping)
if IsTyping then return end
if not debounce then
debounce = true
if Input.KeyCode == Enum.KeyCode.Z then
local PunchTrack = Humanoid:LoadAnimation(Punch)
CanDamage = true
PunchTrack:Play()
end
wait(1)
debounce = false
end
end)
--RemoteEvent--
local RmtEvent = game.ReplicatedStorage.RemoteEvents.Punch
for i,v in pairs(Table)do
v.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid")and CanDamage == true then
CanDamage = false
RmtEvent:FireServer(hit.Parent)
print("Enemy Hit!")
end
end)
end