workin on a lightsaber module and cannot get the block to set properly here is the function
function lightsaber.Block(player)
if player.Character.Humanoid:GetAttribute("Stunned", true) or player.Character.Humanoid:GetAttribute("Stunned", false) then
return
else
local animation = game.ServerStorage.Animations.Blocks.Block
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)
animtoplay:Stop()
animtoplay.Looped = false
print("Blocking Is False")
return
elseif player.Character.Humanoid:GetAttribute("Blocking", false) then
player.Character.Humanoid:SetAttribute("Blocking", true)
print("Blocking IS True")
audio.Blocks.Block:Play()
animtoplay:Play()
animtoplay.Looped = true
end
else
return
end
end
end
end
here is what it does in-game
you can see the problem in the output
it isn’t stopping the animation something Is wrong with the else if statement but idk what