Advertisement
KashTheKingYT

DeathAnimation

Nov 11th, 2021
9,531
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.44 KB | None | 0 0
  1. local char = script.Parent
  2. local hum = char:WaitForChild("Humanoid")
  3. local deathAnim = hum:LoadAnimation(script.DeathAnim)
  4. hum.BreakJointsOnDeath = false
  5. local dead = false
  6.  
  7. function deathCheck(health)
  8.     if health <= 0 and dead == false then
  9.         dead = true
  10.         char.HumanoidRootPart.Anchored = true
  11.         deathAnim:Play()
  12.         wait(4)
  13.         char.HumanoidRootPart.Anchored = false
  14.         script:Destroy()
  15.     end
  16. end
  17.  
  18. hum.HealthChanged:Connect(deathCheck)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement