Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a dialog option kill the player?

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

✓ Accepted answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.