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

How to make a Conditional Script where an NPC dies?

Asked by 3 years ago
Edited 3 years ago

I am making a game where there is a "final boss", I'm triyng to make a Script where a Part at the center of the arena we fight him, vanishes so we can enter the room behind it, that Part's name is "Lid" and I've tried to make an Script like this:

(This is literally how I've written it in the Script).

if game.Workspace.Arena.Boss.Humanoid.Health == 0 then

game.Workspace.Arena.Lid.Transparency = 1

game.Workspace.Arena.Lid.CanCollide = false

end

The script doesn't work as expected, what can I do to it to work?

1 answer

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

um... you wrote the script wong, that's the problem. the script you wrote will check the hp of the boss when the map just loaded then it stop. you should make a connect function when the boss die. here is an example:

game.Workspace.Arena.Boss.Humanoid.Died:Connect(function(

game.Workspace.Arena.Lid.Transparency = 1

game.Workspace.Arena.Lid.CanCollide = false

end)
0
Thanks :DDDDDD I've finally completed this part of the game... I'm so- excited, thank you, seriously, thank you! UberFre4k -3 — 3y
0
You should mark the answer as solution cherrythetree 130 — 3y
Ad

Answer this question