Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make it so that music starts playing when Tank zombie is defeated?

Asked by 4 years ago

I am making a zombie game and I want to know how to make it so that then the Tank Zombie is defeated victory music starts playing and whatever. I tried making a script for it but it didn't work. Here is the script:

if not game.Workspace:FindFirstChild("Tank")then
    game.Workspace.Tank1Music:Stop()
    game.Workspace.VictoryMusic:Play()
end

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Hello, the zombie still stays in workspace, so I just recommend doing this:

debounce = true
while true do
wait()
if workspace.Tank:FindFirstChild("Humanoid").Health < 1 and debounce then
      debounce = false
      workspace.Tank1Music:Stop()
      workspace.VictoryMusic:Play()
end
end

I’ve also added a while true do loop. Hope it helps

0
Wow this worked thanks :3 Sp00ked1 6 — 4y
0
Np! alexfinger21 341 — 4y
Ad

Answer this question