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

How do I make a dialog option kill the player?

Asked by
Galicate 106
6 years ago
Edited 6 years ago

I have a script that kill you if you choose the wrong dialog option but it doesnt work.

function Chosen(player,dialog)
if dialog.Name == "Die" then
        game.Players.LocalPlayer.Character.Humanoid.Health = 0
        script.Parent.Parent.Sound:Play()
    end

script.Parent.Choose.DialogChoiceSelected:connect(Chosen)


--GalaxyFPS Studios

1 answer

Log in to vote
0
Answered by
ziAce 15
6 years ago

I'm not sure about this but you have to set the dialog's name first.

function Chosen(player, dialog)
dialog.Name = "Die"
if dialog.Name == "Die" then
        game.Players.LocalPlayer.Character.Humanoid.Health = 0
        script.Parent.Parent.Sound:Play()
    end

script.Parent.Choose.DialogChoiceSelected:connect(Chosen)


--GalaxyFPS Studios

I'm new as well but just adding dialog.Name = "Die" should make the if statement work.

Ad

Answer this question