Log in to vote
0

I made a boss battles if i = 2 but something is not quite right?

Asked by 4 months ago
if i == 2 then
            game.Lighting.DarkSkies.Parent = game.ServerStorage
            game.ServerStorage.Hell.Parent = game.Lighting
            game.Workspace.wave45:Stop()
            game.Workspace.FinalBossMusic:Play()
            game.ServerStorage.FinalBoss.Parent = game.Workspace
            game.ServerStorage.Towers.Parent = game.Workspace
            if 49999 > game.Workspace.FinalBoss.Humanoid.Health then
                game.Lighting.Hell.Parent = game.ServerStorage
                game.Workspace.FinalBossMusic:Stop()
                game.Workspace.FinalBoss.Parent = game.ServerStorage
                game.Workspace.Towers.Parent = game.ServerStorage
            end
        end

This is the code^ everything works fine until;

 if 49999 > game.Workspace.FinalBoss.Humanoid.Health then 

Boss normaly has 50k health and i want to make disappear everything when I shoot him once but it doesnt work everytime i try.

And I also tried;

if game.Workspace.FinalBoss.Humanoid.Health < 49999 then

But still not happend.

I will be very happy if this issiue solved :)

1
That is because the if-statement was already evaluated; it was checked on runtime and proved false, thus reaching the EOF and the ultimate end of the program. You need to listen for an adjust in the boss' health and check then. Ziffixture 6785 — 4mo
0
To reiterate what Ziff said, the if statement does not work because the script only checks it once when i = 2. You need to separate the two statements. LeedleLeeRocket 1257 — 4mo

1 answer

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

You need to separate the two if statements by putting an

 end 

after the

 game.ServerStorage.Towers.Parent = game.Workspace 

and deleting the last

 end 

of the code. Your code should look like this:

 if i == 2 then
     game.Lighting.DarkSkies.Parent = game.ServerStorage
     game.ServerStorage.Hell.Parent = game.Lighting
     game.Workspace.wave45:Stop()
     game.Workspace.FinalBossMusic:Play()
     game.ServerStorage.FinalBoss.Parent = game.Workspace
     game.ServerStorage.Towers.Parent = game.Workspace
     end
     if 49999 > game.Workspace.FinalBoss.Humanoid.Health then
         game.Lighting.Hell.Parent = game.ServerStorage
         game.Workspace.FinalBossMusic:Stop()
         game.Workspace.FinalBoss.Parent = game.ServerStorage
         game.Workspace.Towers.Parent = game.ServerStorage
     end
Ad

Answer this question