Here's the important code:
elseif Action == "Blocking" then
local BlockingTrack = Instance.new("Animation")
BlockingTrack.AnimationId = "rbxassetid://5998743756"
local BlockingAnim = c.Humanoid:LoadAnimation(BlockingTrack)
BlockingAnim:Play()
Enabled = false
ButtonDown = true
local B = Instance.new("BoolValue", c)
B.Name = "PerfectBlocking"
print("Blocking")
spawn(function()
wait(0.2)
B.Name = "Blocking"
wait(1)
Enabled = true
end) --here, right here
if ButtonDown == false then
BlockingAnim:Stop()
end
while ButtonDown == true do
wait(0.2)
end
game.Debris:AddItem(B,0)
end
end)
The main script:
Player = game.Players.LocalPlayer repeat wait() until Player.Character Character = Player.Character mouse = Player:GetMouse()
Key = "" Enabled = true ButtonDown = false
mouse.Button1Down:connect(function() if Enabled == true then script.Function:FireServer("Combat", Character.HumanoidRootPart.CFrame*CFrame.new(0,0,-2).p) end end)
game:GetService("UserInputService").InputBegan:Connect(function(Input, Game) if Game == true then return end if Input.KeyCode == Enum.KeyCode.F then ButtonDown = true Key = "F" script.Function:FireServer("Blocking") while ButtonDown == true do wait() end script.Function:FireServer("Release") end end)
game:GetService("UserInputService").InputEnded:connect(function(Input, Game) if Game == true then return end if Input.KeyCode == Enum.KeyCode.F and Key == "F" then ButtonDown = false end end)
