Idisjsusus

BACON

Mar 1st, 2025
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local LocalPlayer = Players.LocalPlayer
  3. local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
  4. local Humanoid = Character:WaitForChild("Humanoid")
  5.  
  6. -- IDs das animações (ambos no formato rbxassetid://)
  7. local OLD_ANIMATION_ID = "rbxassetid://87259391926321"
  8. local NEW_ANIMATION_ID = "rbxassetid://78254309368241"
  9.  
  10. -- Função para substituir a animação
  11. local function ReplaceAnimation(oldId, newId)
  12. -- Verifica se o Humanoid existe
  13. if not Humanoid then
  14. warn("Humanoid não encontrado!")
  15. return
  16. end
  17.  
  18. -- Obtém o Animator do Humanoid
  19. local Animator = Humanoid:FindFirstChildOfClass("Animator")
  20. if not Animator then
  21. warn("Animator não encontrado!")
  22. return
  23. end
  24.  
  25. -- Itera sobre todas as animações carregadas no Animator
  26. for _, track in pairs(Animator:GetPlayingAnimationTracks()) do
  27. -- Verifica se a animação atual corresponde ao ID antigo
  28. if track.Animation and track.Animation.AnimationId == oldId then
  29. -- Cria uma nova animação com o ID novo
  30. local newAnimation = Instance.new("Animation")
  31. newAnimation.AnimationId = newId
  32.  
  33. -- Substitui a animação antiga pela nova
  34. local newTrack = Animator:LoadAnimation(newAnimation)
  35. newTrack:Play()
  36.  
  37. -- Para a animação antiga
  38. track:Stop()
  39.  
  40. print("Animação substituída com sucesso!") -- Apenas para debug
  41. break
  42. end
  43. end
  44. end
  45.  
  46. -- Substitui a animação quando o personagem é carregado
  47. Character:WaitForChild("Humanoid").Died:Connect(function()
  48. -- Reconecta quando o personagem respawna
  49. Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
  50. Humanoid = Character:WaitForChild("Humanoid")
  51. end)
  52.  
  53. -- Substitui a animação em um loop constante
  54. while true do
  55. ReplaceAnimation(OLD_ANIMATION_ID, NEW_ANIMATION_ID)
  56. task.wait(0.1) -- Verifica a cada 0.1 segundos
  57. end
Advertisement
Add Comment
Please, Sign In to add comment