I want to play a guardbreak animation on the character, it works on players, but not npc’s
It doesnt play, it only stuns them, the animation just doesnt play on them
I tried setting the priortiy to Action4
function GlobalWeapons.DealPosture(char, posture)
if char:GetAttribute("Stunned") then return end
char:SetAttribute("Posture", math.clamp(char:GetAttribute("Posture") + posture,0, 100))
--print(char:GetAttribute("Posture"))
if char:GetAttribute("Posture") == 100 then
char:SetAttribute("Stunned", true)
char:SetAttribute("Posture", 4)
local gbtrack = char.Humanoid:LoadAnimation(animations.GuardBreak)
char:SetAttribute("cancel", true)
gbtrack.Priority = Enum.AnimationPriority.Action4
gbtrack:Play()
print(char, "guard break")
task.wait(2.5)
gbtrack:Stop()
char:SetAttribute("Stunned", false)
end
end
it does print Rig guard break, i also tried loading it onto the Animator but no change
this is the idle animation, but i dont think it should be problem since its lower priority.
if npc then
local animType = weaponInfo[weapon] and weaponInfo[weapon].AnimateType or 1
local humanoid = wielder:FindFirstChild("Humanoid")
game.StarterPack[weapon]:Clone().Parent = wielder
if animType == 1 and animations.Weapons[weapon] then
wielder:SetAttribute("Katana", true)
-- Play the equip animation
local equipTrack = humanoid:LoadAnimation(animations.Weapons[weapon].Equip)
equipTrack.Priority = Enum.AnimationPriority.Action
equipTrack.Looped = false
equipTrack:Play()
-- Update idle/walk only after the equip finishes
equipTrack.Stopped:Connect(function()
-- Destroy the equip track
equipTrack:Destroy()
-- Update idle/walk animations
local wAnims = animations.Weapons[weapon]
if wielder:FindFirstChild("Animate") then
wielder.Animate.idle.Animation1.AnimationId = wAnims.Idle.AnimationId
wielder.Animate.idle.Animation2.AnimationId = wAnims.Idle.AnimationId
wielder.Animate.run.RunAnim.AnimationId = wAnims.Walk.AnimationId
wielder.Animate.walk.WalkAnim.AnimationId = wAnims.Walk.AnimationId
-- Briefly disable/re-enable Animate to apply changes
wielder.Animate.Enabled = false
task.wait(0.03) -- tiny delay to ensure changes apply
wielder.Animate.Enabled = true
end
end)
elseif animType == 2 and humanoid and animations.Weapons[weapon].Equip then
local track = humanoid:LoadAnimation(animations.Weapons[weapon].Equip)
track:Play()
track.Looped = false
track.Stopped:Connect(function()
track:Destroy()
if animations.Weapons[weapon].Idle then
local idleTrack = humanoid:LoadAnimation(animations.Weapons[weapon].Idle)
idleTrack.Priority = Enum.AnimationPriority.Action
idleTrack:Play()
idleTrack.Looped = true
end
end)
end
end
any help is appreciated
