making a lightsaber block function in a module
the animation plays but it doesn’t stop although it prints it stopped here is the script
function lightsaber.Block(player)
local animation = game.ServerStorage.Animations.Blocks.Block:Clone()
local hum = player.Character:FindFirstChild("Humanoid")
local animator = hum:WaitForChild("Animator") or Instance.new("Animator", hum)
local animtoplay = animator:LoadAnimation(animation)
if isequipped then
if player.Character.Humanoid:GetAttribute("Blocking", true) then
player.Character.Humanoid:SetAttribute("Blocking", false)
if player.Character.Humanoid:GetAttribute("Blocking") == false then
animtoplay:Stop()
animtoplay:Destroy()
print("Blocking Is False")
end
else
player.Character.Humanoid:SetAttribute("Blocking", true)
print("Blocking IS True")
animtoplay:Play()
end
else
return
end
end
here is what it does in game