I'm not to sure how to make my combo reset after it's first hit is inactive. Anyone know a fix for this issue? Code below:
Remote = game.ReplicatedStorage.RemoteEvent
Enabled = true
Combo = 1
Remote.OnServerEvent:Connect(function(Pley, Action, SeaFrame)
local character = Pley.Character
if Enabled == false then return end
if Action == "Combat" then
Enabled = false
if Combo == 1 then
Combo = 2
local Track = Instance.new("Animation")
Track.AnimationId = "rbxassetid://05083821136"
local Anime = character.Humanoid:LoadAnimation(Track)
Anime:Play()
elseif Combo == 2 then
Combo = 1
local Track = Instance.new("Animation")
Track.AnimationId = "rbxassetid://5084603108"
local Anime = character.Humanoid:LoadAnimation(Track)
Anime:Play()
end
if Action ~= nil
then
character.Humanoid.WalkSpeed = 2
end
wait(0.3)
local Rey = Ray.new(character.HumanoidRootPart.Position, character.HumanoidRootPart.CFrame.LookVector*6)
local v = workspace:FindPartOnRay(Rey, character)
if v ~= nil then
end
local Region = Region3.new(SeaFrame-Vector3.new(3,3,3),SeaFrame+Vector3.new(3,3,3))
local RTable = workspace:FindPartsInRegion3(Region, nil, 20)
for i,v in pairs(RTable) do
if v.Parent:findFirstChild("Humanoid") and v.Parent:findFirstChild("Deb") == nil and v.Parent ~= character then
local Deb = Instance.new("BoolValue", v.Parent)
Deb.Name = "Deb"
game.Debris:AddItem(Deb,0.2)
v.Parent.Humanoid:TakeDamage(7)
v.Parent.Humanoid.WalkSpeed = 4
if Region == nil then
v.Parent.Humanoid.WalkSpeed = 16
end
local SoundFX = Instance.new("Sound", v)
SoundFX.SoundId = "rbxassetid://1693499499"
SoundFX.PlaybackSpeed = math.random(80,120)/100
SoundFX:Play()
end
if Combo == 1 then
Region = nil
wait ()
end
end
wait(0.05)
Enabled = true
end
Action = nil
if Action == nil then
character.Humanoid.WalkSpeed = 16
end
end)
