So, I made a new script for my combat system, but the combatVal won’t increase. Please help, there are no errors.
Script:
local StarterHit = 10
script.Parent.OnServerEvent:Connect(function(Player,Action,V1)
local Combo = Player:FindFirstChild("ComboVal").Value
local dmg = Player:FindFirstChild("Damage")
local c = Player.Character
for i, v in pairs(workspace:GetChildren()) do
if v:FindFirstChild("HumanoidRootPart") and v:FindFirstChild("Humanoid") and v:FindFirstChild("Debounce") == nil and v ~= c then
if (v.HumanoidRootPart.Position-c.HumanoidRootPart.Position).Magnitude < 5 then
if Combo == 0 then
v.Humanoid:TakeDamage(dmg.Value)
Combo += 1
elseif Combo > 0 and Combo < 5 then
v.Humanoid:TakeDamage(dmg.Value * Combo)
Combo += 1
elseif Combo == 5 then
v.Humanoid:TakeDamage(dmg.Value * Combo)
Combo -= Combo
local forcefieldPart = Instance.new("Part",v.HumanoidRootPart)
forcefieldPart.Name = "forcefieldPart"
forcefieldPart.CFrame = v.HumanoidRootPart.CFrame - Vector3.new(0,0,1)
local forceField = Instance.new("ForceField")
forceField.Name = "KnockbackField"
forceField.Parent = v.HumanoidRootPart.forceFieldPart
wait(2)
forceField:Destroy()
end
end
end
end
end)