Hello everyone, I need help scripting a code that makes a player play a random animation when it dies. I have a code from a YouTube tutorial from Hyperr Hydra. This is my code
wait() local Humanoid = script.Parent.Humanoid Humanoid.BreakJointsOnDeath = false local DA = Instance.new("Animation") DA.AnimationId = "rbxassetid://myid" local DeathAnimation = Humanoid:LoadAnimation(DA) Humanoid.HealthChanged:Connect(function(Health) if Health <= 0 then script.Parent.HumanoidRootPart.Anchored = true DeathAnimation:Play() wait(3.5) script.Parent:Destroy() end end)
I want that the player play one animation of various, for example. I would be very grateful if you could help me, thanks. And sorry if I have a bad translation, I don't speak English.