Advertisement
KashTheKingYT

DamageSounds

Nov 2nd, 2021 (edited)
7,451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. --[[
  2. Hey everyone,
  3. this was an old video so there were some bugs.
  4. If the sound is playing when you respawn then turn off playonremove in the damage sound and use this script instead.
  5. --]]
  6.  
  7. local plr = game.Players.LocalPlayer
  8. local char = plr.Character
  9. local humanoid = char.Humanoid
  10. local oldHealth = humanoid.Health
  11. local sound = char:WaitForChild("DamageSound")
  12.  
  13. humanoid.HealthChanged:Connect(function(health)
  14.     if oldHealth > health then
  15.         local newSound = sound:Clone()
  16.         newSound.PlayOnRemove = true
  17.         newSound.Parent = char
  18.         newSound:Destroy()
  19.     end
  20.     oldHealth = health
  21. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement