Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Replace these with your actual animation ID and sound ID
- local animationId = "rbxassetid://18445236460"
- local soundId = "rbxassetid://18445228136"
- -- Get the player's character
- local player = game.Players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- -- Play the animation
- local humanoid = character:WaitForChild("Humanoid")
- local animator = humanoid:FindFirstChildOfClass("Animator") or humanoid:WaitForChild("Animator")
- local animation = Instance.new("Animation")
- animation.AnimationId = animationId
- local animationTrack = animator:LoadAnimation(animation)
- animationTrack:Play()
- -- Play the sound
- local sound = Instance.new("Sound")
- sound.SoundId = soundId
- sound.Parent = character:WaitForChild("HumanoidRootPart")
- sound:Play()
- -- Wait for the animation and sound to finish
- animationTrack.Stopped:Wait()
- sound.Ended:Wait()
- -- Cleanup sound after playback
- sound:Destroy()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement