Ad
Log in to vote
-1

how do i make so whenever a boss dies, a wall explodes?

Asked by
avozzo 2
7 months ago

does anyone possibly know that kind of script, so whenever a boss dies, a wall will explode? i've read through almost the full guide on the roblox website, but there weren't any tips on how to use the "on died" thing. im still really new to lua, and currently learning, so could anyone please tell me how to use the "On died" function (explaining how it works to, if possible, please.), or if your feeling nice, maybe giving a working script that is capable of doing that? also, could anyone say how to make the wall and boss respawn after a while? thanks in beforehand.

2 answers

Log in to vote
1
Answered by 7 months ago

Well we can check when the npc dies by using this function: you can put the script inside the npc's head or any other body part.

while true do --this line of code will repeat the if statement so that it doesnt just run when the game is started then stop.
wait(0.1) --repeats every 0.1 seconds
if script.Parent.Parent.Humanoid.Health == 0 then --tests for when the the npc dies
game.workspace.wall:Destory() --this can be substituted as cancollide = false.
end --ends the if statment
end --ends the while loop
--GalaxyFPS_Studios

There are other ways to do this, but I kinda like this one. There may be errors i havent tested this but, fool around with what you can do.

Another possibility is to create and explosion at the wall then set the transparency to 1 and collisions to false.

Ad
Log in to vote
0
Answered by
INOOBE_YT 219 Moderation Voter
7 months ago

Firstly, you will need a died event on the boss's humanoid:

BossHumanoid.Died:Connect(function()

end)

Next, you will need to make an instance of an explosion:

BossHumanoid.Died:Connect(function()
    local Explosion = Instance.new("Explosion")
    Explosion.Parent = game.Workspace
    Explosion.Position = game.Workspace.Wall.Position
end)

Finally, you will have to remove the wall:

BossHumanoid.Died:Connect(function()
    local Explosion = Instance.new("Explosion")
    Explosion.Parent = game.Workspace
    Explosion.Position = game.Workspace.Wall.Position
    game.Workspace.Wall:Destroy()
end)

Answer this question