function Chosen(player, dialog)
dialog.Name = "KillsYou"
if dialog.Name == "KillsYou" then
game.Players.LocalPlayer.Character.Humanoid.Health = 0
end
end
script.Parent.DialogChoiceSelected:connect(Chosen)
I currently am trying to setup a dialog option where when you select a specific option, it will kill you. However, the code does nothing. I have the script placed inside of the dialog option that is called "KillsYou". I have tried setting it as a local script and a regular script but to no avail.
The console outputs:
DialogChoiceSelected is not a valid member of Workspace "Workspace"
Any help would be much appreciated!!!

2 comments
The code didn't work until I moved it into StarterPlayerScripts, but this definitely helped a lot. Thank you!!!
Your very welcome