How do i make this short ''sound effect'' playing when this crate gets damaged?
I'm trying to make a crate that has Health and each time that it gets damaged, no matter how much damage you'll hear a little ''sound effect'' playing. However, if the Health = 0 or lower, you won't hear the sound effect playing no matter how much it get's damaged. So, i have a model. Inside that model i have a bunch of parts (18) that make the crate, i have a script (the script will make the parts unanchored once the Health = 0 or lower), and i have a Humanoid in the model (stats are Maxhealth = 100 and Health = 100) The sound ID i want it to play when it gets damaged = 550208601 Here is my script if you need it.
02 | script.Parent.Humanoid.HealthChanged:connect( function () |
03 | if script.Parent.Humanoid.Health < = 0 then |
04 | b.Center.Transparency = 1 |
05 | b.Center.CanCollide = false |
06 | b.Part 1. Anchored = false |
07 | b.Part 2. Anchored = false |
08 | b.Part 3. Anchored = false |
09 | b.Part 4. Anchored = false |
10 | b.Part 5. Anchored = false |
11 | b.Part 6. Anchored = false |
12 | b.Part 7. Anchored = false |
13 | b.Part 8. Anchored = false |
14 | b.Part 9. Anchored = false |
15 | b.Part 10. Anchored = false |
16 | b.Part 11. Anchored = false |
17 | b.Part 12. Anchored = false |
18 | b.Part 13. Anchored = false |
19 | b.Part 14. Anchored = false |
20 | b.Part 15. Anchored = false |
21 | b.Part 16. Anchored = false |
22 | b.Part 17. Anchored = false |
23 | b.Part 18. Anchored = false |
I'm not the best at scripting so there might be things in this script that i could make shorter or something. You can help me with that too :D. Thanks!