Advertisement
ILovePotato

Untitled

Jan 22nd, 2025
17,138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. -- Configuration
  2. local animationId = "rbxassetid://16945573694" -- Replace with your animation's ID
  3. local soundId = "rbxassetid://16945495411" -- Replace with your sound's ID
  4.  
  5. -- Get the Player and Character
  6. local player = game.Players.LocalPlayer
  7. local character = player.Character or player.CharacterAdded:Wait()
  8. local humanoid = character:FindFirstChildOfClass("Humanoid")
  9.  
  10. if not humanoid then
  11. warn("Humanoid not found!")
  12. return
  13. end
  14.  
  15. -- Load and Play Animation
  16. local animation = Instance.new("Animation")
  17. animation.AnimationId = animationId
  18.  
  19. local animator = humanoid:FindFirstChildOfClass("Animator") or humanoid:WaitForChild("Animator")
  20. local animationTrack = animator:LoadAnimation(animation)
  21.  
  22. animationTrack:Play()
  23.  
  24. -- Play Sound
  25. local sound = Instance.new("Sound")
  26. sound.SoundId = soundId
  27. sound.Volume = 5 -- Adjust volume if needed
  28. sound.Parent = character:FindFirstChild("Head") or character.PrimaryPart
  29.  
  30. sound:Play()
  31.  
  32. -- Clean up after sound ends
  33. sound.Ended:Connect(function()
  34. sound:Destroy()
  35. end)
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement