You can write your topic however you want, but you need to answer these questions:
I wanna make a stunlock system on combat, but combat stops working
Im trying make a enemy combat script disable
-- local script
wait(2)
local CD = false
local player = game.Players.LocalPlayer
local char = player.Character
local Mouse = player:GetMouse()
local Bombo = .4
Mouse.Button1Down:Connect(function()
if CD then return end
for _, v in pairs(player.Character:GetChildren()) do
if v:IsA("Tool") then return end
end
spawn(function()
CD = true
wait(Bombo)
CD = false
end)
script.RemoteEvent:FireServer()
end)
-server script
local Combo = 0
local Vremya = 0.8
local Damage = 10
local HitBox = 6
script.Parent.OnServerEvent:Connect(function(Player, EnemBlocking)
local character = Player.Character
local Humanoid = character.Humanoid
Combo = Combo + 1
local udar1 = Humanoid:LoadAnimation(script.Udar1)
local udar2 = Humanoid:LoadAnimation(script.Udar2)
local udar3 = Humanoid:LoadAnimation(script.Udar3)
for i, v in pairs(game.Workspace:GetChildren()) do
local m = (v:IsA("Model") and v) or nil
if m and m:FindFirstChild("HumanoidRootPart") and m ~= character then
if(character.HumanoidRootPart.Position - m.HumanoidRootPart.Position).magnitude <= HitBox then
if Combo == 1 or Combo == 2 or Combo == 3 then
m.Humanoid:TakeDamage(Damage)
local offCombat = m:GetPlayerFromCharacter()
offCombat.Backpack.Bombat.Disabled = true
wait()
offCombat.Backpack.Bombat.Disabled = false
end
if Combo == 1 then
local Udaril1 = script.Udaril1:Clone()
Udaril1.Parent = m.Head
Udaril1:Play()
game.Debris:AddItem(Udaril1, .4)
m.Humanoid:LoadAnimation(script.Vpital):Play()
end
if Combo == 2 then
local Udaril2 = script.Udaril2:Clone()
Udaril2.Parent = m.Head
Udaril2:Play()
game.Debris:AddItem(Udaril2, .4)
m.Humanoid:LoadAnimation(script.Vpital):Play()
end
if Combo == 3 then
local Udaril3 = script.Udaril3:Clone()
Udaril3.Parent = m.Head
Udaril3:Play()
game.Debris:AddItem(Udaril3, .4)
m.Humanoid:LoadAnimation(script.Vpital):Play()
local BV = Instance.new("BodyVelocity",m.HumanoidRootPart)
BV.Velocity = Player.Character.HumanoidRootPart.CFrame.lookVector * 150
BV.MaxForce = Vector3.new(5000000,999999999,5000000)
BV.P = 100
game.Debris:AddItem(BV,.5)
end
end
end
end
if Combo == 1 then
udar1:Play()
local udar4ik = script.UdarSwing:Clone()
udar4ik.Parent = character.HumanoidRootPart
udar4ik:Play()
else if Combo == 2 then
udar2:Play()
local udar4ik = script.UdarSwing:Clone()
udar4ik.Parent = character.HumanoidRootPart
udar4ik:Play()
spawn(function()
wait(Vremya)
if Combo == 2 then
Combo = 0
end
end)
else if Combo == 3 then
udar3:Play()
local udar4ik = script.UdarSwing:Clone()
udar4ik.Parent = character.HumanoidRootPart
udar4ik:Play()
spawn(function()
wait(Vremya)
if Combo == 3 then
Combo = 0
end
end)
Combo = 100
wait(2)
Combo = 0
end
end
end
end)